Tuesday, December 9, 2008

SQL Server Maintenance

* To Shrink Transaction Log
----------------------------

Open Query Analyzer.
First, Backup the database log using command:
BACKUP LOG [database name] No_Log

Then, execute this command:
DBCC Shrinkfile ([log file], [size])
[log file] here, is, the Logical name of the database log file, and not physical name.
[size] is the expected size of the database log file.

To get the logical name of the log file, execute this command:
sp_helpdb [database name]”. This will show you the logical name of the database and database log, and the database file name and database log file name.


* To Check Harddisk Capacity

-------------------------------
Run this Stored Procedure:
EXEC xp_fixeddrives

The result will be some kind like this:
Drive MB free
----- -------------
C 18230
D 35690


(2 row(s) affected)

No comments:

Post a Comment

Leave a message