Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Archiving data

Re: Archiving data

From: Ron Rogers <RROGERS_at_galottery.org>
Date: Fri, 31 Aug 2001 05:16:15 -0700
Message-ID: <F001.0037EEA0.20010831051646@fatcity.com>

Ravindra,
That is basically what I do each 6 months for 6 large tables. I created a function that will insert the rows into an existing table and commit after so many rows. Then I use a script to delete the rows from the original table by date range and commit after each range specified.
It works great as I have about 1.6 GIG in the largest table and that one takes the better part of the day. The limiting factor is the size of the archivelog storage space 4 GIG so I have to watch it constantly and more the logs of to a different location.
Listed below is an example of my function to insert rows...



declare
i number :=0;

cursor c1 is

select  RETNBR ,                
 SALEDATE      ,         
 GAMECODE      ,         
 ORDERAMT      ,         
 CONFIRMATIONAMT,        
 ACTIVATIONAMT  ,        
 SETTLEMENTAMT  ,        
 RETURNAMT      ,        
 CASHAMT        ,        
 SALESCOMMAMT   ,        
 CASHBONUSAMT   ,        
 TOTCOMMAMT              
 from glcIDsr_curr
 WHERE SALEDATE between '06-01-2001' and '06-30-2001';                  
         
IDSR_UPDATE  C1%ROWTYPE; 
                  
begin                                    
 open c1 ;                                 
 loop                                          
fetch c1 into IDSR_UPDATE ;                 
 exit when c1%NOTFOUND  ;                 
 insert into GLCIDSR_HIST01          
 values(IDSR_UPDATE.RETNBR,                 
 IDSR_UPDATE.SALEDATE,               
 IDSR_UPDATE.GAMECODE,               
 IDSR_UPDATE.ORDERAMT,               
 IDSR_UPDATE.CONFIRMATIONAMT,        
 IDSR_UPDATE.ACTIVATIONAMT,          
 IDSR_UPDATE.SETTLEMENTAMT,          
 IDSR_UPDATE.RETURNAMT,              
 IDSR_UPDATE.CASHAMT,                
 IDSR_UPDATE.SALESCOMMAMT,           
 IDSR_UPDATE.CASHBONUSAMT,           

 IDSR_UPDATE.TOTCOMMAMT);
i := i + 1;
if i > 200000

   then

     commit; 
     i := 0;

   end if;
end loop;
commit;
close c1;
end;

After the deletions are complete I export the remaining data and truncate the table and then import the data to clean up the tablespace. ROR mm

>>> ravindra_at_sentica.com 08/30/01 07:07PM >>>
I have few tables that will be getting populated with transaction data continuously.This table
grows to large size.For us once the transaction is completed we don't need the data to be in the database,
but we cannot delete them either.We need to archive those records and clear those archived records
from the table.Like out of the 3million records I want to keep this months records and archive the
remaining.There are few set of tables which needs to be archived and they are all related.

I can think of creating a new table and populating the table with records that needs to be archived and
after this those records can be deleted.Ex

create table T1 as select * from <tablename> where id < xxxx;

What is the best way of doing this.

Thanks
Ravindra

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com 
-- 
Author: Ravindra Basavaraja
  INET: ravindra_at_sentica.com 

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Ron Rogers
  INET: RROGERS_at_galottery.org

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Aug 31 2001 - 07:16:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US