SQL Server还原选项:

--创建备份设备
sp_addumpdevice 'disk',jasonbak ,'C:\jason.bak'
--备份
backup database northwind to jasonbak 
with noinit--(附加,不加参数时默认)
with init--(重写备份设备的内容)
with format--(重新格式化备份设备,使用)

--还原
restore filelistonly from jasonbak
--查看文件列表(只能看到第一个备份内容)
restore headeronly from a]
--查看设备内内容
restore verifyonly from a
--校验

 

restore database pubs from jasonbak 
restore database northwind from jasonbak with file=2

restore database northwind from jasonbak with norecovery
restore log northwind from jasonbak with file=2 


--Changed to Simple修改恢复模型后一定要完全备份数据库
backup database northwind to jasonbak with format
--change back to Full
create table jason2 (Idd int)
backup log northwind to jasonbak 
restore verifyonly from jasonbak
drop database northwind

restore database northwind from jasonbak with norecovery
restore log northwind from jasonbak with file=2

--Full Backup nw
--
Create Table1  ,write down the time
--
Create Table2  ,write down the time
--
Backup Log 
--
Drop nw
--
Recover Nw
--
Recover Table1, No table2

backup database northwind to jasonbak with format
Create table table1 (IDD int)    --21.13.26
Create table table2 (IDD int)    --21.13.35
backup log northwind to jasonbak
restore northwind from jasonbak with stopat=""
Posted on 2004-11-02 20:38  Jason's WMI SQL Related Blog  阅读(2441)  评论(1编辑  收藏  举报