SQL Serverのログファイルが大きくなる。特に、洗い替えの処理等を頻繁に行うような場合。
- 原因と対策
Recovery modelの設定が原因。 Fullになっている。
それをSimpleに変更する。
(注)洗い替え処理なので、ロールバックが重要ではないので。。。
それをSimpleに変更する。
(注)洗い替え処理なので、ロールバックが重要ではないので。。。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--参考 | |
--https://technet.microsoft.com/en-us/library/ms189493(v=sql.105).aspx | |
-- | |
USE <database-name>; | |
GO | |
-- DBの設定を、SIMPLEモードにする | |
ALTER DATABASE <database-name> SET RECOVERY SIMPLE; | |
GO | |
-- Shrink the truncated log file to 1 MB. | |
DBCC SHRINKFILE (<log-file-name>, 1); | |
GO | |
-- 設定をもどす。洗い替えならSIMPLEのままでよい | |
ALTER DATABASE <database-name> SET RECOVERY FULL; | |
GO |
0 件のコメント:
コメントを投稿