1-Restore Database Full-Diff-Tran together 2-KEEP_CDC
Definition Description
-- Fullbakcup+diffretial+transactional restore Önce backup içerğine bak USE [master] RESTORE FILELISTONLY FROM DISK = N'F:\share\GURMEN_backup_2018_05_01_001000_9876258.bak';
GO Ş ayet CDC varsa : EN SONA KEEP_CDC EKLENİR.CDC Eklemek istemiyorsan KEEP_CDC silebilirsin USE [master] RESTORE DATABASE [GURMEN] FROM DISK = N'C:\MSSQL\BACKUP\GURMEN_backup_2017_08_01_001001_9678262.bak' WITH FILE = 1, MOVE N'GURMEN_Data' TO N'C:\MSSQL\USERDATA\GURMEN_Data.mdf', MOVE N'NonClusteredIdxFile' TO N'C:\MSSQL\USERDATA\NonClusteredIdxFile_data.ndf', MOVE N'CDCTBLOGFILE' TO N'C:\MSSQL\USERDATA\CDCTBLOGFILE.ndf', MOVE N'NEBIMLOGTBLFILE' TO N'C:\MSSQL\USERDATA\NEBIMLOGTBLFILE.ndf', MOVE N'GURMEN_Log' TO N'C:\MSSQL\USERDATALOG\GURMEN_Log.ldf', NORECOVERY, NOUNLOAD, STATS = 10 RESTORE DATABASE [GURMEN] FROM DISK = N'C:\MSSQL\BACKUP\GURMEN_backup_2017_08_08_020202_1742575.diff' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10 RESTORE LOG [GURMEN] FROM DISK = N'C:\MSSQL\BACKUP\GURMEN_backup_2017_08_08_021001_1159583.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10 RESTORE LOG [GURMEN] FROM DISK = N'C:\MSSQL\BACKUP\GURMEN_backup_2017_08_08_021501_2628387.trn' WITH FILE = 1, NOUNLOAD, STATS = 10, KEEP_CDC ============================================================================================== ÇOK ÖNEMLİ: AŞAĞIDAKİ SCRİPT İLE .TRN LOG DOSYALARININ İSİMLERİNİ KLASÖR İÇİNDEN ÇEKEBİLİRSİN ============================================================================================== DECLARE @files TABLE ( ID INT IDENTITY, [FileName] VARCHAR ( 100 )) INSERT INTO @files EXECUTE xp_cmdshell 'dir F:\share /b' SELECT 'RESTORE LOG [GURMEN_YEDEK] FROM DISK = N''' + [FileName] + ''' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10' FROM @files WHERE [FileName] NOT LIKE '%.bak' AND [FileName] NOT LIKE '%.diff' ------restore durumundaki databse'i online cek RESTORE DATABASE [CHECKDB] WITH RECOVERY