Ein Datenbank-Backup per T-SQL einspielen

 

-- Step 1: Restore the database and change the database path.
RESTORE DATABASE MyDB
   FROM DISK = 'F:\Backups\MyDB_Full_20130812_0023.bak'
   WITH
   MOVE 'MyDB_Data' TO 'F:\MSSQL\Data\MyDB.MDF',
   MOVE 'ftrow_Events' TO 'F:\MSSQL\Data\MyDB.ndf',
   MOVE 'MyDB_Log' TO 'F:\MSSQL\Data\MyDB.LDF',
   NORECOVERY, REPLACE;
GO

-- Step 2: Restore the first transaction log backup.
RESTORE LOG MyDB
   FROM DISK = 'F:\Backups\MyDB_LOG_20130812_0117.trn'
   WITH NORECOVERY;
GO

-- Step 3: Restore other transaction log backups.

-- Step 4: Recover the database.
RESTORE DATABASE MyDB
   WITH RECOVERY;
GO