Deleting data from a partition in a table

There is a requirement to delete data from a particular partition in our PROD Env.
Please let me know the syntax for the same.
Also is it possible to truncate a partition?
The DB version is 10.2.0.4 and OS is Solaris 10
Regards,
Narayan
Edited by: user7202581 on Apr 14, 2013 12:11 AM

Hi, You can use the following Syntex.
-- For Truncate
ALTER TABLE <table_name> TRUNCATE PARTITION <Partition_name>;
-- For Delete
DELETE FROM <table_name> PARTITION <partition_name>;

Similar Messages

  • Unable to delete data from a partition

    Hi,
    Unable to delete data from a partition
    I am using the command as:
    ALTER TABLE TEST DROP PARTITION DATE_20090820090000
    Its giving 0 rows deleted.Bu there are 200 rows for the Partition.
    The partition is getting deleted but the data remains.
    I want a command where the data in the partition also to be deleted along with partition.
    Any help will be needful for me

    SQL> CREATE TABLE range_part (
    prof_history_id NUMBER(10),
    person_id NUMBER(10) NOT NULL,
    organization_id NUMBER(10) NOT NULL,
    record_date DATE NOT NULL)
    PARTITION BY RANGE (record_date) (
    PARTITION yr0 VALUES LESS THAN (TO_DATE('01-JAN-2007','DD-MON-YYYY'))
    PARTITION yr7 VALUES LESS THAN (TO_DATE('01-JAN-2008','DD-MON-YYYY'))
    PARTITION yr8 VALUES LESS THAN (TO_DATE('01-JAN-2009','DD-MON-YYYY'))
    PARTITION yr9 VALUES LESS THAN (MAXVALUE) );
    Table created.
    SQL> INSERT INTO range_part VALUES (1, 1, 1, SYSDATE-720);
    INSERT INTO range_part VALUES (2, 2, 2, SYSDATE-360);
    INSERT INTO range_part VALUES (3, 3, 3, SYSDATE-180);
    INSERT INTO range_part VALUES (4, 4, 4, SYSDATE);
    1 row created.
    SQL>
    1 row created.
    SQL>
    1 row created.
    SQL>
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL> SELECT * FROM range_part;
    PROF_HISTORY_ID PERSON_ID ORGANIZATION_ID RECORD_DATE
    1 1 1 31-AUG-2007 05:53:22
    2 2 2 25-AUG-2008 05:53:22
    3 3 3 21-FEB-2009 05:53:22
    4 4 4 20-AUG-2009 05:53:22
    SQL> SELECT * FROM range_part PARTITION(yr7);
    PROF_HISTORY_ID PERSON_ID ORGANIZATION_ID RECORD_DATE
    1 1 1 31-AUG-2007 05:53:22
    SQL> alter table range_part drop partition yr7;
    Table altered.
    SQL> SELECT * FROM range_part PARTITION(yr7);
    SELECT * FROM range_part PARTITION(yr7)
    ERROR at line 1:
    ORA-02149: Specified partition does not exist
    SQL> SELECT * FROM range_part;
    PROF_HISTORY_ID PERSON_ID ORGANIZATION_ID RECORD_DATE
    2 2 2 25-AUG-2008 05:53:22
    3 3 3 21-FEB-2009 05:53:22
    4 4 4 20-AUG-2009 05:53:22

  • Deleting data from a very large log table (custom table in our namespace)

    Hello,
    I have been tasked with clearing a log table in our landscape to only include the most recent entries.  Is it possible to do this given that the table has already got 230 000 000 entries and will need to keep around 600 000 recent entries?
    Should I do this via ABAP and if so, how?  Thanks,
    Samir

    Hi,
    so you are going to keep 0,3 % of your data?
    If you should do it in ABAP or on the database is your decission.
    In my opinion doing things on the database directly should be done
    exceptional cases only e.g. for one time actions or actions that have to
    be done very rarely and with different parameters / options. Regular
    and similar tasks should be done in ABAP i think.
    In any case i would not delete the majority of the records but copy
    the records to keep in an empty table with the same structure, delete the
    table as a whole (check clients!) and "copy" the new table back in ABAP
    or rename the new table to the old table after droping the old table on the database.
    If you have only one client you can copy the data you need in a new
    table and truncate the old table (fast deletion for all clients). If you have
    data to keep  for other clients as well check how much data it is per client
    in comparison to the total number of lines (if only a small fraction, pefer copying
    them too).
    On the database you can use CTAS (create table as select) and drop table and
    rename table. Those commands shoudl be very efficient but work client independently.
    If you have to consider clients SELECT; INSERT; DELETE or TRUNCATE (depends on if you have
    copied all data considering clients) are
    your friends.
    Kind regards,
    Hermann

  • Open HUB ( SAP BW ) to SAP HANA through DB Connection data loading , Delete data from table option is not working Please help any one from this forum

    Issue:
    I have SAP BW system and SAP HANA System
    SAP BW to SAP HANA connecting through a DB Connection (named HANA)
    Whenever I created any Open Hub as Destination like DB Table with the help of DB Connection, table will be created at HANA Schema level ( L_F50800_D )
    Executed the Open Hub service without checking DELETING Data from table option
    Data loaded with 16 Records from BW to HANA same
    Second time again executed from BW to HANA now 32 records came ( it is going to append )
    Executed the Open Hub service with checking DELETING Data from table option
    Now am getting short Dump DBIF_RSQL_TABLE_KNOWN getting
    If checking in SAP BW system tio SAP BW system it is working fine ..
    will this option supports through DB Connection or not ?
    Please follow the attachemnet along with this discussion and help me to resolve how ?
    From
    Santhosh Kumar

    Hi Ramanjaneyulu ,
    First of all thanks for the reply ,
    Here the issue is At OH level ( Definition Level - DESTINATION TAB and FIELD DEFINITION )
    in that there is check box i have selected already that is what my issue even though selected also
    not performing the deletion from target level .
    SAP BW - to SAP HANA via DBC connection
    1. first time from BW suppose 16 records - Dtp Executed -loaded up to HANA - 16 same
    2. second time again executed from BW - now hana side appaended means 16+16 = 32
    3. so that i used to select the check box at OH level like Deleting data from table
    4. Now excuted the DTP it throws an Short Dump - DBIF_RSQL_TABLE_KNOWN
    Now please tell me how to resolve this ? will this option is applicable for HANA mean to say like , deleting data from table option ...
    Thanks
    Santhosh Kumar

  • Deleting data from SID Table

    Hi,
    I have deleted master data of an info object but it does not remove all the data from the SID table.
    I have selected with SID's option but not all data was removed.
    I am getting the error below when transporting
    "SID Table /BIC/ S2QKHITIND Contains Data : Characteristic ZQKHITIND Cannot be activated. "
    What needs to be done to get the charecteristic activated.
    Thanks
    James

    Hi Selva,
    Thank you for the info. I have deleted data from all the infoproviders but still get the message
    The system is unable to delete all the master data as, because some of it is still in use.  (See log:
    Object RSDMD, sub-object MD_DEL )
    Do you want to delete the data records that are no longer in use?
    What does this mean. is it due to the query open in some place or something else.
    While I am not able to delete the SID table entries as the delete is not active. Please help.
    Thanks
    James

  • Deleting data from a table where there are no indexes on the table

    Hi
    We have one interface program for one time process.When I was testing the process it was taking too much time to load the data around 1000 records.
    it happens in 2 steps
    1 puts into stage table
    2 puts into base table
    in the process/package I have delete statement that deletes data from stage table before each process.
    Stage table did not have any indexes but the base table has(obvisiosly)
    any idea?
    please help me on this.
    Thanks,
    Y

    Hi,
    Please post the application/database details along with the OS.
    Is this interface program a seeded or custom one?
    Please enable trace on this concurrent program as per (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12) and generate the TKPROF to find out why it takes that long to load/delete the data.
    Thanks,
    Hussein

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • Program or Function module to delete data from Open Hub Destination Table

    Hi All,
    Can anybody suggest me a Program or Function module to delete data from Open Hub Destination Table.
    Thanks & Regards,
    Vinay Kumar

    You can simply goto t-code SE14 mention the open hub destination table and Delete data by clicking on "Activate and Adjust database" with radio button "Delete Data".
    Regards,
    Arminder

  • How to exp a specific partition data from a partitioned table

    Thanks in advance.
    Is is possible to export a specific partition data from a partitioned table? If so Please describe how with an example. Thank You.

    You would specify a partition with the table_name:partition_name syntax at the TABLES parameter.
    See examples at
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#CEGCJABJ

  • Archiving old data from a partitioned table

    Hi,
    While sifting through all the options for archiving the old data from a table which is also indexed, i came across a few methods which could be used:
    1. Use a CTAS to create new tables on a different tablespace from the partitions on the exisitng table. Then swap these new tables with the data from the partitions, drop the partitions on the exisiting table (or truncate them although i m not sure which one is the recommended method),offline this tablespace and keep it archived. In case you require it in the future, again swap these partitions wih the data from the archived tables. I am not sure if i got the method correctly.
    2. Keep an export of all the partitions which need to be archived and keep that .dmp file on a storage media. Once they are exported, truncate the corresponding partitions in the original table. If required in the future, import these partitions.
    But i have one constraint on my Db which is I cannot create a new archive tablespace for holding the tables containing the partitioned data into then as I have only 1 tablespace allocated to my appplication on that DB as there are multiple apps residing on it together. Kindly suggest what option is the best suited for me now. Should I go with option 2?
    Thanks in advance.

    Hi,
    Thanks a bunch for all your replies. Yeah, I am planning to go ahead with the option 2. Below is the method I have decided upon. Kindly verify is my line of understanding is correct:
    1. export the partition using the clause:
    exp ID/passwd file=abc.dmp log=abc.log tables=schemaname.tablename:partition_name rows=yes indexes=yes
    2. Then drop this partition on the original table using the statement:
    ALTER TABLE tablename drop PARTITION partition_name UPDATE GLOBAL INDEXES;
    If I now want to import this dump file into my original table again, I will first have to create this partition on my table using the statement:
    3. ALTER TABLE tablename ADD PARTITION partition_name VALUES LESS THAN ( '<<>>' ) ;
    4. Then import the data into that partition using:
    imp ID/passwd FILE=abc.dmp log=xyz.log TABLES=schemaname.tablename:partition_name IGNORE=y
    Now my query here is that this partitioned table has a global index associated with it. So once i create this partition and import the data into it, do i need to drop and recreate the global indexes on this table or is there any aother method to update the indexes. Kindly suggest.
    Thanks again!! :)

  • Import data from a partitioned table

    I am trying to import data from another server database. I need only data from two partitions from a partitioned table in that database. I have to use IMPORT wizard.
    The new server should also have the partitioned table with those two partitions data.

    I created the database on the destination server with a primary, log, FG1 and FG2 filegroups.
    Next, created the partition function and scheme
    create partition function pfOrders(int)
    as range right
    for values(34);
    create partition scheme psOrders
    as partition pfOrders
    to (FG1,FG2)
    go
    Next, created the table on primary with primary key.
    Next, used import wizard twice to import data related to partition_id 34 and 65.
    The problem is the data is on primary filegroup. FG1 and FG2 does not have any data.

  • Move data from Non Partitioned Table to Partitioned Table

    Hi Friends,
    I am using Oracle 11.2.0.1 DB
    Please let me know how can i copy /move the data from Non -Partitioned Oracle table to the currently created Partiotioned table.
    Regards,
    DB

    839396 wrote:
    Hi All,
    Created Partitioned table but unable to copy the data from Non Partitioned table:
    SQL> select * from sales;
    SNO YEAR NAME
    1 01-JAN-11 jan2011
    1 01-FEB-11 feb2011
    1 01-JAN-12 jan2012
    1 01-FEB-12 feb2012
    1 01-JAN-13 jan2013
    1 01-FEB-13 feb2013into which partition should row immediately above ("01-FEB-13") be deposited?
    [oracle@localhost ~]$ oerr  ora 14400
    14400, 00000, "inserted partition key does not map to any partition"
    // *Cause:  An attempt was made to insert a record into, a Range or Composite
    //          Range object, with a concatenated partition key that is beyond
    //          the concatenated partition bound list of the last partition -OR-
    //          An attempt was made to insert a record into a List object with
    //          a partition key that did not match the literal values specified
    //          for any of the partitions.
    // *Action: Do not insert the key. Or, add a partition capable of accepting
    //          the key, Or add values matching the key to a partition specification>
    6 rows selected.
    >
    SQL>
    SQL> create table sales_part(sno number(3),year date,name varchar2(10))
    2 partition by range(year)
    3 (
    4 partition p11 values less than (TO_DATE('01/JAN/2012','DD/MON/YYYY')),
    5 partition p12 values less than (TO_DATE('01/JAN/2013','DD/MON/YYYY'))
    6 );
    Table created.
    SQL> SELECT table_name,partition_name, num_rows FROM user_tab_partitions;
    TABLE_NAME PARTITION_NAME NUM_ROWS
    SALES_PART P11
    SALES_PART P12
    UNPAR_TABLE UNPAR_TABLE_12 776000
    UNPAR_TABLE UNPAR_TABLE_15 5000
    UNPAR_TABLE UNPAR_TABLE_MX 220000
    SQL>
    SQL> insert into sales_part select * from sales;
    insert into sales_part select * from sales
    ERROR at line 1:
    ORA-14400: inserted partition key does not map to any partition
    Regards,
    DB

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • Delete data from DSO only with a part of the key

    Hi experts,
    I have a DSO with 9 key fields and i want to delete some entrys. Our source system only provides 2 fields of the key. My problem is, that the BI is not able to delete from DSO unless I have the full key.
    Now I want to get the rest of the key fields from the active table of the DSO. Can sombody help me please with the ABAP Code? Or is there another possibility?
    I already found this thred in SDN but this is for BW 3.5:
    Delete data from ODS with only part of the key
    Thanks
    Ralf

    Ralf,
    the thread pointed out by you is for passing deletion entries to the DSO / target using the deletion entries .. namely recordmode = D.
    Are you looking at deleting data from the DSO as a one time activity or you want to handle the same using a start / end routine ...? and pass deletion entries to other data targets which get the data from this DSO ?
    Arun

  • Deleting data from a cube

    Hi,
    I added a info object to a dimension in a cube. now i want to delete the info object from the cube. But since the cube has data in it, i cannot do it unless i delete all the data from the cube. When i select 'delete data', i'm given 2 options, delete fact table only and 2nd option delete fact table and dimension table. what is the difference between the two and what option should i select.
    i then need to load the cube back from ODS. the cude right now is setup in the proce4ss chain to do a delta load every day. would this be affected after i delete the data and load it again from the ODS?
    Thanks
    Sameer

    The way I understand your question is...
    1) You have data in the cube from which you have to remove an infoobject
    Ans: To acheive this, you have to delete the data from the cube
    2) You have deleted the data and then deleted the IO, activated the cube and the update rules from the ODS which feeds this cube
    3) Now you have to reload the deleted data from the ODS. But you already did an init and you are loading delta's from this ODS to the cube through process chain.
    Ans: As you've already deleted the whole data from the cube, do a full load from the ODS (you can do this even when delta initialization is done) to your cube by creating a new infopackage under the export datasource of the ODS. This will capture all the records from the ODS. Then to be on the safe side so as not to load any duplicate records...go the infopackage that you've used to do the full load (you can even create a new Info package)...SCHEDULER -> Initilization options for source system -> Delete the existing INIT -> Then do Init again...
    Leave the delta infopackage as is and let the process chain take care of the deltas from now on...
    Hope this helps. Let me know I am missing something here...

Maybe you are looking for

  • Windows 2003 R2 installation failing with ORA-12154

    Windows 2003 R2 Enterprise default installation, no Windows Updates at all Pentium 4, 2 gb ram, 127 gb hard drive In a workgroup using DHCP Installed Microsoft Loopback Adapter as per installation docs (which I read) Default installation of Oracle 10

  • ITunes 11.2.1 is unable to change metadata

    After this recent update of iTunes to version 11.2.1 I'm no longer able to change metadata of any MP3 file without that the spinning ball takes an infinity spinning tour. I have to kill the iTunes process. Befor this update I changed mass of files th

  • International Travel Request Project Help..urgent..

    Hi, Our project is International travel request. Wat we planned to do is, to select from and to locations we are displaying 2 world maps one for selection of from field and the other is for to. So i have downloaded world map illustrater file... how c

  • Windows XP Using iTunes with Multiple Identities

    Hi. I'm using Windows XP and iTunes 7. I have my music files on an external drive, but all my library files are in My Music folders. I'd like to share all the music with other users of this PC (my kids) from their own identities. I was able to import

  • VAT (GST) Implementation in PeopleSoft FSCM 9.2 for Malaysia

    Hi, I would like to seek some help on the GST(VAT) implementation in PeopleSoft. Our company need to implement the GST in our system due to the implementation of GST in Malaysia and I got some implementation information regarding this and I manage to