sql server2005恢复只有mdf文件的数据库

[ 2008-10-28 23:06:29 | 作者: progame ]
文字大小: | |
sp_attach_single_file will only work if the file was unattached cleanly.

Steps in the case when this hasn't happened are

1) Move your mdf to safe location.
2) Create new databse of same name, same files, same file location and same file size.
3) Stop SQL server.
4) Swap mdf file of just created DB to your save one.
5) Start SQL. DB will go suspect.
6) ALTER DATABASE <your db> SET EMERGENCY
ALTER DATABASE <your db> SET SINGLE_USER
7) DBCC CHECKDB (<your db>, REPAIR_ALLOW_DATA_LOSS)
8) ALTER DATABASE <your db> SET MULTI_USER
ALTER DATABSE <your db> SET ONLINE

2000下的设置紧急模式的方法不行了, sql 2005是无论如何不允许直接修改系统表, 但是它提供了相关的命令
评论Feed 评论Feed: /feed.asp?q=comment&id=1983

这篇日志没有评论.

发表
表情图标
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
UBB代码
转换链接
表情图标
悄悄话
用户名:   密码:   (非注册用户不需要输入密码) 注册?
验证码(不区分大小写) * 请输入验证码