Extracting data from a specific period

Extracting data from a specific period

In a data warehouse environment what is the best way to extract data for a specific period and populate to another database? I don't want the entire schema or full database, only a few tables with one month's data and respective table views and indexes.

    Requires Free Membership to View

    By submitting your registration information to SearchOracle.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchOracle.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

The Oracle export utility and Data Pump (if using 10g) both support the WHERE clause which can be applied to filter out rows of data. Suppose you have a table called ORDER_DETAILS and you only want those order details that are less than 30 days old. You can use the export utility as follows to export only those rows:
exp userid=system file=order_details.dmp tables=order_details 
where='detail_date between sysdate-30 and sysdate' 
When you run this export, the WHERE clause will be applied to the query that pulls records from the table. If more than one table is specified in the export utility, the WHERE clause is applied to all tables. So you may have to create different dump files for different tables depending on the WHERE clause you need for each table. Once you have the dump file(s), you can then import those records into your destination database.

This was first published in February 2007

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.