December 9, 2009 at 5:22 am
Does the following statement also repair found errors and/or minor issues or does this statement repair nothing but only show information on existing errors?
DBCC CHECKDB ('databasename') with physical_only
December 9, 2009 at 6:01 am
CheckDB does not repair unless a repair level is specified.
Please note, repair should never be the first thing considered for a corruption problem. In many cases it's the last resort. If you have corruption, post the errors here (from a full checkDB not one with physical only) and someone will advise you on what to do.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 9, 2009 at 6:02 am
This will not repair anything, it simply scans the database for physical structure errors and is a lot quicker to run that a full scan does a lot more logical checks.
To repair you need to use a REPAIR option with the appropriate type of repair REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD
You need to aware of the potential data loss of repairing, restoring from a good-backup is preferable.
December 9, 2009 at 6:06 am
steveb. (12/9/2009)
This will not repair anything, it simply scans the database for physical structure errors and is a lot quicker to run that a full scan does a lot more logical checks.
However it will only detect physical corruptions. There are a lot of potential corruptions that a physical only check will not pick up.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 9, 2009 at 7:59 am
On 2000 it will actually fix up incorrect PFS page free space bits silently, even if you don't say to do repairs. There was a bug in the algorithm that maintains them (in the main Storage Engine, not in CHECKDB) so it was deemed easier to just repair them than fix the bug - it was fixed in 2005.
Apart from that, it won't do any repairs.
Paul Randal
CEO, SQLskills.com: Check out SQLskills online training!
Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply