用t-sql语句完整备份数据库的例子
本文导语: 完整数据备份sql语句: 代码示例: USE master; --Create tail-log backup. BACKUP LOG AdventureWorks TO DISK = 'D:sql_backupstestdb.bak' WITH NORECOVERY; GO --Restore the full database backup (from backup set 1). RESTORE DATABASE AdventureWorks FROM DISK = 'D:sql_backupstestdb....
完整数据备份sql语句:
USE master;
--Create tail-log backup.
BACKUP LOG AdventureWorks
TO DISK = 'D:sql_backupstestdb.bak' WITH NORECOVERY;
GO
--Restore the full database backup (from backup set 1).
RESTORE DATABASE AdventureWorks
FROM DISK = 'D:sql_backupstestdb.bak'
WITH FILE=1,NORECOVERY;
--Restore the regular log backup (from backup set 2).
RESTORE LOG AdventureWorks
FROM DISK = 'D:sql_backupstestdb.bak'
WITH FILE=2,NORECOVERY;
--Restore the tail-log backup (from backup set 3).
RESTORE LOG AdventureWorks
FROM DISK = 'D:sql_backupstestdb.bak'
WITH FILE=3,NORECOVERY;
GO
--recover the database(finally)
RESTORE DATABASE AdventureWorks WITH RECOVERY;
GO