Current location - Health Preservation Learning Network - Healthy weight loss - The transaction log file of SQL Server 2000 database is too large. How to reduce it?
The transaction log file of SQL Server 2000 database is too large. How to reduce it?
Faithful wife, spent a whole morning combining the blogs of predecessors, and finally reduced the database log of sqlserver2008 to 1MB and shared it with everyone.

# Method steps

1. Change the execution of SQL statement to Simple Mode.

Step 2 shrink the database

3. Execute the SQL statement and change back to "full mode"

# # Step 1: Change the execution of SQL statement to "simple mode"

Use [master]

go to

Change the database? SlowXWebDB (change it to the name of the database that needs to be shrunk) sets RECOVERY SIMPLE with NO_WAIT.

go to

ALTER DATABASE SlowXWebDB SET RECOVERY SIMPLE-Change to simple mode.

go to

# # Step 2: Perform database operation.

Screenshots and operations of related interfaces

Suppose:

Database name: SlowXWebDB

Log file name: SlowXWebDB_Log

The database log file is too large and needs to be cleaned.

** 1. Select the database and right-click Task-Shrink-File? Note: The file type is selected as Log * *

2. Select the size to be reduced, as shown in the figure below, and the minimum size is 0MB. I actually measured it, and the minimum can only be 1MB, but it is already very satisfactory. Haha * *

3. Click "Confirm", and the log file of several tens of gigabytes is thinned down with a whoosh. * * * See the effect of cleaning up database log files.

# # Step 3: Change the execution of SQL statement to "full mode"

Use [master]

go to

ALTER DATABASE SlowXWebDB SET RECOVERY FULL WITH NO_WAIT.

go to

ALTER DATABASE datebaseName sets the restore full restore to full mode.

go to

= = Finally, don't forget to test whether the database can be used normally = =

Web page link