May 1, 2002 at 3:38 pm
Under DOS, "chkdsk" can attempt to repair corrupt files. Under Sql DBCC will check database\tables for corruption but has no option (that I know of) to repair them.
What Sql facilities are available to repair corrupt databases/tables?
Bill
May 1, 2002 at 3:47 pm
DBCC has several options. The one that checks a database, DBCC CHECKDB, has options to perform various levels of repair. Books Online has a description of what each option can do and the risk to data.
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
May 2, 2002 at 9:27 am
Use DBCC CheckDB
DBCC CHECKDB (<dbname>, NOINDEX, <repair option>) WITH ALL_ERRORMSGS
Quote from BOL:
_____________________________________________
Value Description
REPAIR_ALLOW_DATA_LOSS Performs all repairs done by REPAIR_REBUILD and includes allocation and deallocation of rows and pages for correcting allocation errors, structural row or page errors, and deletion of corrupted text objects. These repairs can result in some data loss. The repair may be done under a user transaction to allow the user to roll back the changes made. If repairs are rolled back, the database will still contain errors and should be restored from a backup. If a repair for an error has been skipped due to the provided repair level, any repairs that depend on the repair are also skipped. After repairs are completed, back up the database.
REPAIR_FAST Performs minor, nontime-consuming repair actions such as repairing extra keys in nonclustered indexes. These repairs can be done quickly and without risk of data loss.
REPAIR_REBUILD Performs all repairs done by REPAIR_FAST and includes time-consuming repairs such as rebuilding indexes. These repairs can be done without risk of data loss.
_____________________________________________
Give me a fish, you feed me for a day! Teach me to fish, you feed me for a life time.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply