Help: Problems with ALTER TABLE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maximilian Scherf

    Help: Problems with ALTER TABLE

    Hello,

    I have two problems with the ALTER TABLE command (Warning: I'm not
    exactly an Oracle expert):

    First Problem:

    I want to change the name of a column. I've tried the following:
    ALTER TABLE <table_name> RENAME COLUMN <old_column_nam e> TO
    <new_column_nam e>;
    The error I get is "ORA-14155: Keyword PARTITION or SUBPARTITION is
    missing." (That's translated from german, so the text probably isn't
    perfectly accurate).
    I have no idea what that means.

    Second Problem:

    I want to (re)enable a foreign key constraint. My try:
    ALTER TABLE <tablename> ENABLE CONSTRAINT <constraint_nam e>;
    Error: "ORA-00054: Tried to access an occupied resource with NOWAIT."
    (same as above).
    I've also tried locking the table but I get the same error then.

    My Oracle Version is 8.1.7, I'm on a Win2000 client, the server is
    some fat HPUX box (also running 8.1.7).

    Any help is appreciated. Thanks in advance and best regards,

    Max
  • Steffen Krippner

    #2
    Re: Help: Problems with ALTER TABLE

    Hi,
    the problem I am facing is a little different:

    Session A is doing updates on the table.
    In Session B (AUTOCOMMIT OFF) I issue the following commands:
    1) lock table t in exclusive mode;
    2) alter table t add (xxx number(10,0));

    Result:
    After (1) the updates off session A come to a halt. (Obviously fine)
    After (2) I get ORA-00054.

    Any explanations?

    Thanks.
    Steffen

    Comment

    • Alan Mills

      #3
      Re: Help: Problems with ALTER TABLE


      "Steffen Krippner" <steffenkrippne r@yahoo.com> wrote in message
      news:8a219c99.0 307180131.51d09 222@posting.goo gle.com...[color=blue]
      > Hi,
      > the problem I am facing is a little different:
      >
      > Session A is doing updates on the table.
      > In Session B (AUTOCOMMIT OFF) I issue the following commands:
      > 1) lock table t in exclusive mode;
      > 2) alter table t add (xxx number(10,0));
      >
      > Result:
      > After (1) the updates off session A come to a halt. (Obviously fine)
      > After (2) I get ORA-00054.
      >[/color]

      Not having memorised every oracle error code. remind me what error 54 is
      please.


      Comment

      • Steffen Krippner

        #4
        Re: Help: Problems with ALTER TABLE

        Hi,
        here we comes the Oracle description for this error code:

        ORA-00054 resource busy and acquire with NOWAIT specified

        Cause: The NOWAIT keyword forced a return to the command prompt
        because a resource was unavailable for a LOCK TABLE or SELECT FOR
        UPDATE command.

        Action: Try the command after a few minutes or enter the command
        without the NOWAIT keyword.

        Thank you,
        Steffen

        Comment

        • Steffen Krippner

          #5
          Re: Help: Problems with ALTER TABLE

          Hi,
          thanks for helping- but I still do not get it. I do the "lock table"
          in the first session. After that the updates in the second session
          stop. That is fine since the first session got the table lock. When I
          do the "Alter Table" in the first session it fails with the 00054
          error "resource busy". Shouldn't this succeed since I hold the table
          lock already in this session?

          Thanks,
          Steffen

          Comment

          • sybrandb@yahoo.com

            #6
            Re: Help: Problems with ALTER TABLE

            steffenkrippner @yahoo.com (Steffen Krippner) wrote in message news:<8a219c99. 0307202211.766b 1f8a@posting.go ogle.com>...[color=blue]
            > Hi,
            > thanks for helping- but I still do not get it. I do the "lock table"
            > in the first session. After that the updates in the second session
            > stop. That is fine since the first session got the table lock. When I
            > do the "Alter Table" in the first session it fails with the 00054
            > error "resource busy". Shouldn't this succeed since I hold the table
            > lock already in this session?
            >
            > Thanks,
            > Steffen[/color]

            No
            The situation you have is that your affected table is already in use
            prior to your ALTER TABLE command. Hence the *table definition* is
            locked, and you won't be capable to get another lock. You need to make
            sure no one has the table in use. The V$ACCESS view shows which
            sessions are using it.

            Sybrand Bakker
            Senior Oracle DBA

            Comment

            • Steffen Krippner

              #7
              Re: Help: Problems with ALTER TABLE

              Thanks.
              I am still wondering that Oracle forces everybody to stop using a
              table before some "schema evolution" is possible.
              Is there any other way to do the "Alter Table" perhaps by specifying
              the command should wait for the lock instead of aborting with
              ORA-00054???

              Comment

              • poupe
                New Member
                • Sep 2005
                • 1

                #8
                Originally posted by Maximilian Scherf
                Hello,

                I have two problems with the ALTER TABLE command (Warning: I'm not
                exactly an Oracle expert):

                First Problem:

                I want to change the name of a column. I've tried the following:
                ALTER TABLE <table_name> RENAME COLUMN <old_column_nam e> TO
                <new_column_nam e>;
                The error I get is "ORA-14155: Keyword PARTITION or SUBPARTITION is
                missing." (That's translated from german, so the text probably isn't
                perfectly accurate).
                I have no idea what that means.

                Second Problem:

                I want to (re)enable a foreign key constraint. My try:
                ALTER TABLE <tablename> ENABLE CONSTRAINT <constraint_nam e>;
                Error: "ORA-00054: Tried to access an occupied resource with NOWAIT."
                (same as above).
                I've also tried locking the table but I get the same error then.

                My Oracle Version is 8.1.7, I'm on a Win2000 client, the server is
                some fat HPUX box (also running 8.1.7).

                Any help is appreciated. Thanks in advance and best regards,

                Max
                Here is your answer:
                As refered to Oracle products.
                You must have at least Oracle 9i Release 2
                that can solve your problems.

                From Lao PDR.

                Comment

                • richasaraf
                  New Member
                  • Aug 2005
                  • 23

                  #9
                  Alter Table Solution !!!!!

                  Originally posted by Steffen Krippner
                  Hi,
                  thanks for helping- but I still do not get it. I do the "lock table"
                  in the first session. After that the updates in the second session
                  stop. That is fine since the first session got the table lock. When I
                  do the "Alter Table" in the first session it fails with the 00054
                  error "resource busy". Shouldn't this succeed since I hold the table
                  lock already in this session?

                  Thanks,
                  Steffen

                  ------
                  [FONT=Palatino Linotype][COLOR=Red]hey... even i use to face this problem.....
                  this error occurs when from apps u are inserting or transacting with one table and while that is going on you acces that table from back end maybe from SQL Navigator or so...
                  the solution to this is .... which i did... i asked my DBA to unlock the table or kill the session of apps and the error goes away...... :)

                  and it really helped me......
                  and for the ALTER TABLE .... got o following link... this helped me when i was learning.....

                  This SQL tutorial explains how to use the SQL ALTER TABLE statement to add a column, modify a column, drop a column, rename a column or rename a table (with lots of clear, concise examples). It is used to add, modify, or drop/delete columns in a table.


                  This site gives you the basic syntax of ALTER TABLE ... and has many more... so you can really learn a lot !


                  Thanks a lot ! :)
                  Richa[/COLOR][/FONT]

                  Comment

                  Working...