4. Put database into emergency mode SQL Server 2005+2000
USE master
GO
sp_configure 'allow updates', 1
RECONFIGURE WITH OVERRIDE
GO
UPDATE sysdatabases SET status= 32768 WHERE name = 'mydatabase'
5. restart MSSQL
5a. (optional) Since you're data is now accessible via Query Analyzer, you could just export your important data into a new database.
-- EMERGENCYcreate modethe repairnew database
ALTERCREATE DATABASE mydatabasemynewdatabase
-- SETimport EMERGENCY;data from the old database into the new
GOSELECT * INTO mynedatabase..sometable FROM mydatabase..sometable.
orThis won't help though with your triggers and metadata, but at least you'd have your data accessible in case the repair fails
46. PutRepair the database into emergency mode SQL Server 2000
This is the method I've used for repairing the database once its in emergency mode.
USE mastermydatabase
GO
sp_configure
-- 'allowput updates'database into single user mode
sp_dboption 'mydatabase', 1'single_user', 'true'
RECONFIGUREGO WITH
-- OVERRIDErepair the database, please be sure you have an extra copy somewhere of
-- your two db files
DBCC CHECKDB ('mydatabase' repair_allow_data_loss)
GO
-- turn off emergency mode
USE master
sp_configure 'allow updates', 1
UPDATE sysdatabases SET status= 327680 WHERE name = 'mydatabase'
GO
restart-- MSSQLcheck space allocation consistency
DBCC CHECKALLOC ('mydatabase')
-- verify db integrity
DBCC CHECKDB ('mydatabase')
-- take the database out of single user mode
sp_dboption 'mydatabase', 'single_user', 'false'
GO
-- disallow updates to the system tables
USE master
GO
sp_configure 'allow updates', 0
GO
If that command works as expected, you should have read-only access to the database
I looked over the systools website and they have a utility for fixing corrupt mdf files. I have never used it so I can't say it has worked for me.