Database log deletion

xiaoxiao2021-04-01  220

- Compressed log

1: Truncate transaction log: Backup log database name with no_log

2: Empty Log Dump Transaction Database name with no_log

Again: Enterprise Manager - Right click on the database you want to compress - All Tasks - Shrink Database - Shrink File - Select Log File - Select to shrink to XXM in the shrink mode, here will give an allowable shrinkage to The minimum number, enter this number directly, it is ok.

3: Delete LOG 1: Separate Database Enterprise Manager -> Server -> Database -> Right button -> Separate Database 2: Delete Log Files 3: Additional Database Enterprise Manager -> Server -> Database -> Right -> Additional Database This Generate new logs, only 500 k only 500 k, set this database to use the code: Separate the PUBS below, and then attach one of the PUBS to the current server.

EXEC SP_DETACH_DB @dbname = 'pubs'Exec sp_attach_single_file_db @dbname =' pubs', @physname = 'c: / program files / microsoft sql server / mssql / data / pubs.mdf'

4: If you want to do it, you don't let it grow Enterprise Manager - Server - Right-click Database - Property - Transaction Log - Limit the file growth to xm (x is your maximum data file size)

--SQL statement setting mode: Alter Database Database name modify file (name = logical file name, maxsize = 20)

5. Set to Auto Continue Enterprise Manager - Server - Right-click Database - Property - Option - Select "Auto Shrink"

Dump Transaction JSP_Manage with no_log

DBCC ShrinkDatabase (JSP_Manage, 1)

转载请注明原文地址:https://www.9cbs.com/read-131191.html

New Post(0)