How to drop corrupted tables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • glhernandez
    New Member
    • Sep 2012
    • 19

    How to drop corrupted tables?

    I need to drop my table "13SEPTEMBER201 1" because when I open it some error is prompting. It happen to me two times the 1st one is on my DB2 v9.7 and now in my DB2 v10.1. They are both been corrupt after I import data file on that table and I don't know why?

    I try dropping the table in GUI form but the command doesn't execute and error comes again.

    Help to those who know what may solve my problem.

    Thank you very much

    Best Regards,

    G.L Hernandez
  • horus99
    New Member
    • Oct 2012
    • 4

    #2
    What is the error message when you try to access the table and then when you try to drop it?

    How did you import the data: IMPORT, LOAD, GUI, db2move?

    Peter,

    Comment

    • glhernandez
      New Member
      • Sep 2012
      • 19

      #3
      I have use Import. By the way I'm using Data Studio 3.1.1. So I use GUI to drop table but this error always prompting.

      ALTER TABLE JUSTIN."13SEPTE MBER2011" DROP PRIMARY KEY

      The table or index cannot be dropped because it is currently in use.. SQLCODE=-950, SQLSTATE=55006, DRIVER=3.63.108

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        That is telling you that there is an index to that table.
        You need to go thru your indexs and remove the one that is pointing to the table.
        http://publib.boulder.ibm.com/infoce...Fr0002051.html do search on "index"
        So much there... this is the reference to version 9 ... take a year to read.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Did a quick search out there and this popped up:


          I haven't finished reading it; however, you might find the information useful as it goes over indexs and table structure

          Comment

          • vijay2082
            New Member
            • Aug 2009
            • 112

            #6
            Hi,

            I can see that you are infact trying to drop your primary key. If you nee to drop your table them use below command

            Code:
            db2 drop table JUSTIN."13SEPTEMBER2011"
            Can you send me output of below query to see what's wrong in your table

            Code:
            db2 select * from syscat.tables where tabname='13SEPTEMBER2011'
            
            db2 select count(*) from JUSTIN."13SEPTEMBER2011"
            
            db2look -d <db_name> -a -e -l -t 13september2011 -o outlook.txt
            Cheers, Vijay
            Last edited by zmbd; Oct 6 '12, 08:52 PM. Reason: (V)missing text; (Z) Please format posted VBA, SQL, HTML, PHP, etc.. using the <CODE/> format button.

            Comment

            • glhernandez
              New Member
              • Sep 2012
              • 19

              #7
              Re: How to drop corrupted tables?

              Sir Vijay,

              Thank you so much for replying on both my concerns.

              Anyway, the result for:

              Code:
              db2 select count(*) from JUSTIN."13SEPTEMBER2011"
              is 129

              and Kindly check the files that I have attach at this post for the other information that you need to help me out.

              Also whenever I click Browse data or edit data. This message occurs:

              com.ibm.db2.jcc .am.SqlExceptio n: [jcc][t4][1065][12306][3.63.108] Caught java.io.CharCon versionExceptio n. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
              [jcc][t4][1065][12306][3.63.108] Caught java.io.CharCon versionExceptio n. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null


              Please help me sir. Thank you so much

              Best Regards,

              G.L Hernandez
              Attached Files
              Last edited by zmbd; Oct 6 '12, 08:55 PM. Reason: (Z) Please format posted VBA, SQL, HTML, PHP, etc.. using the <CODE/> format button.

              Comment

              • vijay2082
                New Member
                • Aug 2009
                • 112

                #8
                Hi,

                Your table looks perfectly fine. It's not corrupt. However it may be the case that you have loaded some data which was not required.

                The error which is being received while you browse or edit data is due to character conversion error. There is some data in the table which is not being recognized by the database and it's unable to display. Probably you need to look at your data before loading it again and remove junk/unwanted data.

                To remove/drop the table you can use below command. It will completely drop the table and you will have to recreate it once again.

                Code:
                db2 drop table JUSTIN."13SEPTEMBER2011"
                Cheers, Vijay
                Last edited by zmbd; Oct 6 '12, 08:55 PM. Reason: (Z) Please format posted VBA, SQL, HTML, PHP, etc.. using the <CODE/> format button.

                Comment

                • glhernandez
                  New Member
                  • Sep 2012
                  • 19

                  #9
                  Thank you very much! . You have help me a lot. Hope to learn more from you. Thank you again

                  Best Regards,

                  G.L Hernandez

                  Comment

                  Working...