Dbcc dbindexdefrag

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dougancil
    Contributor
    • Apr 2010
    • 347

    Dbcc dbindexdefrag

    I'm trying to reindex a table in my database using the following query:

    DBCC INDEXDEFRAG (archive, marchive) and keep getting error Msg 2583.

    Can anyone tell me what may be causing this error?

    Thanks

    Doug
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    That command will defrag the index not recreate it. If you only need to recreate the indexes of your table, read this...

    Good Luck!!!

    ~~ CK

    Comment

    • dougancil
      Contributor
      • Apr 2010
      • 347

      #3
      CK,

      Does that put a lock on the index? This table is active and really can't be taken offline.

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Most re-index will... If you have a good server and small data, it should be fast. Otherwise, schedule this during off-peak time...

        Good Luck!!!

        ~~ CK

        Comment

        • dougancil
          Contributor
          • Apr 2010
          • 347

          #5
          CK,

          I understand that, which is why I wanted to just do a dbindexdefrag for now. Any idea as to why I keep getting an error on that query that I supplied?

          Comment

          • ck9663
            Recognized Expert Specialist
            • Jun 2007
            • 2878

            #6
            Other than missing parameter, BOL says it shows up when you try indexing a system table. Try specifying which index you want so you can isolate the issue.

            Good Luck!!!

            ~~ CK

            Comment

            • dougancil
              Contributor
              • Apr 2010
              • 347

              #7
              CK,

              since I didn't know the names of the indexes, I ran a query to get them and when I try this query:


              dbcc dbindexdefrag (archive, marchive, Account)

              it's still failing, telling me that its an incorrect dbcc statement. I know that the parameters are correct. Any idea what you think may be causing this?

              Thanks

              Doug

              Comment

              • ck9663
                Recognized Expert Specialist
                • Jun 2007
                • 2878

                #8
                Will a quote on those parameter matter?

                ~~ CK

                Comment

                • dougancil
                  Contributor
                  • Apr 2010
                  • 347

                  #9
                  CK,

                  Here's what I tried next:

                  dbcc dbindexdefrag ('archive','mar chive','account ')

                  and tried every permutation of that. The odd thing is that if I parse it, the query says that it completes correctly. If I try to run it, that's when I get the error back.

                  Comment

                  • dougancil
                    Contributor
                    • Apr 2010
                    • 347

                    #10
                    I found out that for sql 2000 the syntax is not dbcc dbindexdefrag
                    but dbcc indexdefrag, just as an fyi.

                    Comment

                    Working...