Posts Tagged Database

Shrink log size in sql database

To shrink the file size I use the following script:

Use DBName
Go
exec sp_dboption DBName, ‘trunc. log on chkpt.’, true
checkpoint
DBCC SHRINKFILE (N’DBNameFileName, 0);
exec sp_dboption DBName, ‘trunc. log on chkpt.’, false

, , , ,

No Comments

Restore database users in MS SQL SEVER

This is for when you restore a database and want to hook the users in the new database to the users with the same name in the SQL Server

login to the db as SA

exec sp_change_users_login ‘Auto_Fix’, ‘dbName’

, ,

1 Comment