SQL Server 2000 紧急模式修复表

SQL Server 2000 Emergency
发表于 2017-05-07 17:01:00 | 阅读时长 ≈ 1分钟 | 5 年前
⋅ 该文发布于 5 年前,文中内容可能已过时
sql
-- 允许更新系统表
sp_configure 'allow updates', 1
reconfigure with override
-- 设置数据库为紧急修复模式
update sysdatabases set status = 32768 where name = 'x'
-- 单用户模式
ALTER DATABASE x SET SINGLE_USER
-- 重建日志
DBCC rebuild_log('x','D:\x_log.ldf')
-- 修复数据库(允许数据丢失)
DBCC CheckDB(x, REPAIR_ALLOW_DATA_LOSS)
-- 多用户模式
ALTER DATABASE x SET MULTI_USER
-- 重置数据库状态
EXEC sp_resetstatus 'x'
-- 禁止更新系统表
sp_configure 'allow updates',0
reconfigure

Categorized under