Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shrinking log file

Status
Not open for further replies.

Luvsql

Technical User
Apr 3, 2003
1,179
CA
I have just run a full database backup and a log backup (reconvery method set to full). My log is currently only 8mb in size, but is taking over 3Gb of space on the hard drive (as are a few other databases). I have gone into EM on 2000, right click > all tasks > shrink database, then files and selected the log. I have told it what size to shrink it to. It says successful, but the size of the physical file on the hard drive is still over 3Gb.
 
Once I have a secured backup (just in case...)what I do is

Detach the database (sp_detach_db 'dbname','true')
Delete the log file (dbname.ldf)
Reattach the the database without specifying a log file
sp_attach_db @dbname='dbname',@filename1 = 'path/dbname/ldf'

The new log file will de created starting size is set to the default (ie as per the model database).

See BOL for for more information on the sytem stored procs..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top