Alter drop partition - hanging

Hi all,
I am trying to drop some partitions on several tables in my database. These tables generally have ~50,000 range partitions. When I ran my script to drop ~ 30,000 partitions in our dev db, it took about 2 hours to complete. Now in our production db, I am running a single drop command and its just hanging and hanging. Any ideas how I can dig deeper to find out why the different results? Running Oracle 11.2 on RHEL5.
Thank you,
Scott
alter table events_sup drop partition evt_15apr2012_0600_0615;

SQL> list
1* select * from V$session_wait where sid = 709
SID SEQ#
EVENT
P1TEXT P1
P1RAW
P2TEXT P2
P2RAW
P3TEXT P3
P3RAW WAIT_CLASS_ID WAIT_CLASS#
WAIT_CLASS WAIT_TIME
SECONDS_IN_WAIT STATE WAIT_TIME_MICRO TIME_REMAINING_MICRO
TIME_SINCE_LAST_WAIT_MICRO
709 12892
db file sequential read
file# 2699
0000000000000A8B
block# 1050130
0000000000100612
blocks 1
0000000000000001 1740759767 8
User I/O 0
0 WAITING 8607 -1
0

Similar Messages

  • Problem in truncate/drop partitions in a table having nested table columns.

    Hi,
    I have a table that has 2 columns of type nested table. Now in the purge process, when I try to truncate or drop a partition from this table, I get error that I can't do this (because table has nested tables). Can anybody help me telling how I will be able to truncate/drop partition from this table? IF I change column types from nested table to varray type, will it help?
    Also, is there any short method of moving existing data from a nested table column to a varray column (having same fields as nested table)?
    Thanks in advance.

    >
    I have a table that has 2 columns of type nested table. Now in the purge process, when I try to truncate or drop a partition from this table, I get error that I can't do this (because table has nested tables). Can anybody help me telling how I will be able to truncate/drop partition from this table?
    >
    Unfortunately you can't do those operations when a table has a nested table column. No truncate, no drop, no exchange partition at the partition level.
    A nested table column is stored as a separate table and acts like a 'child' table with foreign keys to the 'parent' table. It is these 'foreign keys' that prevent the truncation (just like normal foreign keys prevent truncating partions and must be disabled first) but there is no mechanism to 'disable' them.
    Just one excellent example (there are many others) of why you should NOT use object columns at all.
    >
    IF I change column types from nested table to varray type, will it help?
    >
    Yes but I STRONGLY suggest you take this opportunity to change your data model to a standard relational one and put the 'child' (nested table) data into its own table with a foreign key to the parent. You can create a view on the two tables that can make data appear as if you have a nested table type if you want.
    Assuming that you are going to ignore the above advice just create a new VARRAY type and a table with that type as a column. Remember VARRAYs are defined with a maximum size. So the number of nested table records needs to be within the capacity of the VARRAY type for the data to fit.
    >
    Also, is there any short method of moving existing data from a nested table column to a varray column (having same fields as nested table)?
    >
    Sure - just CAST the nested table to the VARRAY type. Here is code for a VARRAY type and a new table that shows how to do it.
    -- new array type
    CREATE OR REPLACE TYPE ARRAY_T AS VARRAY(10) OF VARCHAR2(64)
    -- new table using new array type - NOTE there is no nested table storage clause - arrays stored inline
    CREATE TABLE partitioned_table_array
         ( ID_ INT,
          arra_col  ARRAY_T )
         PARTITION BY RANGE (ID_)
         ( PARTITION p1 VALUES LESS THAN (40)
         , PARTITION p2 VALUES LESS THAN(80)
         , PARTITION p3 VALUES LESS THAN(100)
    -- insert the data from the original table converting the nested table data to the varray type
    INSERT INTO PARTITIONED_TABLE_ARRAY
    SELECT ID_, CAST(NESTED_COL AS ARRAY_T) FROM PARTITIONED_TABLENaturally since there is no more nested table storage you can truncate or drop partitions in the above table
    alter table partitioned_table_array truncate partition p1
    alter table partitioned_table_array drop partition p1

  • Drop partition without disabling foreign key

    Hi All,
    I have parent and child table.
    Parent table
    create table parent_1
    (id number,
    create_date date,
    constraint parent_1_pk001 PRIMARY KEY (id))
    PARTITION BY RANGE (create_date)
    INTERVAL (NUMTODSINTERVAL(1,'DAY'))
    (PARTITION parent_1_part VALUES LESS THAN ('01-JAN-2010'));
    Child Table
    create table child_1
    (id number,
    create_date date,
    constraint child_1_fk001 FOREIGN KEY (id)
    REFERENCES parent_1 (id))
    PARTITION BY RANGE (create_date)
    INTERVAL (NUMTODSINTERVAL(1,'DAY'))
    (PARTITION create_date_part VALUES LESS THAN ('01-JAN-2010'));
    I am having problems dropping partition.
    Parent_1
    1     26-JUL-12
    2     26-JUL-12
    Child_1
    1     26-JUL-12
    alter table CHILD_1 drop partition SYS_P274;
    table CHILD_1 altered.
    ON DROPPING PARENT PARTITION
    alter table parent_1 drop partition SYS_P273;
    Error report:
    SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
    *Cause:    An attempt was made to truncate a table with unique or
    primary keys referenced by foreign keys enabled in another table.
    Other operations not allowed are dropping/truncating a partition of a
    partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    *Action:   Before performing the above operations the table, disable the
    foreign key constraints in other tables. You can see what
    constraints are referencing a table by issuing the following
    command:
    SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";
    PLEASE CAN I KNOW IF THERE IS ANY WAY TO DROP PARENT PARTITION WITHOUT DISABLE/ENABLE FOREIGN CONSTRAINTS
    Thanks

    SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
    *Cause: An attempt was made to truncate a table with unique or
    primary keys referenced by foreign keys enabled in another table.
    Other operations not allowed are dropping/truncating a partition of a
    partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    *Action: Before performing the above operations the table, disable the
    foreign key constraints in other tables. You can't do that until you disable the foreign key constraint
    http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/
    Hope this helps
    Mohamed Houri
    www.hourim.wordpress.com

  • Error on drop partition

    Hello,
    When i execute this command i get this:
    SQL> ALTER TABLE RMPM.GROUPE_AFFAIRES DROP PARTITION PART_71;
    ALTER TABLE RMPM.GROUPE_AFFAIRES DROP PARTITION PART_71
    ERROR at line 1:
    ORA-04045: errors during recompilation/revalidation of RMPM.IDX_GA_LIB
    ORA-29881: failed to validate indextype
    I d'ont know why???
    Thanks
    PS: oracle version is 9.2.0.6.0 on AIX

    Hello,
    When i execute this command i get this:
    SQL> ALTER TABLE RMPM.GROUPE_AFFAIRES DROP PARTITION PART_71;
    ALTER TABLE RMPM.GROUPE_AFFAIRES DROP PARTITION PART_71
    ERROR at line 1:
    ORA-04045: errors during recompilation/revalidation of RMPM.IDX_GA_LIB
    ORA-29881: failed to validate indextype
    I d'ont know why???
    Thanks
    PS: oracle version is 9.2.0.6.0 on AIX

  • Drop Partition update Global Indexes

    hello Gurus,
    what will happen internally when issue a command
    alter table tab_name drop partition part_name update global indexes;
    why my insert statement waiting to complete this task on " cursor: pin S wait on X "
    thanks in advance ..

    Several times i also noticed that wait event for some jobs on 10 2 0 4 on hpux.
    I didn't found out what was the reason.
    It seems this wait event can be easly related to some bugs.
    http://karenmorton.blogspot.com/2008/08/strange-parsing-behavior.html
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/waitevents003.htm#sthref3012

  • Drop partition from procedure

    Hi,
    Why I can't drop partiton from procedure? How can I do it?
    SQL> alter table ama add partition p1 values ('1')
    2 /
    Table altered.
    SQL>
    SQL> create procedure partition_drop (partition_name varchar) is
    2 begin
    3      execute immediate 'alter table ama drop partition p'||partition_name||')';
    4 end;
    5 /
    Procedure created.
    SQL>
    SQL> call partition_drop('1')
    2 /
    call partition_drop('1')
    ERROR at line 1:
    ORA-14048: a partition maintenance operation may not be combined with other operations
    ORA-06512: at "AMA.PARTITION_DROP", line 3
    SQL>
    SQL> alter table ama drop partition p1
    2 /
    Table altered.

    Hi,
    I have tried this and its working..
    Create Table Part_Test(a number(2), b varchar2(30))
    Partition by range (a)
    (Partition part1 values less than (10) tablespace users,
    Partition part2 values less than (20) tablespace users ,
    Partition part3 values less than (30))
    Begin
    Execute Immediate 'Alter table part_test add partition part5 values less than (MAXVALUE)';
    Execute Immediate 'Alter Table part_test drop partition part1';
    end;
    Thanks....

  • Problem while dropping partitions

    Hi All,
    I'm using oracle 11g. I have 2 tables A and B. A is the master table and B is the child table. Both the tables are partitioned based on month. Now when i have to drop partition for previous month, i first drop partition from table B then from table A. With table B the partition is getting dropped successfully. But when i try to drop partition for A it gives an error as it is a master table. Table A does not have any data in the partitioned to be dropped that is being referenced by table B. How do i drop the partition for master table.
    Thanks in Advance

    Hi,
    There may be Chance of Have some rows .. just find out the rows existing in the partition of master table with existence of records in Child table that makes it clear clarificaiton...
    - Pavan Kumar N

  • Drop partition with missing associate Tablespace

    Hi All,
    Scenario is user accidentally removed datafile using rm command then we dropped that Tablespace using offline drop. we want to drop partition for which TS and datafile both are already offline dropped .
    Thanks.

    >
    I tried to exchange partition with another table having same properties of original table. While doing so it prompted below error,
    ORA-14292: Partitioning type of table must match subpartitioning type of composite partition
    >
    Then most likely the table and partition do NOT have the same properties.
    If you want to exchange a partition of a table that is subpartitioned then the other table has to be partitioned in the same way that the main table is subpartitioned.
    Post the DDL for the main table that shows how it is partitioned/subpartitioned and the DDL for the work table you are trying to use for the exchange.
    See my reply Posted: Jan 7, 2013 7:02 PM in this thread for a solution that uses exchange partition is a similar manner
    Merge tables

  • How to create and drop partitions automatically?

    How to create and drop partitions automatically?
    The environment is Oracle 10g(10.2.0.3) on the RHEL4.0 system.
    I want to partition the MESSAGE table by date (NUMTODSINTERVAL(1,'DAY') ). One partition per day. Because the table is huge, only 2 partitions (today and yesterday's data) are necessary to be kept online. All the partitions that earlier than the previous day will be backed up and then dropped. I want to make the partition creating and dropping jobs run automatically. How to do it?
    Thank you

    junez wrote:
    How to create and drop partitions automatically?
    The environment is Oracle 10g(10.2.0.3) on the RHEL4.0 system.
    I want to partition the MESSAGE table by date (NUMTODSINTERVAL(1,'DAY') ). One partition per day. Because the table is huge, only 2 partitions (today and yesterday's data) are necessary to be kept online. All the partitions that earlier than the previous day will be backed up and then dropped. I want to make the partition creating and dropping jobs run automatically. How to do it?With 11g, new partitions can automatically be created.
    With 10g, you need to do that yourself. I prefer to create a "buffer" of future partitions - in case the job whose task it is to add new partitions gets held up or stuck. Or the job queue is full due to some problem and it does not get the chance to execute in time.
    I dislike your partitioning criteria. I prefer using the date directly and not mangling it to something else. If a specific day has a large volume of data, then another option is to use hourly date ranged partitions. With local partitioned indexes and the date time range used for querying, this can be quite effective performance wise.
    As for partitioning maintenance - I use a custom written partitionManager PL/SQL package that provides an interface for adding daily and hourly partitions to a table. Input parameters are for example name of the table, start date and the number of partitions to add. Similarly it provides interfaces for aging partitions - again by specifying a table and a date-time to use as the starting point, back into time, for removing old partitions.
    I typically call this code from the actual application code itself - so before a new partition will be used for example, the app code will first ensure that it has a partition to use. This is safer than a separate job as the dependency is resolved where and when it is needed - and not done as a separate task.
    For example - you should have a procedure/package that provides an app the means to log a message into your MESSAGE table. As part of an autonomous transaction, this procedure can check if the required partition exists, before attempting to insert a message into the table.
    Where this approach is not possible, a DBMS_JOB can be used to create future partitions - but as I mentioned, rather have it add a bunch of future (empty) partitions in case something goes pear shape with the job mechanism.

  • Ignoring only "Drop Partition" DDLs.

    Hi,
    I am doing a proof of concept to see if we can use Golden Gate to replicate data from our Primary database (Oracle 10g) to a reporting database. The primary is an OLTP database and I intend to use the "IGNOREDELETES" feature so that any purging done to remove historical data (from primary) will not remove anything from the reporting database.
    In case of partitioned tables when I drop a partition to remove older data, can I have Golden Gate not replicate only this DDL (drop partition) command?
    Thank you.

    Hello,
    You disable all of them in order to delete the parent record and correponding child record (remember it wont' let you delete unless you take care of all the dependencies) and it won't let you enable if you missed to delete any child record.
    Regards
    Edited by: OrionNet on Mar 17, 2009 11:32 AM

  • GG replication for interval partitioned tables while issuing drop partition command

    Hi all, we have golden gate replication between two databses 1 and 2. table A in 1 and 2 is interval partitioned but the partition names are different. whats the best way to achieve GG replication using drop partition. We want to drop partition automatically in DB 2 if done in DB 1.

    Hi,
    In this scenario ypu would better to drop manually on both the database, especially for drop you could filter based on operation type and do it manually.

  • DROP PARTITION ONLINE

    Hi, @work we're trying to implement this schema: We've got very high transactional tables... with a huge load of INSERTS on them 24/7; so we decide to partition these tables hourly and remove all the indexes from them. Our problem begins when we issue the DROP PARTITION statement. It actually drops the partition but left almost always two ot three sessions frozen from the aplications that load the data. It also locks the tables involved in the procedure. The key here is that que WE CANNOT STOP the populating process because is a business rules restriction. Can this be done this way and how?. One more thing... we also try this process when the tables got GLOBAL INDEXES con them... but issuing a DROP PARTITION UPDATE GLOBAL INDEXES is prohibitive because of the time it takes and the degradation of performance it involves. If we issue the DROP PARTITION alone... the indexes became unusuble and the process loading data stop and fell. I don't know why because we set SKIP_UNUSABLE_INDEXES = TRUE. We though that using flat tables partitioned without indexes would be the solution but we're facing this issue. Thanks for any hint that may come in hand. Regards.
    Robert.

    so we decide to partition these tables hourly and remove all the indexes from them
    One more thing... we also try this process when the tables got GLOBAL INDEXES on
    them... but issuing a DROP PARTITION UPDATE GLOBAL INDEXES is prohibitive
    because of the time it takes and the degradation of performance it involves. If we issue
    the DROP PARTITION alone... the indexes became unusuble and the process loading
    data stop and fell. I don't know why because we set SKIP_UNUSABLE_INDEXES =
    TRUE.The above two are contradictory statements.
    As of now, do you have Global Indexes on the table in question ? (Yes/No)
    Assuming, the answer is "NO". Instead of dropping the partition, try to EXCHANGE the partition with a dummy table and then drop the partition.
    Hope this works out in your case.
    Regards

  • Drop partitions in HASH partitioned table

    SELECT * FROM product_component_version
    NLSRTL      10.2.0.4.0     Production
    Oracle Database 10g Enterprise Edition      10.2.0.4.0     64bi
    PL/SQL      10.2.0.4.0     Production
    TNS for Solaris:      10.2.0.4.0     ProductionI have a table which is partitioned by HASH into several partitions. I would like to remove them all the same way I can DROP partitions in a LIST or RANGE partitioned tables.
    I COALESCE-d my table until it remained with only one partition. Now I've got a table with one HASH partition and I would like to remove it and to end up with unpartitioned table.
    How could it be accomplished?
    Thank you!

    Verdi wrote:
    I have a table which is partitioned by HASH into several partitions. I would like to remove them all the same way I can DROP partitions in a LIST or RANGE partitioned tables.
    I COALESCE-d my table until it remained with only one partition. Now I've got a table with one HASH partition and I would like to remove it and to end up with unpartitioned table.
    How could it be accomplished?
    You cannot turn a partitioned table into a non-partitioned table, but you could create a replacement table (including indexes etc.) and then use the 'exchange partition' option on the partitioned table. This will modify the data dictionary so the data segments for the partition exchange names with the data segments for the new table - which gives you a simple table, holding the data, in minimum time and with (virtually) no undo and redo.
    The drawback to this method is that you have to sort out all the dependencies and privileges.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    Author: <b><em>Oracle Core</em></b>

  • Need to Audit ALTER, DROP or TRUNCATE on All Tables in a Schema

    Hello,
    I need to audit any ALTER, DROP or TRUNCATE on all tables in the "X" schema including operations done by the "X" account.
    Oracle Version = 11g Release 11.1.0.6.0
    audit_sys_operations = TRUE
    audit_trail = XML, EXTENDED
    Thanks!

    Sky13 wrote:
    Hi Srini;
    After rereading my last post I have to apologize for being obnoxious. I have been trying:
    No apology is necessary - you are not doing me any favors ;-)
    audit alter table; This I get "Audit succeeded" Good - this means that any ALTER TABLE command issued by any user, whether the command is successful or not, will be logged.
    audit truncate table; This I get "ORA-00956: missing or invalid auditing option" I do not have access to a database currently, so cannot verify what is wrong - it looks correct - pl verify syntax.
    >
    I see them both in the documentation you referenced and in another places. I am certain I am missing something.
    Thanks for the help!!!! and again I apologize.You are welcome. I would suggest you experiment in a test database first :-)
    HTH
    Srini

  • Alter table partition

    hi everybody !
    I have a table which also has data in it. Now, before i add some more data to this table i want to create a partition with all the existing data. Following is the error message i get when executing the altertable command.
    ALTER TABLE address_header_temp
    add PARTITION add_head_temp
    VALUES LESS THAN (MAXVALUE);
    error :-
    ORA-14501: object is not partitioned
    Please help me in solving this problem.
    Thanks in advance
    Moloy

    If you wanna do it online, then, use dbms_redine package to redifine objects online. I believe this is one time process. Once you add partitions and you can drop and create partions accordingly. At least you get out of heap table to meet your requirements.
    Otherwise, create another table with required partions and move data from heap (non partitoned) table to partitioned table, drop the old one and rename the new one to old one.
    Jaffar

Maybe you are looking for

  • I have major problem,ios 5.1.1

    I have major problem with my 5.1.1 update ios, she does not want to settle, after the download an error message appears thank you for helping me!

  • Cant attach photos to email after "upgrade" to Photos...why?

    HI, So recently Apple updated (hijacked) my iPhoto app on my computer with their "new and improved" Photos software.  While is good to have some long needed features like a useful file system, I seem to have lost some core functionality.  I use Outlo

  • Best way to clear MacBook Air?

    Hey, Having backed up my Macbook Air using an external hard drive and Time Machine - I just needed some guidance in what best to do now to clear up my laptop please. I've started to get a message that my 'start up disc is full' - now I have backed up

  • Batch No. within Outgoing Excise Invoice

    Dear All,          How can I get Batch No. of the Items within Outgoing Excise Invoice. Regards Hitesh Parsawala

  • Integrate reports with Jdeveloper

    Hi, Can anyone please tell me how to integrate Jasper reports with Jdeveloper.I need to create reports and Graphs in my application. Thanks