[20140711] SQL Server page还原

时间:2021-12-08 19:15:05
create DATABASE T --数据库不能是简单模式
go
USE t
GO
CREATE TABLE t(id INT IDENTITY,value CHAR(8000))
GO
INSERT INTO dbo.t
( value )
VALUES (
REPLICATE('a',5000)
)
go 5
BACKUP DATABASE t TO DISK = 'c:\t.bak' WITH INIT
go
--停服务
--用ue打开数据文件 找 aaaa,修改 随便改
DBCC checkdb (t) --验证
go
RESTORE DATABASE t PAGE = '1:90' FROM DISK='c:\t.bak' WITH NORECOVERY
go
BACKUP LOG t TO DISK='c:\t.log' WITH INIT
go
RESTORE LOG t FROM DISK ='c:\t.log'
go
DBCC checkdb (t) --验证