1 in the process of using the database will increase the log files, so that the performance of the database decreased, and occupy a large amount of disk space. The SQL Server database has a log file, and the log file records the user's actions on the database modifications. You can clear the database log by directly deleting the log file and emptying the logs.
First, delete log
1, separate the database. Before separating the database, make sure to do a full backup of the database, select the database-right--task--separate.
Tick Delete connection
The detached database will not be visible to the database list after it is detached.
2. Delete log file
3, attach the database, the additional time will be reminded to find the log file.
Remove the LDF file for database information information:
After attaching the database, a new log file is generated and the new log file size is 504K.
You can also do this by command:
Use master;
exec sp_detach_db @dbname = ' TestDB ';
exec sp_attach_single_file_db @dbname = ' TestDB ', @physname = ' D:\Program Files\Microsoft SQL Server\mssql10. Sql2008\mssql\data\testdb.mdf '
Second , empty the log
This command is supported in SQL Server 2005 and 2000, and SQL Server 2008 does not support this command.
DUMP TRANSACTION TestDB with no_log
iii. shrinking database files
Iv. truncation of transaction logs
BACKUP LOG TestDB with no_log
The command is also not supported in SQL Server 2008, which can be used in SQL Server 2005 and 2000.
SQL Server Delete Log