Shrinking of Log File
Shrinking of log file concept has to be done when we will receive disk space issue, in such scenario we have to follow these steps
- First we have to check why disk space issue is raised like if it is raised due to data file size we have to add extra disk space.
- If it is raised due to log file size we have to shrink log file for this check with this below command DBCC sqlperf(logspace) it will show from which database is causing the issue.
- Then find the data file size and log file size using this stored procedure SP_helpdb <db name>
- Here the shrinking is done when the size of the log file is more than half of the size of data file ie.,if data file size is 30 mb then the log file size is 15 mb is recommended.
- Take one log backup to reduce the usage of log file.
- Next find logical name of that log file by using this stored procedure SP_helpdb <db name>
- Then execute this command use master go DBCC shrinkfile('logfile name', required size in mb)
No comments:
Post a Comment