- 1, changing the original fault finding .mdf file name for fault finding 1.mdf
--2, fault finding new database of the same name, physical name .mdf troubleshooting, fault finding .ldf
--3, stopped the MSSQLSERVER service, 2 file deletion created in step 2, and renamed fault finding fault 1.mdf query .mdf
--4, start the MSSQLSERVER service, fault query the database at this time is certainly 'doubt' is
--5, set the database to allow direct operating system table; you can choose the right server, changes in the [server behavior] [server settings] tab inside.
Master use
Go
the sp_configure 'Updates the allow',. 1
Go
the reconfigure with the override
Go
----------------------------------- -------------------------------------------------- --------
--6, set the fault mode query the database for the emergency repair
update sysdatabases set status = -32768 where dbid = db_id ( ' fault-finding')
Go
--7, rebuilding failed to query the database log file, if it can not stop the service lock and open the service again, and then retry the QA
dbcc rebuild_log ( 'fault finding', 'I: \ Microsoft SQL Server \ MSSQL \ Data \ Troubleshooting .ldf ')
Go
--8, consistency check database
dbcc checkdb (' fault-finding ')
Go
- 9, set up the database troubleshooting mode to normal
sp_dboption' fault finding ',' dbo use only ',' false '
Go
-------------------------------------------------- --------------------------------------------
--10 cancel database direct operating system table
sp_configure 'the allow the Updates', 0
Go
reconfigure with the override
Go
--2, fault finding new database of the same name, physical name .mdf troubleshooting, fault finding .ldf
--3, stopped the MSSQLSERVER service, 2 file deletion created in step 2, and renamed fault finding fault 1.mdf query .mdf
--4, start the MSSQLSERVER service, fault query the database at this time is certainly 'doubt' is
--5, set the database to allow direct operating system table; you can choose the right server, changes in the [server behavior] [server settings] tab inside.
Master use
Go
the sp_configure 'Updates the allow',. 1
Go
the reconfigure with the override
Go
----------------------------------- -------------------------------------------------- --------
--6, set the fault mode query the database for the emergency repair
update sysdatabases set status = -32768 where dbid = db_id ( ' fault-finding')
Go
--7, rebuilding failed to query the database log file, if it can not stop the service lock and open the service again, and then retry the QA
dbcc rebuild_log ( 'fault finding', 'I: \ Microsoft SQL Server \ MSSQL \ Data \ Troubleshooting .ldf ')
Go
--8, consistency check database
dbcc checkdb (' fault-finding ')
Go
- 9, set up the database troubleshooting mode to normal
sp_dboption' fault finding ',' dbo use only ',' false '
Go
-------------------------------------------------- --------------------------------------------
--10 cancel database direct operating system table
sp_configure 'the allow the Updates', 0
Go
reconfigure with the override
Go
Reproduced in: https: //www.cnblogs.com/yitian/archive/2007/10/11/921416.html