Home » RDBMS Server » Backup & Recovery » How to can back up some table to dump file
|
|
|
|
|
Re: How to can back up some table to dump file [message #181521 is a reply to message #181509] |
Mon, 10 July 2006 06:52   |
 |
Littlefoot
Messages: 21824 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Demo is here:SQL> spool dept.csv
SQL> select deptno ||','|| dname ||','||loc
2 from dept;
DEPTNO||','||DNAME||','||LOC
---------------------------------------------
10,ACCOUNTING,NEW YORK
20,RESEARCH,DALLAS
30,SALES,CHICAGO
40,OPERATIONS,BOSTON
SQL> spool off; It would, of course, be stupid to write such a code for ALL tables you have. Automated process could be done using a PL/SQL block which would loop through all tables and, knowing columns from the data dictionary, dynamically create a SELECT statement; UTL_FILE package would then be used to write data into the .csv file.
However, I prefer simple EXPORT and IMPORT utilities.
|
|
|
Re: How to can back up some table to dump file [message #181538 is a reply to message #181521] |
Mon, 10 July 2006 07:58  |
nghiant
Messages: 38 Registered: July 2006 Location: Viet Nam
|
Member |
|
|
Thank for comment.
I have a new request. When using third software, I see we can save file in csv file as:
deptno, dname, loc
10,ACCOUNTING,NEW YORK
20,RESEARCH,DALLAS
30,SALES,CHICAGO
40,OPERATIONS,BOSTON
However spool statement will return result not beautiful, it still some reduntant text as
"select deptno ||','|| dname ||','||loc from dept;".
Perhaps using only sql statement to do this task /?
|
|
|
Goto Forum:
Current Time: Thu Jun 05 11:21:09 CDT 2025
|