DBCC DBREINDEX

  • DBCC CHECKDB;

    GO

    Result:

    DBCC results for 'AgentsStateChanges'.

    There are 2422697 rows in 46484 pages for object 'AgentsStateChanges'.

    CHECKDB found 0 allocation errors and 92 consistency errors in table 'AgentsStateChanges' (object ID 2025058250).

    Server: Msg 8934, Level 16, State 3, Line 1

    Table error: Object ID 53575229, index ID 1. The high key value on page (1:193625) (level 0) is not less than the low key value in the parent (0:1), slot 0 of the next page (1:269532).

    Server: Msg 8935, Level 16, State 1, Line 1

    Table error: Object ID 53575229, index ID 1. The previous link (1:269531) on page (1:269532) does not match the previous page (1:193625) that the parent (1:272396), slot 252 expects for this page.

    Server: Msg 8936, Level 16, State 1, Line 1

    Table error: Object ID 53575229, index ID 1. B-tree chain linkage mismatch. (1:193625)->next = (1:269532), but (1:269532)->Prev = (1:269531).

    Server: Msg 2511, Level 16, State 1, Line 1

    Table error: Object ID 53575229, Index ID 2. Keys out of order on page (1:266856), slots 14 and 15.

    Server: Msg 2511, Level 16, State 1, Line 1

    Table error: Object ID 53575229, Index ID 2. Keys out of order on page (1:266856), slots 154 and 155.

    Server: Msg 2511, Level 16, State 1, Line 1

    Table error: Object ID 53575229, Index ID 2. Keys out of order on page (1:266869), slots 49 and 50.

    DBCC DBREINDEX ('Vestel.dbo.AgentsStateChanges', PK_LLAgentFlowSummary, 0);

    GO

    Result:

    Server: Msg 1505, Level 16, State 1, Line 1

    CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is 'type 24, len 16'.

    The statement has been terminated.

    PLEASE HELP!;

    GO

  • unique index means unique values. you have to find the duplicate values and delete them or create a non-unique index

  • Hello,

    I ran the query below and I get the error message.

    select Msg_ID, count(Msg_ID)

    from AgentsStateChanges

    group by Msg_ID

    having count(Msg_ID)>1

    Server: Msg 409, Level 16, State 2, Line 1

    The count aggregate operation cannot take a uniqueidentifier data type as an argument.

    Server: Msg 409, Level 16, State 1, Line 1

    The count aggregate operation cannot take a uniqueidentifier data type as an argument.

  • Try this

    select cast(Msg_ID as varchar(36)), count(*)

    from AgentsStateChanges

    group by cast(Msg_ID as varchar(36))

    having count(*)>1

    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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (22/09/2007)


    Try this

    select cast(Msg_ID as varchar(36)), count(*)

    from AgentsStateChanges

    group by cast(Msg_ID as varchar(36))

    having count(*)>1

    Interesting! I tried that and I found 79 pieces duplicate values.

    Then. I'm trying some values from duplicate values and I get 0 row message

    select * FROM AgentsStateChanges where Msg_ID=

    '100CEB2E-6B69-0058-0001-000000000001'

    result:

     (0 row(s) affected)

    I dont understand anything.

     

    Thanks,

    Melih 

Viewing 5 posts - 1 through 5 (of 5 total)

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