MS Sqlserver 2000 transaction log shrink step

MS Sqlserver 2000 transaction log shrink step,第1张

概述First, review the transaction log size prior to the shrinking process. USE [YourDatabaseNameHere] GO SELECT * FROM sysfiles WHERE name LIKE '%LOG%' GO   Second, set the database recovery model to 'sim First,revIEw the transaction log size prior to the shrinking process.

USE [YourDatabasenameHere]
GO
SELECT *
FROM sysfiles
WHERE name liKE '%LOG%'
GO
 

Second,set the database recovery model to 'simple'. 

USE [YourDatabasenameHere]
GO
ALTER DATABASE [YourDatabasenameHere] SET RECOVERY SIMPLE
GO
 

Third,issue a checkpoint against the database to write the records from the transaction log to the database.

USE [YourDatabasenameHere]
GO
CHECKPOINT
GO
 

Fourth,truncate the transaction log.

USE [YourDatabasenameHere]
GO
BACKUP LOG [YourDatabasenameHere] WITH NO_LOG
GO
 

Fifth,record the logical file name for the transaction log to use in the next step.

USE [YourDatabasenameHere]
GO
SELECT name
FROM sysfiles
WHERE name liKE '%LOG%'
GO 

Sixth,to free the unused space in your transaction log and return the space back to the operating system,shrink the transaction log file.

USE [YourDatabasenameHere]
GO
DBCC SHRINKfile ([filenameFromPrevIoUsstep],[NeededfileSize])
GO
 

Seven,revIEw the database transaction log size to verify it has been reduced.

USE [YourDatabasenameHere]
GO
SELECT *
FROM sysfiles
WHERE name liKE '%LOG%'
GO

Next Steps

RevIEw your key sql Server databases to determine if the transaction log growth is out of control. RevIEw this code and modify it for one of your databases. Once the scripts are modifIEd,test the scripts in a test environment to ensure they meet your needs. Schedule time to shrink your databases and communicate the configuration changes. Continue to monitor the database sizes and the available disk space on your servers. 总结

以上是内存溢出为你收集整理的MS Sqlserver 2000 transaction log shrink step全部内容,希望文章能够帮你解决MS Sqlserver 2000 transaction log shrink step所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/sjk/1174080.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存