An Evil Miracle :: Experiments in Requirements Elicitation Rotating Header Image

T-SQL

SQL Change owner of objects

One might need to change the owner of objects in a whole database, especially after a restore. The following are helper stored procedures that one may use to change ownership of a whole set of objects from one owner to another. The list below code are for Routines, Tables and Single items.

(more…)

Print Friendly

Shrink logs of SQL database

SQL databases consist of the data part and the log part. The log part may become exceedingly large and from time to time may be required to be shrinked

BACKUP LOG database_name WITH TRUNCATE_ONLY
GO
DBCC SHRINKDATABASE( database_name )
GO

Unfortunately¬†Windows event log lists and error that the log has been ‘shrinked’.¬† Obviously you do not need to worry (except if you needed those logs!) since you know that you did that action and for what!

Print Friendly