-- TimeXkopia++
--\\192.168.200.45\live-sql\acc3-sqlbackup
RESTORE DATABASE Timex8_I_Test FROM DISK='Z:\jk\Timex8_I201701100100\Timex8_I201701100100.bak'
WITH
MOVE 'Timex8_I' TO 'x:\jk\Timex8_I.mdf'
, MOVE 'Timex8_I_log' TO 'z:\jk\Timex8_I_log.ldf'
RESTORE DATABASE Timex8_I_Test FROM DISK='x:\jk\backup20170305'
WITH
MOVE 'Timex8_I' TO 'x:\jk\Timex8_I.mdf'
, MOVE 'Timex8_I_log' TO 'z:\jk\Timex8_I_log.ldf'
--komplecik
BACKUP DATABASE Timex8_I
TO DISK = 'z:\jk\Timex8TempBackup'
go
RESTORE DATABASE Timex8_I_Test FROM DISK='z:\jk\Timex8TempBackup'
WITH
MOVE 'Timex8_I' TO 'x:\jk\Timex8_I.mdf'
, MOVE 'Timex8_I_log' TO 'z:\jk\Timex8_I_log.ldf'
go
wersja z nowym plikiem:
RESTORE DATABASE Timex8_I_Test2 FROM DISK='f:\bckp\Timex8_I201903160531.bak'
WITH
MOVE 'Timex8_I' TO 'f:\jk\Timex8_I.mdf'
, MOVE 'Timex8_I_2' TO 'f:\jk\Timex8_I_2.ndf'
, MOVE 'Timex8_I_log' TO 'f:\jk\Timex8_I_log.ldf'
,NORECOVERY
go
RESTORE DATABASE Timex8_I_Test2 FROM DISK='f:\bckp\Timex8_I201903200400diff.bak'
WITH
MOVE 'Timex8_I' TO 'f:\jk\Timex8_I.mdf'
, MOVE 'Timex8_I_2' TO 'f:\jk\Timex8_I_2.ndf'
, MOVE 'Timex8_I_log' TO 'f:\jk\Timex8_I_log.ldf'
, RECOVERY
go
RESTORE DATABASE Timex8_I_Test FROM DISK='f:\bckp\Timex8TempBackup'
WITH
MOVE 'Timex8_I' TO 'f:\jk2\Timex8_I.mdf'
, MOVE 'Timex8_I_2' TO 'f:\jk2\Timex8_I_2.ndf'
, MOVE 'Timex8_I_log' TO 'f:\jk2\Timex8_I_log.ldf'
go
ALTER DATABASE [Timex8_I_Test2] SET EMERGENCY;
GO
ALTER DATABASE [Timex8_I_Test2] set single_user
GO
DBCC CHECKDB ([Timex8_I_Test2], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO
ALTER DATABASE [Timex8_I_Test2] set multi_user
GO