zjshidr

导航

SQL数据库质疑修复

USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE MyDB SET EMERGENCY
GO
sp_dboption 'MyDB', 'single user', 'true'
GO
DBCC CHECKDB('MyDB','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE MyDB SET ONLINE
GO
sp_configure 'allow updates', 0 reconfigure with override
GO
sp_dboption 'MyDB', 'single user', 'false'
GO

高版本

USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE utu SET EMERGENCY
GO
--sp_dboption 'utu', 'single user', 'true'
ALTER DATABASE [utu] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
DBCC CHECKDB('utu','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE utu SET ONLINE
GO
sp_configure 'allow updates', 0 reconfigure with override
GO
--sp_dboption 'utu', 'single user', 'false'
ALTER DATABASE [utu] SET multi_user WITH ROLLBACK IMMEDIATE
GO

posted on 2024-12-16 11:13  涵若曦  阅读(2)  评论(0编辑  收藏  举报