Logs are generated for each query in SQL, but if you do not clean up for a long time, the whole hardware may be full. In this case, I cannot directly enter the website background. Next let's take a look at how to clear this log SQL2005 clear the delete log: copy the Code as follows: BackupLogDNNamewithno_log
Logs are generated for each query in SQL, but if you do not clean up for a long time, the whole hardware may be full. In this case, I cannot directly enter the website background. Next, let's take a look at how to clear this Log. SQL2005 clears the delete Log: the code is as follows: Backup Log DNName with no_log'
Logs are generated for each query in SQL, but if you do not clean up for a long time, the whole hardware may be full. In this case, I cannot directly enter the website background. Next, let's take a look at how to clear this log.
SQL2005 clear deletion logs:
The Code is as follows:
Backup Log DNName with no_log the DNName here is the name of the database you want to contract. You must modify the following database name and I will not comment it out.
Go
Dump transaction DNName with no_log
Go
USE DNName
Dbcc shrinkfile (2)
Go
SQL2008 clear deletion logs:
'Log cleanup in SQL2008 must be performed in simple mode. After the cleanup is completed, the system calls back to full mode.
The Code is as follows:
USE [master]
GO
Alter database DNName set recovery simple with NO_WAIT
GO
Alter database DNName set recovery simple -- SIMPLE mode
GO
USE DNName
GO
Dbcc shrinkfile (n'dnname _ log', 11, TRUNCATEONLY)
GO
'Dnname_log here, if you do not know the name in sys. database_files, you can use the following annotated statement to query
'Use DNName
'Go
'Select file_id, nameFROM sys. database_files;
'Go
USE [master]
GO
Alter database DNName set recovery full with NO_WAIT
GO
Alter database DNName set recovery full -- restore to FULL Mode
GO
Sqlserver2000 compressed logs
The jb51.ldf file can be very small to facilitate database backup, and can be executed in the SQL Server Query analyzer.
The Code is as follows:
Dump transaction [jb51] WITH NO_LOG
Backup log [jb51] WITH NO_LOG
Dbcc shrinkdatabase ()