********* 로그정리
backup log DATABASE_NAME with truncate_only
dbcc shrinkdatabase(DATABASE_NAME, truncateonly)
dbcc shrinkdatabase(DATABASE_NAME, 500)
ALTER INDEX ALL ON 테이블명 REBUILD WITH (PAD_INDEX = ON, FILLFACTOR = 90)
//파일삭제
forfiles /P E:\DB_BACKUP\ /D -14 /M *.bak /C "cmd /C echo copy: @file && del @file"
********* 2008 로그삭제
USE TestDB;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE TestDB
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (TestDB_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE TestDB
SET RECOVERY FULL;
GO
********* 2008이상 cmd명령어 허용
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
**** 계속 복원중인 DB 재복원
RESTORE DATABASE F40_SAMOH WITH RECOVERY