SQL Server 2008 Empty delete log file (instant log becomes several m) _mssql2008

Source: Internet
Author: User
Tags sql server query

SQL2008 Empty Delete log:

Method One:

Use [master]
to
ALTER DATABASE AFMS set RECOVERY simple and no_wait
go
alter DATABASE AFMS SET RECOVERY S Imple
go
to Afms
go
DBCC shrinkfile (N ' Afms_log ', one, truncateonly) go use
[master]
Go
ALTER DATABASE AFMS set RECOVERY full and no_wait
go
alter DATABASE AFMS SET RECOVERY full
Go

' Clearing the log in SQL2008 must be done in simple mode, until the purge action is complete and then back to full mode.

Use [master]
to
ALTER DATABASE Dnname set RECOVERY simple and no_wait
go
alter DATABASE dnname SET RE Covery Simplicity--Simple mode
go
to Dnname
go
DBCC shrinkfile (N ' Dnname_log ', one, truncateonly) 

go< c27/> ' Here's dnname_log if you don't know what the name is in Sys.database_files, you can use the following annotated statement to query

' using 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-revert to complete mode 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 note that by modifying the database name below, I will not comment anymore.
go
Dump Transaction dnname and No_log go to
dnname
DBCC shrinkfile (2)
go

sqlserver2000 Compressed Log

you can make jb51.ldf files very small, make it easy to back up databases, and so on, and execute them in SQL Server Query Analyzer.

DUMP TRANSACTION [jb51] with no_log 
BACKUP LOG [jb51] with no_log 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.