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!! :)

Similar Messages

  • 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

  • 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

  • Archiving old data from a main database into an archived database

    Hello colleagues,
    We are trying to create a stored procedure to archive data older than 6 months (180 days) from our production database in to a new archive database.
    We want to archive only 20,000 rows a day and we need to schedule it on a daily basis. We also want to delete those archived rows from the production database.
    Could you please share us your experience on archiving.
    Thanks

    Hi BG516, 
    Ok, I got your point now :) 
    First, how long does it take to read these 20.000 rows? It shouldn't be a lot, especially if the table is well indexed to cover that query (an index on the date column and covering the rest of the table, basically). There are many aspects that may affect
    the process but my guess is that the big deal would be to delete these old rows from your production table. 
    Reading these rows will require a shared latch, and if you're reading old data your daily processes shouldn't be trying to write in these particular pages (again, depends on the indexes mainly). Deleting them will need an exclusive lock and that'd be more
    problematic, reads are quite more common than writes in a datawarehouse. 
    When facing this kind of problem, I always had to find a non-peak period of time to execute the required processes. 
    A few things that come to my mind: 
    - Use BULK INSERT when loading the data into your historical table so you can minimize the time you spend
    reading from the production table
    - Check the number of indexes you'll impact when deleting these rows. The more, the worse (more time
    needed to maintain them)
    - What version of SQL Server are you using? The Elastic Scale feature from Azure SQL Database covers just
    that scenario (http://channel9.msdn.com/Shows/Data-Exposed/Azure-SQL-Database-Elastic-Scale)
    Regards.
    Pau.

  • 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.

  • Is there any way so that I Being able to clear out old data from the Order

    Hi Friends,
    Is there any way so that I Being able to clear out old data from the Order Gate forecast, tolerance, and confirmed order to date tables on a monthly basis?
    Means I want data in data table for particular time (I want that if suppose today is 13-11-2008 then my data table must contain data from 13-10-2008 to 13-11-2008.
    Is it possible thru ABAP development or thru any t codes ?
    Any pointers will be rewarded.
    Regards

    hi,
    Before archiving you have to put the Deletion flag for the object(May be for PO, MMR etc as per your req.)...
    After that the you use the archiving procedure to archive the docs which are already flagged for deletion...
    For MMR you use the transaction SARA...and its respective object for the archiving....
    You can use the SDN search to see the many threads on it...
    Or use this link as per your req. and make the search...
    http://help.sap.com/saphelp_erp2004/helpdata/EN/75/ee0fa855c811d189900000e8322d00/frameset.htm
    Regards
    Priyanka.P

  • Best way to remove old data from db?

    Hi,
    I am looking some ways to keep my database small and remove old data from database and archive it somewhere else. the data may need to be put back to the database in the future. One of the things I am conserned is how to enforce constraints? In other words, when I remove data, all the related pk/fk data should be removed together. Any suggestions will be greatly appreciated.
    Thanks

    hope this may help u
    concept is : exp/imp & truncate will reclaim the space
    method1
    do an export and secure the dump(say dump1) for future purpose.
    delete the unwanted data.
    commit.
    now again export the tables ( say dump2).
    now do the import(dump2).
    /*now this import will reclaim the the unused space.*/
    method 2
    /* depennded on volume of data */
    -- create backup of existing table for future
    create table backup_table nologging as select * from original_table;
    -- create copy1 of existing table
    create table copy_table nologging as select * from original_table;
    -- truncate the original table, so that highwater mark is reset.
    truncate table original_table;
    -- insert data from copy_table into original table
    insert /*+ APPEND */ into original_table select * copy_table where(ur conditions for data);
    commit all the work.
    /* now u have 3 tables
    backup_table - with all the data - for future reload
    original_table - with unwanted data deleted and space reclaimed.
    copy_table - copy of original table.
    now u drop the copy_table
    drop table copy_table;
    regards

  • DB Connect Load - "Unknow error while uploading data from the DB Table"

    Hi Experts,
    We have our BI7 system connected to Oracle DB based third party tool. The loads are performing quite well in DEV environment.
    I would like to know, how we transport DB Connect datasources to Quality systems? Any different process to be followed for DB Connect datasources?
    At present the connections between BI Quality and the third party quality systems are established. We transported the DataSource from BI DEV system to BI quality system, but on trigerring an infopackage we are not able to perform loads. It prompts - "Unknow error while uploading data from the DB Table".
    Also on comparing the DataSources in DEV system and Quality system there are no fields in "Proposal" tab of datasource in Quality system. Also I cannot change or activate Datasource in Quality system as we dont have change access in quality.
    Please advice.
    Thanks,
    Abhijit

    Hi,
    Sorry for bumping an old thread ....
    Did this issue get ever get resolved?
    I am facing the same one. The loads work successfully in Dev. The transport for DBConnect DS also moved in successfully.
    One strange this is that DB User for dev did not automatically change to db user from quality when I transported the DBConnect datasource. DBCon DS still shows me the DB User from Dev in Quality system
    I get "Unknown Error" whenever I trigger the data package.
    Advait

  • 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

  • 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

  • Need to delete specific Months Data from SQL Server Table

    Greetings Everyone,
    So i have one table which contains 5 years old data, now business wants to keep just one year old data and data from qurter months i.e. (jan, mar, June, sep and December), i need to do this in stored procedure. how i can achive this using month lookup table.
    Thank you in advance
    R

    Hi Devin,
    In a production environment, you should be double cautious about the data. I have no idea why you’re about to remove the data just years old. In one of the applications I used to support, the data retention policy is like to keep raw data for latest month
    and the elder data would get rollup as max, min, average and so on to store in another table. That’s a good example for data retention.
    In your case I still suggest you keep the elder data in another table. If the data size is so huge that violates  your storage threshold, get the data rollup and store the aggregated would be a good option.
    Anyway if you don’t care about the elder data, you can just delete them with code like below.
    DELETE
    FROM yourTable
    WHERE YEAR(dateColumn) < YEAR(CURRENT_TIMESTAMP) OR (MONTH(dateColumn) not in (1,3,6,9,12) AND YEAR(dateColumn) = YEAR(CURRENT_TIMESTAMP))
    In some cases to remove data from very large table, DELETE performs bad. TRUNCATE would be a better option which works faster. Read more by clicking
    here. In your case, if necessary, you can reference the below draft code.
    SELECT * INTO tableTemp FROM yourTable WHERE YEAR(dateColumn) = YEAR(CURRENT_TIMESTAMP) AND MONTH(dateColumn) IN(1,3,6,9,12)
    TRUNCATE yourTable;
    INSERT INTO yourTable SELECT * FROM tableTemp
    As you mentioned, you need to do the deletion in Stored Procedure(SP). Can you post your table DDL with sample data and specify your requirement details so that I can help to compose your SP.
    If you have any question, feel free to let me know.
    Best regards,
    Eric Zhang

  • Select data from all the table names in the view

    Hi,
    "I have some tables with names T_SRI_MMYYYY in my database.
    I created a view ,Say "Summary_View" for all the table names
    with "T_SRI_%".
    Now i want to select data from all the tables in the view
    Summary_View.
    How can i do that ? Please throw some light on the same?
    Thanks and Regards
    Srinivas Chebolu

    Srinivas,
    There are a couple of things that I am unsure of here.
    Firstly, does your view definition say something like ...
    Select ...
    From "T_SRI_%"
    If so, it is not valid. Oracle won't allow this.
    The second thing is that your naming convention for the
    tables suggests to me that each table is the same except
    that they store data for different time periods. This would be
    a very bad design methodology. You should have a single
    table with an extra column to state what period is referred to,
    although you can partition it into segments for each period if
    appropriate.
    Apologies if i am misinterpreting your question, but perhaps
    you could post your view definition and table definitions
    here.

  • Does sql server could export a partition from a partition table ?

    Dear :
       Does sql server could export a partition from a partition table ? 
      For example, I need to export all old partition,which is '2013' and drop them.  It is easy in oracle. but how to do with sql
    server 2012 ?

    where do you want it to be exported to? Another server instance? if yes you can do piecemeal restore if partition is in a separate filegroup and you're on full recovery model
    http://msdn.microsoft.com/en-IN/library/ms177425.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Open Hub fetching data from Change log table

    Hi Gurus,
    I have a scenario where in I have an Open Hub destination whose source is a DSO, and we are sending data into SAP Data services. We found that the data being sent is from the change log table. Is this how an Open Hub with DSO as a source works ? Or is there any possible way we can send data from the Active table of the DSO, when the DTP is run.
    Kindly help. Thanks in advance !
    Regards
    Snehith

    Hi,
    For Extraction from the DataStore Object, we have the following options for Delta init Extraction:
    Active Table (with Archive)
    The data is read from the active table and from the archive or from a near-line storage if one exists. You can choose this option even if there is no active data archiving process yet for the DataStore object.
    Active Table (Without Archive)
    The data is only read from the active table. If there is data in the archive or in a near-line storage at the time of extraction, this data is not extracted.
    Change Log
    The data is read from the change log of the DataStore object
    We can select any of these options for data trasnfer.
    Regards,
    Geetanjali

  • Solution for purging/archiving old messages from ServiceLink

    Hello there,
    We're looking for some advice on how to purge or archive old messages from ServiceLink.  We're looking to retain one month's worth of data.
    Is it possible to do this?
    Many thanks.

    what version of RC are you running?   The maintenance scripts should be included with later releases under the parent installation directory... (\\newScaleXX\schema\util\slcleanup\)

Maybe you are looking for

  • Exporting videos from iPhoto

    For the life of me, I can't figure out a way to export videos which I imported into iPhoto from my camera. I can export it to my desktop but can't export them in a format that I can then import into Vimeo or other video sharing site. What the heck do

  • Firefox is replacing double quotes with single quotes.

    In WordPress and at other sites where I input and save text, Firefox is replacing double quotes with single quotes when I save. It's also showing double quotes as single quotes on websites. I tried uninstalling and reinstalling, and it's still happen

  • Cannot install???

    I wiped my computer and reloaded Windows 7 and after I downloaded iTunes64Setup.exe the installer displays the message: "iTunes Installer completed.  Errors occurred during installation before iTunes could be configured.  Your system has not been mod

  • Number formate should be (5,3) how?

    Hi I want the number formate as (5,3).. for suppose 234578.98746 is there i want it as 23457.987 using trunc fucntion i can trunc the fraction part. but what about integer part? how to trunc one at a time select trunc(234578.9874,3) from dual 234578.

  • Doubts in CREATION  OF 'PB'  INFOTYPE

    hi i created infotype but while executing this in pb30 it is showing the error like..... """"""P9030" must be a flat structure. You cannot use internal tables,          strings, references, or structures as components"""""""". now how can i procede,