EXEC sp_configure 'allow updates',1
RECONFIGURE WITH OVERRIDE
UPDATE sysdatabases SET status=1073741840 WHRE name='DatabaseName'
CHECKPOINT--shutdown with nowait
DBCC traceon(3604)
DBCC rebuild_log ('DatabaseName', 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\DatabaseName_Log.LDF')
USE DatabaseName
sp_dboption 'DatabaseName', 'single_user', 'true'
ALTER DATABASE DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CHECKDB (DatabaseName, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS
USE MASTER
UPDATE sysdatabases SET status = 0 WHERE name = 'DatabaseName'
DBCC CHECKALLOC ('DatabaseName')
DBCC CHECKDB ('DatabaseName')
sp_dboption 'DatabaseName', 'single_user', 'false'
USE MASTER
sp_configure 'allow updates', 0
EXEC sp_resetstatus DatabaseName
0 comments:
Post a Comment