标签:mdf div pos master sele code where tor font
backup database t-sql
1 BACKUP DATABASE [store] TO DISK = N‘D:\sql_back\store_backup_2019_01_30_102306_4000360.bak‘ WITH NOFORMAT, NOINIT, NAME = N‘store_backup_2019_01_30_102306_4000360‘, SKIP, REWIND, NOUNLOAD, STATS = 10 2 GO 3 declare @backupSetId as int 4 select @backupSetId = position from msdb..backupset where database_name=N‘store‘ and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N‘store‘ ) 5 if @backupSetId is null begin raiserror(N‘验证失败。找不到数据库“store”的备份信息。‘, 16, 1) end 6 RESTORE VERIFYONLY FROM DISK = N‘D:\sql_back\store_backup_2019_01_30_102306_4000360.bak‘ WITH FILE = @backupSetId, NOUNLOAD, NOREWIND
restore database
1 USE [master] 2 BACKUP LOG [store] TO DISK = N‘D:\sql_back\store_LogBackup_2019-01-30_10-44-29.bak‘ WITH NOFORMAT, NOINIT, NAME = N‘store_LogBackup_2019-01-30_10-44-29‘, NOSKIP, NOREWIND, NOUNLOAD, NORECOVERY , STATS = 5 3 RESTORE DATABASE [store] FROM DISK = N‘E:\mssql\store.bak‘ WITH FILE = 1, MOVE N‘store‘ TO N‘D:\install\store.mdf‘, MOVE N‘store_log‘ TO N‘D:\sql_data\store_log.LDF‘, NOUNLOAD, STATS = 5 4 5 GO
标签:mdf div pos master sele code where tor font
原文地址:https://www.cnblogs.com/neoo9901/p/10337012.html