|
发表于 2010-2-27 13:44:43
|
显示全部楼层
1.设置数据库为紧急模式
Use Master
GO
sp_configure 'allow updates', 1
reconfigure with override
GO
UPDATE sysdatabases SET status = 32768 where name = 'DB_SUSPECT'
GO
2.停掉SQL Server服务:
NET STOP MSSQLSERVER
3.把原始数据库的数据文件DBNAME_DAT.MDF,DBNAME_LOG.LDF移走:
4.启动SQL Server服务:
NET START MSSQLSERVER
5.重新建立一个同名的数据库DB_SUSPECT;
USE master
GO
CREATE DATABASE DB_SUSPECT
ON
( NAME = DBNAME_DAT,
FILENAME = 'C:',
SIZE = 10,
FILEGROWTH = 5 )
LOG ON
( NAME = 'DBNAME_LOG',
FILENAME = 'g:',
SIZE = 5MB,
FILEGROWTH = 5MB )
GO
6.设置数据库运行在单用户的模式:
USE MASTER
GO
ALTER DATABASE DB_SUSPECT SET SINGLE_USER
GO
7.停掉SQL服务:
NET STOP MSSQLSERVER
8.把原来的数据文件再覆盖回来:
9.启动SQL Server服务:
NET START MSSQLSERVER
10.重新设置SQLSERVER的状态:
USE MASTER
GO
EXEC sp_resetstatus "DB_SUSPECT"
11.数据库完整性检测:
DBCC CHECKDB('DB_SUSPECT')
12.恢复数据库为多用户模式:
USE MASTER
GO
ALTER DATABASE DB_SUSPECT SET MULTI_USER
GO
13.恢复SQLSERVER原始的配置:
USE MATER
GO
UPDATE sysdatabases SET status = 4194320 where name = 'DB_SUSPECT'
GO
14.配置SQLSERVER不允许更新系统表:
USE MASTER
GO
sp_configure 'allow updates', 0
reconfigure with override
GO
15.重新启动MSSQLSERVER服务:
最好重新启动操作系统
16.备份数据库:
可以通过SQLSERVER企业管理器或T-SQL.需要备份MASTER和DB_SUSPECT |
|