Repairing with DBCC CHECKDB

  • Comments posted to this topic are about the item Repairing with DBCC CHECKDB

    Tom

  • Is the "no repair" answer correct?

    http://msdn.microsoft.com/en-us/library/aa258278%28SQL.80%29.aspx

    says:

    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.

  • Ah, I see, looked at the wrong SQL-Server version.

  • This is a good idea for QOD, unfortunately the QOD itself was ruined by a syntax error. The REPAIR_FAST argument cannot be used without a database name or ID.

    http://msdn.microsoft.com/en-us/library/ms176064.aspx

    DBCC CHECKDB (Transact-SQL)

    Syntax


    DBCC CHECKDB

    [

    [ ( database_name | database_id | 0

    [ , NOINDEX

    | , { REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD } ]

    ) ]

    [ WITH

    {

    [ ALL_ERRORMSGS ]

    ...

    }

    ]

    ]

    When you try to run the command "DBCC CHECKDB , REPAIR_FAST", you get the following error: "Msg 102, Level 15, State 1, Line 1. Incorrect syntax near ','."

    The correct syntax is something like "DBCC CHECKDB (AdventureWorks, REPAIR_FAST)" or "DBCC CHECKDB (5, REPAIR_FAST)".

    And the correct answer to the QOD is "returns an error message - you have to specify a database".

  • Got me! Good one, thanks!

    Bex

  • There is also a forum discussion where Paul Randal has some comments.

    Check this LINK.

    M&M

  • This was removed by the editor as SPAM

  • When I execute the command given in the question, I get the following error:

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near ','.

    That's because you need to specify the database name in order to use the Repair_Fast option. So I choose answer 1, which was - to my surprise - incorrect.

    edit: I see vk-kirov has already said the same thing. Whoopsie.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Interesting question and have learnt something today, however I have to agree that the answer is actually wrong, as if you want to add any options to the DBCC command you have to specify the database name - and that in ().

    So i would say that the answer should be the Error due to database name being required.

    Even adding the database name and once you get the command to actually run, you still get the error that "Repair statement not processed. Database needs to be in single user mode."

    If you have that, then you will get the actual answer that has been specified!

    I definitely feel we shoudl get a point for the first error at any rate!

  • I get: " Incorrect syntax near ','

    You have to specify a db name.

    Edit:

    Heheheh - I see several others have latched onto the incorrect correct answer conundrum too. Mgilchrist = bad 😀

    Michael Gilchrist
    Database Specialist
    There are 10 types of people in the world, those who understand binary and those that don't. 😀

  • Apologies to everyone for the silly syntax error.

    I'll ask Steve to correct the question.

    Tom

  • Agree, got the same result as the post above above about syntax error. Is there any quality control on these questions?!?!

  • Ugh, I didn't realize that had been depreciated.

    Thanks for the question Tom!

  • QOD <<FAIL>>

    Converting oxygen into carbon dioxide, since 1955.
  • Since the syntax error due to the comma wasn't one of the choices, I assumed the comma was a typo and answered the question as if it wasn't there. Got it right.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

Viewing 15 posts - 1 through 15 (of 30 total)

You must be logged in to reply to this topic. Login to reply