SQL in the use of each query will generate a log, but if you do not go to clean up, maybe the whole hard are piled up oh, I encountered such a situation, the direct site backstage are not going. Let's learn how to clean this log.
SQL2008 Empty Delete log:
Method One:
Use [Master]GOALTER DATABASEAfmsSETRECOVERY Simple withno_waitGOALTER DATABASEAfmsSETRECOVERY SimpleGO UseAFMSGODBCCShrinkfile (N'Afms_log', One, Truncateonly)GO Use [Master]GOALTER DATABASEAfmsSETRECOVERY Full withno_waitGOALTER DATABASEAfmsSETRECOVERY FullGO
' Clearing the log in SQL2008 must be done in simple mode, and then back to full mode when the cleanup is complete.
Use [Master]GOALTER DATABASEDnnameSETRECOVERY Simple withno_waitGOALTER DATABASEDnnameSETRECOVERY Simple--Simple ModeGO UseDnnameGODBCCShrinkfile (N'Dnname_log', One, Truncateonly)GO 'Here's Dnname_log if you don't know what the name is in sys.database_files, you can query it with the following annotated statement' UseDnname'GO'SELECT file_id, Namefrom sys.database_files;'gouse [master]goalter database Dnname set RECOVERY full with No_waitgoalter database Dnname SET RECOVERY Total--Revert to complete mode -Style Go
SQL2005 Empty Delete log:
Backup Log dnname with No_log ' Here's dnname is the name of the database you want to shrink, and I'm not going to comment anymore by changing the database name below. Godump transaction dnname with no_log gouse dnnamedbcc shrinkfile (2) Go
sqlserver2000 Compression Log
You can make the Jb51.ldf file very small, easy to back up the database, and so on, executed in SQL Server Query Analyzer.
1 DUMP TRANSACTION [jb51] with 2BACKUPLOG[jb51] with 3DBCC shrinkdatabase ([jb51])
SQL Server 2008 Empty delete log file (instant log changes to several m)