SQL Server 日誌已滿 清理日誌檔案指令碼

2021-10-10 21:30:00 字數 563 閱讀 3353

sql server 日誌已滿 清理日誌檔案指令碼

use [master]

goalter database ypbxch set recovery ****** with no_wait   ----ypbxch為需要清除日誌的資料庫名稱

goalter database ypbxch set recovery ******   --簡單模式   ----ypbxch為需要清除日誌的資料庫名稱

gouse ypbxch     ----blog為需要清除日誌的資料庫名稱

godbcc shrinkfile (n'ypbxch_log' , 11, truncateonly)    ----ypbxch_log為需要清除日誌的資料庫名日誌名稱

gouse [master]

goalter database ypbxch set recovery full with no_wait   ----ypbxch為需要清除日誌的資料庫名稱

goalter database ypbxch set recovery full  --還原為完全模式   ----ypbxch為需要清除日誌的資料庫名稱

sql server日誌已滿報錯

情況1 無論是alter,還是 insert 資料,都報這類錯誤。情況2 實際上日誌檔案很小,而且增長也未限制,磁碟碟符也有空間 1 檢視磁碟是否有空間 2 檢視事務日誌增長是否設定了最大大小限制 3 事務日誌檔案本身太小,而增長率又太小,導致一次增長的空間還不夠一次日誌記錄所需的空間。那麼本文遇到...

清理SQL Server日誌

use master goalter database 目標資料庫 set recovery with no wait goalter database 目標資料庫 set recovery 簡單模式 gouse 目標資料庫 godbcc shrinkfile n 目標日誌檔案邏輯名 2000,tr...

SQL Server日誌過大,清理日誌

直接執行下面的 use master go alter database 資料庫 set recovery with no wait goalter database 資料庫 set recovery 簡單模式 gouse 資料庫 godbcc shrinkfile n 邏輯名 2000,trunc...