Method One:
- Use [master]
- GO
- ALTER DATABASE dnname SET RECOVERY simple with no_wait
- GO
- ALTER DATABASE dnname SET RECOVERY Simple--Easy mode
- GO
- Use Dnname
- GO
- DBCC shrinkfile (N ' Dnname_log ', one, truncateonly)
- 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
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
--Recover database schema alter 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