DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Oracle (http://www.daniweb.com/forums/forum129.html)
-   -   Limit days stored in DB (http://www.daniweb.com/forums/thread180245.html)

vimotaru Mar 6th, 2009 8:47 am
Limit days stored in DB
 
Hello everybody

My problem is that I'm quite new in oracle admin/dev so I need some help pointing me how to limit the number of days of data stored in a table.
I have some datasources that come in files periodically. I'd like to limit the days stored for each table.

My system is Oracle 10g over Solaris 10.

I though in partitions, but I don't know how to refresh date in them to limit data to 'last 5 days' for example.

Please, if you have some link, example or doc it would be great. I don't know what to search in google to solve this... :S

Thanks in advance.

debasisdas Mar 9th, 2009 3:02 am
Re: Limit days stored in DB
 
The simplest method will be create a view based on the table with last five days record. That will be always refreshed every time you run any query on the view.

vimotaru Mar 9th, 2009 5:49 am
Re: Limit days stored in DB
 
But that doesn't limit the amount of space occupied by the main table. I'd like the disk space remain limited by the number of days and avoiding reject records by not enough space error.

Thanks!!

debasisdas Mar 9th, 2009 8:59 am
Re: Limit days stored in DB
 
then you need to populate records from the source to a staging (intermediate) table before actually inserting them to your main table.

so with each load you need to truncate your table and load only the required records.

vimotaru Mar 9th, 2009 9:14 am
Re: Limit days stored in DB
 
Thanks for the quick response. I'm developing a PL/SQL for doing that over a staging table.

I think is the best way to control the data loaded and del the old data.

Thanks!!


All times are GMT -4. The time now is 3:11 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC