1. "有疑問"的 資料庫的修復:
ALTER DATABASE MyDB SET EMERGENCY;
DBCC checkdb('MyDB');
ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DBCC CheckDB ('MyDB', REPAIR_ALLOW_DATA_LOSS);
ALTER DATABASE MyDB SET MULTI_USER;
其中 "DBCC CheckDB ('MyDB', REPAIR_ALLOW_DATA_LOSS)" 可能要多執行幾次。
2. Restore Differential Backup 用的 SQL:
RESTORE DATABASE [MyDB] FROM DISK = N'D:\BACKUP_DB\MyDB_backup.bak' WITH FILE = 1, NORECOVERY, NOUNLOAD, REPLACE, STATS = 10,
MOVE 'MyDB_Data' TO 'D:\SQLDB2008\MyDB.mdf',
MOVE 'MyDB_Log' TO 'D:\SQLDB2008\MyDB.ldf'
RESTORE DATABASE [MyDB] FROM DISK = N'D:\BACKUP_DIFF\MyDB_backup_2013_02_25_12.bak' WITH FILE = 1, NOUNLOAD, NORECOVERY, STATS = 10
RESTORE DATABASE [MyDB] WITH RECOVERY (正在還原的資料庫也可以用這個指令來恢復成可使用的狀態)