SQL Server R2 transaction log is full

Source: Internet
Author: User

Method One:

  1. Use [master]
  2. GO
  3. ALTER DATABASE dnname SET RECOVERY simple with no_wait
  4. GO
  5. ALTER DATABASE dnname SET RECOVERY Simple--Easy mode
  6. GO
  7. Use Dnname
  8. GO
  9. DBCC shrinkfile (N ' Dnname_log ', one, truncateonly)
  10. GO
  11. Use [master]
  12. GO
  13. ALTER DATABASE dnname SET RECOVERY full with no_wait
  14. GO
  15. ALTER DATABASE dnname SET RECOVERY Full--Revert to complete mode
  16. GO

Method Two:

Error: Database .... The transaction log is full. To find out why you cannot reuse space in the log, see the Log_reuse_wait_desc column in sys.databases

Treatment methods:

--Set the database to Simple mode. The log file is automatically disconnected.

ALTER DATABASE dbname set recovery simple

--View Log file status
Use dbname
DBCC SHRINKFILE (' logname ')--like Xxxx_log

--Recovering the database schema
ALTER DATABASE dbname SET recovery full

Method Three:

Run the DBCC shrinkfile command when no activity occurs in the tempdb database. To ensure that other processes cannot use tempdb while executing DBCC shrinkfile, you must restart SQL Server in single-user mode. For more information about the DBCC SHRINKFILE, see the section stated performing DBCC SHRINKDATABASE or dbccshrinkfile when using Tempdb.
1. Determine the desired size of the master data file (tempdb.mdf), log file (templog.ldf), and/or other files added to tempdb. Make sure that the space used in these files is less than or equal to the desired target size.
2. Connect to SQL Server with Query Analyzer, and then run the following Transact-SQL commands for a specific database that needs to be shrunk:

Use tempdb
Go

DBCC SHRINKFILE (tempdev, ' target size in MB ')
Go
--This command shrinks the primary data file

DBCC SHRINKFILE (templog, ' target size in MB ')
Go
--This command shrinks the log file and look at the last paragraph.

SQL Server R2 transaction log is full

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.