Rather, you can dump the contents of all your database tables to seperate files. Tom Kyte has a great stored procedure on his Web site that will dump a table's contents to a Comma Seperated Values (CSV) file, or a text file. Using his code, create the stored procedure "dump_table_to_csv." Once you have the stored procedure, you just need to automate the execution of this procedure for all of your database tables. Sample code to automate execution in this manner might be as follows:
- Spool the SQL statements to a file
- Generate the call to the stored proc for all non-SYS/SYSTEM tables
SELECT 'exec dump_table_to_csv('''||owner||'.'||table_name||''','|| '''/tmp'','''||owner||'_'||table_name||'.txt'');' FROM dba_tables WHERE owner NOT IN ('SYS','SYSTEM'); spool off
- Execute the proc repeatedly
The result should be many text files in your /tmp directory with the contents of each table. You may have to adjust the above script for your specific platform.
Dig Deeper on Oracle database backup and recovery
Related Q&A from Brian Peasland
Oracle expert Brian Peasland answers one reader's question about common pitfalls when connecting Oracle to outside programs. Continue Reading
One reader asks expert Brian Peasland a question about datafile sizes with the Oracle RMAN duplicate 10g command. Continue Reading
Managing parent table-child table relations in Oracle SQL environments is key to efficient programming. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.