DBCC checkdb report error : marked allocated in the GAM, but no SGAM or IAM has allocated it.

Shi, Hui 1 Reputation point
2021-01-15T02:06:28.387+00:00

hi folks:
DBCC check reported error: marked allocated in the GAM, but no SGAM or IAM has allocated it.
and I've used dbcc check with repair_allow_data_loss . It did fix all allocation errors.

Question: Did I still lose any data ?

Thanks

Hui

SQL Server Other
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. Shi, Hui 1 Reputation point
    2021-01-15T02:15:44.687+00:00

    part of dbcc result:
    Extent (1:7643160) in database ID 5 is marked allocated in the GAM, but no SGAM or IAM has allocated it.
    The error has been repaired.
    Msg 8905, Level 16, State 1, Line 6
    Extent (1:7651248) in database ID 5 is marked allocated in the GAM, but no SGAM or IAM has allocated it.
    The error has been repaired.
    Msg 8905, Level 16, State 1, Line 6
    Extent (1:7659336) in database ID 5 is marked allocated in the GAM, but no SGAM or IAM has allocated it.
    The error has been repaired.
    Msg 8905, Level 16, State 1, Line 6
    Extent (1:7667424) in database ID 5 is marked allocated in the GAM, but no SGAM or IAM has allocated it.
    The error has been repaired.
    CHECKDB found 127 allocation errors and 0 consistency errors not associated with any single object.
    CHECKDB fixed 127 allocation errors and 0 consistency errors not associated with any single object.
    CHECKDB found 127 allocation errors and 0 consistency errors in database 'DWH_LANDING'.
    CHECKDB fixed 127 allocation errors and 0 consistency errors in database 'DWH_LANDING'.

    0 comments No comments

  2. Cris Zhan-MSFT 6,661 Reputation points
    2021-01-15T03:33:25.047+00:00

    Hi @Shi, Hui ,

    The REPAIR_ALLOW_DATA_LOSS option is a supported feature but it may not always be the best option for bringing a database to a physically consistent state. If successful, the REPAIR_ALLOW_DATA_LOSS option may result in some data loss. In fact, it may result in more data lost than if a user were to restore the database from the last known good backup. Microsoft always recommends a user restore from the last known good backup as the primary method to recover from errors reported by DBCC CHECKDB. The REPAIR_ALLOW_DATA_LOSS option is not an alternative for restoring from a known good backup. It is an emergency "last resort" option recommended for use only if restoring from a backup is not possible.

    More details please refer to the ''warning'' in following document:
    https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkdb-transact-sql?view=sql-server-ver15#arguments

    0 comments No comments

  3. Shi, Hui 1 Reputation point
    2021-01-15T03:42:21.307+00:00

    thanks Criszhan. This is the last resort we have at this moment. I've run this option and it says
    it has corrected all errors. Question: can I say there is no data loss ???

    Cheers


  4. Shashank Singh 6,251 Reputation points
    2021-01-15T07:19:49.633+00:00

    Question: Did I still lose any data ?

    There is no GUARNTEED way to tell that, you would have to get your hands dirty and find it out by comparing. This is the biggest problem with checkdb with repair_allow_data_loss, if it finds a way to repair data it may go on deleting data without any restriction to get database in online consistent state. Ideally, since you are worried about data loss you should have restored from clean backup or would have tried backing the database with continue_after_errror clause and then restoring with same clause and running checkdb repair_allow_data_loss on this copy than on original database. (Although backing and restoring with continue_after_error clause does not guarantee a backup and restore of corrupt DB but there is no harm in trying.)

    The other way is to test is, if you have recent backup restore it with different name and do data comparison.

    0 comments No comments

  5. Shi, Hui 1 Reputation point
    2021-01-15T16:16:25.1+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.