Database can go into suspect mode for a couple of reasons, including, corruption in data files, indexes, logs, bad storage, less space available on storage for the database files to grow.
Following two ways may resolve your problem.
Approach 1:-
Step 1 :This will make system table editable.
Use master
Go
sp_configure 'allow updates', 1
Reconfigure with override
GO
Following two ways may resolve your problem.
Approach 1:-
Step 1 :This will make system table editable.
Use master
Go
sp_configure 'allow updates', 1
Reconfigure with override
GO
Step 2 : Put database into emergency mode
update master..sysdatabases set status = 32768
where name = 'your db name'
GO
Step 3: Checks the logical and physical integrity of all the objects in the specified database
DBCC CHECKDB('DB_NAME')
If DBCC shows any error message, fix the error. In case of corrupted index , try to rebuild or re-create it
Step 4: If nothing works ,run below command. This command might loss some data.
DBCC CHECKDB('DB',REPAIR_ALLOW_DATA_LOSS)
Step 5: Bring database back into normal mode.
update master..sysdatabases set status = 0
where name = 'your db name'
Go
Step 6: This will make system tables un-editable.
Sp_configure 'allow updates', 0
Reconfigure with override
Go
Approach 2:-
Use below step if you are ready to lose transaction log data. This step replace ldf file with new ldf file.
Step 1 :This will make system table editable
Use master
Go
sp_configure 'allow updates', 1
Reconfigure with override
Go
Step 2: Put database into emergency mode
Update sysdatabases set status= 32768
where name = 'your db name'
Go
Step 3:
Refresh database , the database will be in Emergency mode. If not restart MSSQLSERVER services
Step 4: Rebuild Log. From QA execute script
DBCC REBUILD_LOG ('db name', 'db path log name{eg:E:\LOG\SQL_Log.LDF}')
After executing this command you will get below output.
Warning: The log for database 'DB_Name' has been rebuilt. Transactional consistency has been lost. DBCC CHECKDB should be run to validate physical consistency. Database options will have to be reset, and extra log files may need to be deleted.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Step 5 :Bring database back into normal mode.
update master..sysdatabases set status = 0
where name = 'db'
Go
Step 6: This will make system tables un-editable.
Sp_configure 'allow updates', 0
Reconfigure with override
Go
Step 3: Checks the logical and physical integrity of all the objects in the specified database
DBCC CHECKDB('DB_NAME')
If DBCC shows any error message, fix the error. In case of corrupted index , try to rebuild or re-create it
Step 4: If nothing works ,run below command. This command might loss some data.
DBCC CHECKDB('DB',REPAIR_ALLOW_DATA_LOSS)
Step 5: Bring database back into normal mode.
update master..sysdatabases set status = 0
where name = 'your db name'
Go
Step 6: This will make system tables un-editable.
Sp_configure 'allow updates', 0
Reconfigure with override
Go
Approach 2:-
Use below step if you are ready to lose transaction log data. This step replace ldf file with new ldf file.
Step 1 :This will make system table editable
Use master
Go
sp_configure 'allow updates', 1
Reconfigure with override
Go
Step 2: Put database into emergency mode
Update sysdatabases set status= 32768
where name = 'your db name'
Go
Step 3:
Refresh database , the database will be in Emergency mode. If not restart MSSQLSERVER services
Step 4: Rebuild Log. From QA execute script
DBCC REBUILD_LOG ('db name', 'db path log name{eg:E:\LOG\SQL_Log.LDF}')
After executing this command you will get below output.
Warning: The log for database 'DB_Name' has been rebuilt. Transactional consistency has been lost. DBCC CHECKDB should be run to validate physical consistency. Database options will have to be reset, and extra log files may need to be deleted.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Step 5 :Bring database back into normal mode.
update master..sysdatabases set status = 0
where name = 'db'
Go
Step 6: This will make system tables un-editable.
Sp_configure 'allow updates', 0
Reconfigure with override
Go
No comments:
Post a Comment