Current location - Loan Platform Complete Network - Big data management - That LDF file is too big, how to do
That LDF file is too big, how to do
The LDF file is too large, the following SQL2005 for the benefit of explaining the solution:

Please follow the steps, did not carry out the previous steps, please do not do the latter steps Otherwise, you may damage your database.

1, empty the log:

DUMPTRANSACTION library name WITH NO_LOG

2, truncate the transaction log:

BACKUPLOG library name WITH NO_LOG

3, shrink the database file (if not compressed, the database file will not be reduced):

Server - right-click the database you want to compress - all tasks - shrink the database - the Shrink the file

-- select the log file - in the shrink operation choose to reorganize the page before releasing the unused space, here will give a minimum number of M allowed to shrink to, OK on it

--Select the datafile --Select to reorganize the pages before releasing the unused space in the shrink operation, here will give a minimum number of M allowed to shrink to, OK can be

Can also be done with SQL statements

< p>--shrink the database

DBCC SHRINKDATABASE (library name)

--shrink the specified datafiles, 1 is the file number, can be queried by this statement: select * from sysfiles DBCC SHRINKFILE(1)

4, in order to maximize the shrinkage of the log file:

a, separation of databases:

Server - Database - -right-click - Separate Database

b, Delete the LOG file in My Computer

c, Attach Database:

Server - Database --Right-click--Attach Database

This method will generate a new LOG, the size of only 500K

5, in order to automatically shrink in the future, do the following settings:

Server -Right-click on the database -Properties -Options - Select "Auto Shrink"

6, If you want to prevent it from growing too large a log in the future:

Server -- right-click the database -- Properties -- File -- Database Files -- Log -- Logs. -Database Files - Logs - Increment by 10%, no limit on growth - Limit file growth to xM (x is the maximum you allow for data file size)

Note: It is generally not recommended to do steps 4 and 6

Step 4 is not safe, there is a risk of damaging the database or losing data

Step 6 If the log reaches the limit, future database processing will fail and you will not be able to recover until after you clean up the log.