Base de connaissances
Shrink MsSql DB Logs
1. Open query analyser. Do not open Enterprise Manager.
2. Let the database be selected as “Master”
3. Fire the command
BACKUP LOG “DATABASE_NAME” WITH TRUNCATE_ONLY
BACKUP LOG “db0098″ WITH TRUNCATE_ONLY
This should show you a success message
4. Now change the database seclected in query analyser to “DATABASE_NAME” where DATABASE_NAME is the name of the database which needs modified
5. Fire the command as below:
DBCC SHRINKFILE ('DATABASE_NAME_Log', 1);
DBCC SHRINKFILE ('db0098Log', 1);
where database-name_Log is the name of the log file of the db concerned. Such as test_Log. And the valuew ’1′ indicates the size that the log file needs to be shrunk to. This can be any value depending on the size of the log file of the db. This value is considered in MB’s.
PS: if you copy and paste the above command in QA, it will throw a syntax error message. You should rather key it in or if you do copy and paste the query, then delet the D at the start of the query and key it in again and do the same for the training bracket. The query will run without trouble then.