Transaction log is full. How do I shrink it?

https://support.myeasyprojects.net/kb/a163/transaction-log-is-full_-how-do-i-shrink-it.aspx


Error Message when transaction log is full :

Msg 9002, Level 17, State 2, Line 58
The transaction log for database 'chs2' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases


Solution refer to the above URL:

/*You must shrink the transaction log by executing one of the following scripts depending on the version of your MS SQL Server.


For MS SQL Server 2005 the script is as follows:


USE <DatabaseName>
GO
DBCC SHRINKFILE (<TransactionLog>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLog>, 1)
GO


*/
--For MS SQL Server 2008 / 2008R2:


ALTER DATABASE CHS2Offline set recovery simple
GO
CHECKPOINT
GO
DBCC SHRINKFILE (CHS2OFFLINE_log,1)
GO
ALTER DATABASE CHS2Offline set recovery full
GO


/*
where:
<DatabaseName> - the name of your EP database, e.g. "EasyProjects",
<TransactionLog> - logical name of EP database log file, e.g. "EasyProjects_log".


In order to find out what is the logical name of your EP database log file:
1) Open the SQL Server management studio,
2) Right-click on your EP database and choose Properties,
3) Click on the 'Files' tab.
*/






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值