Home » RDBMS Server » Server Utilities » How to export data for single employee? (10g)
How to export data for single employee? [message #352582] Wed, 08 October 2008 08:00 Go to next message
McLan
Messages: 36
Registered: April 2008
Member
Quote:
I have special requirement to export all the data from all tables in my database of an particular employee.
I have 4 tables for employee database like emp, empsal, empaddress, empdept.
Emp_no is the common key in all the above tables.

How to achieve exporting all the data from the 4 tables for emp_no=500?
How do I get the dump of all the data from the above 4 tables for emp_no=500?

Regards,
McLan
Re: How to export data for single employee? [message #352595 is a reply to message #352582] Wed, 08 October 2008 09:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
C:\>exp help=y

Export: Release 10.2.0.4.0 - Production on Wed Oct 8 16:29:46 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.



You can let Export prompt you for parameters by entering the EXP
command followed by your username/password:

     Example: EXP SCOTT/TIGER

Or, you can control how Export runs by entering the EXP command followed
by various arguments. To specify parameters, you use keywords:

     Format:  EXP KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
     Example: EXP SCOTT/TIGER GRANTS=Y TABLES=(EMP,DEPT,MGR)
               or TABLES=(T1:P1,T1:P2), if T1 is partitioned table

USERID must be the first parameter on the command line.

Keyword    Description (Default)      Keyword      Description (Default)
--------------------------------------------------------------------------
USERID     username/password          FULL         export entire file (N)
BUFFER     size of data buffer        OWNER        list of owner usernames
FILE       output files (EXPDAT.DMP)  TABLES       list of table names
COMPRESS   import into one extent (Y) RECORDLENGTH length of IO record
GRANTS     export grants (Y)          INCTYPE      incremental export type
INDEXES    export indexes (Y)         RECORD       track incr. export (Y)
DIRECT     direct path (N)            TRIGGERS     export triggers (Y)
LOG        log file of screen output  STATISTICS   analyze objects (ESTIMATE)
ROWS       export data rows (Y)       PARFILE      parameter filename
CONSISTENT cross-table consistency(N) CONSTRAINTS  export constraints (Y)

OBJECT_CONSISTENT    transaction set to read only during object export (N)
FEEDBACK             display progress every x rows (0)
FILESIZE             maximum size of each dump file
FLASHBACK_SCN        SCN used to set session snapshot back to
FLASHBACK_TIME       time used to get the SCN closest to the specified time
QUERY                select clause used to export a subset of a table
RESUMABLE            suspend when a space related error is encountered(N)
RESUMABLE_NAME       text string used to identify resumable statement
RESUMABLE_TIMEOUT    wait time for RESUMABLE
TTS_FULL_CHECK       perform full or partial dependency check for TTS
TABLESPACES          list of tablespaces to export
TRANSPORT_TABLESPACE export transportable tablespace metadata (N)
TEMPLATE             template name which invokes iAS mode export

Export terminated successfully without warnings.

See QUERY option.

Regards
Michel
Re: How to export data for single employee? [message #353595 is a reply to message #352582] Tue, 14 October 2008 05:15 Go to previous messageGo to next message
McLan
Messages: 36
Registered: April 2008
Member
Quote:
Thanks Michel, I tried with exp with query option this is helpful.
This dump is not human readable format, Sorry for not making it clear in my previous post.
What I am looking at the dump file is it should be similar to the dump file generated by toad export, this file contains sql INSERT statements and this is human readable format.

I need to export all the tables of a single employee.

Regards,
McLan
Re: How to export data for single employee? [message #353600 is a reply to message #353595] Tue, 14 October 2008 05:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You have to either use TOAD or create your own program/script to do it.
Oracle does not provide any tool for this.

Regards
Michel
Re: How to export data for single employee? [message #353605 is a reply to message #352582] Tue, 14 October 2008 05:39 Go to previous messageGo to next message
McLan
Messages: 36
Registered: April 2008
Member
Quote:
Thanks Michel, I need to understand how toad populates the data for a single table to a file so that I can write scripts for my requirements.
Any suggestion on how toad works during export of a table?

Regards,
McLan
Re: How to export data for single employee? [message #353617 is a reply to message #353605] Tue, 14 October 2008 06:03 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SQL> select 'insert into emp (empno, ename, sal) values ('||empno||','''||ename||''','||sal||');' q
  2  from emp
  3  where deptno = 10
  4  /
Q
-----------------------------------------------------------------
insert into emp (empno, ename, sal) values (7782,'CLARK',2450);
insert into emp (empno, ename, sal) values (7839,'KING',5000);
insert into emp (empno, ename, sal) values (7934,'MILLER',1300);

3 rows selected.

Regards
Michel
Previous Topic: SQL Loader Question
Next Topic: Data Pump Backup
Goto Forum:
  


Current Time: Tue Dec 24 10:38:01 CST 2024