6

The MSDN's article about the command "DBCC CHECKDB" explains three ways to perform a database repair in the syntax section:

- REPAIR_ALLOW_DATA_LOSS
- REPAIR_FAST
- REPAIR_REBUILD

But I found the following statement when I was looking for how to repair a suspect database and I can't understand which one of the three modes is it:

DBCC CHECKDB (databaseName, repair)

I executed the statement and it works fine. I'm confused because there isn't any reference to the "repair" parameter alone without finish the word with "_allow_data_loss", "_fast" or "_rebuild".

Thanks in advance,

Glorin Oakenfoot
  • 2,455
  • 1
  • 17
  • 19
agdiaz
  • 63
  • 3
  • Might be worth putting this on http://dba.stackexchange.com/ too! – RoKa Dec 16 '15 at 14:25
  • 1
    A good read http://www.sqlskills.com/blogs/paul/misconceptions-around-database-repair/ – Mike Dec 16 '15 at 14:25
  • 1
    I haven't been a DBA in a long time, but this may be a vestige of the old Sybase code. I know that in some instances it would take shortened versions of the command. If you run this, what shows up in the log? I'm pretty sure dbcc still shows up in the error log, and it may show which command executed there, or based on the output of the dbcc, you can figure out which version of the repair ran. – Mike Dec 16 '15 at 14:56
  • 1
    You may want to contact Paul Randal via twitter or the sqlskills website. He would definitely know. – SQLChao Dec 16 '15 at 15:11
  • @Mike I executed the following statements on a suspect database (I suspect it using these [instructions](http://www.sqlskills.com/blogs/paul/creating-detaching-re-attaching-and-fixing-a-suspect-database/#comment-1021356): 1)ALTER DATABASE databaseName SET EMERGENCY; 2)ALTER DATABASE databaseName SET SINGLE_USER; 3)DBCC CHECKDB (databaseName, repair) WITH NO_INFOMSGS, ALL_ERRORMSGS 4)ALTER DATABASE databaseName SET MULTI_USER; 5)ALTER DATABASE databaseName SET ONLINE; And I can read in the output of the third statement information about the process but nothing related on the level used. – agdiaz Dec 16 '15 at 15:32
  • @JChao thanks, I wrote the question in the Paul Randal's blog. I hope he answer quickly. – agdiaz Dec 16 '15 at 15:33
  • @agdiaz Please remember to add an answer here when you receive one. I still think you should put this on http://dba.stackexchange.com too! – RoKa Dec 17 '15 at 10:41
  • It's true, I'm going to post it in dba.stackexchange.com @RoKa. Thanks – agdiaz Dec 17 '15 at 15:07

1 Answers1

2

Specifying only "repair" as the second parameter in DBCC CHECKDB will be the same as "repair_allow_data_loss". I just ran this on a local instance, and the SQL logs confirm this.

Jeffrey Van Laethem
  • 2,601
  • 1
  • 20
  • 30