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是无论如何不允许直接修改系统表, 但是它提供了相关的命令
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是无论如何不允许直接修改系统表, 但是它提供了相关的命令
1

