Вы находитесь на странице: 1из 3

8/9/13

Using Oracle 10g DATA PUMP Utility

Oracle DBA Learn Oracle 11g Database Admin step by step

DATA PUMP Utility


Oracle Database Administration Learn Oracle 11g database administration step by step Oracle DBA Interview Questions Frequently asked Oracle DBA Interview Questions Download Oracle 11g Software Links for downloading Oracle 11g software Installation guides for installing Oracle under Linux, Solaris

Oracle SQL Tutorial for Oracle SQL

Oracle DBA Interview Questions Most asked Oracle DBA Interview Questions.
Technical 60 Questions Backup & Recovery 42 Questions Unix For Oracle DBA 20 Questions

Download Oracle 11g Software Links to Download Oracle 11g for Linux, Windows etc.

Starting with Oracle 10g, Oracle has introduced an enhanced version of EXPORT and IMPORT utility known as DATA PUMP. Data Pump is similar to EXPORT and IMPORT utility but it has many advantages. Some of the advantages are: Most Data Pump export and import operations occur on the Oracle database server. i.e. all the dump files are created in the server even if you run the Data Pump utility from client machine. This results in increased performance because data is not transferred through network.

You can Stop and Re-Start export and import jobs. This is particularly useful if you have started an export or import job and after some time you want to do some other urgent work.

The ability to detach from and reattach to long-running jobs without affecting the job itself. This allows DBAs and other operations personnel to monitor jobs from multiple locations.

The ability to estimate how much space an export job would consume, without actually performing the export

Support for an interactive-command mode that allows monitoring of and interaction with ongoing jobs

Using Data Pump Export Utility


To Use Data Pump, DBA has to create a directory in Server Machine and create a Directory Object in the database mapping to the directory created in the file system. The following example creates a directory in the filesystem and creates a directory object in the database and grants privileges on the Directory Object to the SCOTT user. $ m k d i rm y _ d u m p _ d i r $ s q l p l u s E n t e rU s e r : /a ss y s d b a S Q L > c r e a t ed i r e c t o r yd a t a _ p u m p _ d i ra s / u 0 1 / o r a c l e / m y _ d u m p _ d i r ; Now grant access on this directory object to SCOTT user S Q L >g r a n tr e a d , w r i t eo nd i r e c t o r yd a t a _ p u m p _ d i rt os c o t t ;
www.oracle-dba-online.com/data_pump_utility.htm 1/3

8/9/13

Using Oracle 10g DATA PUMP Utility

Example of Exporting a Full Database


To Export Full Database, give the following command $ e x p d p s c o t t / t i g e rF U L L = yD I R E C T O R Y = d a t a _ p u m p _ d i rD U M P F I L E = f u l l . d m p L O G F I L E = m y f u l l e x p . l o gJ O B _ N A M E = m y f u l l J o b The above command will export the full database and it will create the dump file full.dmp in the directory on the server /u01/oracle/my_dump_dir In some cases where the Database is in Terabytes the above command will not feasible since the dump file size will be larger than the operating system limit, and hence export will fail. In this situation you can create multiple dump files by typing the following command $ e x p d p s c o t t / t i g e rF U L L = yD I R E C T O R Y = d a t a _ p u m p _ d i rD U M P F I L E = f u l l % U . d m p F I L E S I Z E = 5 G L O G F I L E = m y f u l l e x p . l o gJ O B _ N A M E = m y f u l l J o b This will create multiple dump files named full01.dmp, full02.dmp, full03.dmp and so on. The FILESIZE parameter specifies how much larger the dump file should be.

Example of Exporting a Schema


To export all the objects of SCOTTS schema you can run the following export data pump command. $ e x p d ps c o t t / t i g e rD I R E C T O R Y = d a t a _ p u m p _ d i rD U M P F I L E = s c o t t _ s c h e m a . d m p S C H E M A S = S C O T T You can omit SCHEMAS since the default mode of Data Pump export is SCHEMAS only. If you want to export objects of multiple schemas you can specify the following command $ e x p d ps c o t t / t i g e rD I R E C T O R Y = d a t a _ p u m p _ d i rD U M P F I L E = s c o t t _ s c h e m a . d m p S C H E M A S = S C O T T , H R , A L I

Exporting Individual Tables using Data Pump Export


You can use Data Pump Export utility to export individual tables. The following example shows the syntax to export tables
$ e x p d ph r / h rD I R E C T O R Y = d p u m p _ d i r 1D U M P F I L E = t a b l e s . d m p T A B L E S = e m p l o y e e s , j o b s , d e p a r t m e n t s

E x p o r t i n gT a b l e sl o c a t e di naT a b l e s p a c e

If you want to export tables located in a particular tablespace you can type the following command

$ e x p d ph r / h rD I R E C T O R Y = d p u m p _ d i r 1D U M P F I L E = t b s . d m p T A B L E S P A C E S = t b s _ 4 ,t b s _ 5 ,t b s _ 6

The above will export all the objects located in tbs_4,tbs_5,tbs_6

Excluding and Including Objects during Export


You can exclude objects while performing a export by using EXCLUDE option of Data Pump utility. For example you are exporting a schema and dont want to export tables whose name starts with A then you can type the following command $ e x p d ps c o t t / t i g e rD I R E C T O R Y = d a t a _ p u m p _ d i rD U M P F I L E = s c o t t _ s c h e m a . d m p S C H E M A S = S C O T TE X C L U D E = T A B L E : l i k e A % Then all tables in Scotts Schema whose name starts with A will not be exported. Similarly you can also INCLUDE option to only export certain objects like this $ e x p d ps c o t t / t i g e rD I R E C T O R Y = d a t a _ p u m p _ d i rD U M P F I L E = s c o t t _ s c h e m a . d m p S C H E M A S = S C O T TI N C L U D E = T A B L E : l i k e A % This is opposite of EXCLUDE option i.e. it will export only those tables of Scotts schema whose name starts with A Similarly you can also exclude INDEXES, CONSTRAINTS, GRANTS, USER, SCHEMA

Using Query to Filter Rows during Export


You can use QUERY option to export only required rows. For Example, the following will export only those rows of employees tables whose salary is above 10000 and whose dept id is 10.
www.oracle-dba-online.com/data_pump_utility.htm 2/3

8/9/13

Using Oracle 10g DATA PUMP Utility


e x p d ph r / h rQ U E R Y = e m p : ' " W H E R Ed e p t _ i d>1 0A N Ds a l>1 0 0 0 0 " ' N O L O G F I L E = yD I R E C T O R Y = d p u m p _ d i r 1D U M P F I L E = e x p 1 . d m p

Suspending and Resuming Export Jobs (Attaching and Re-Attaching to the Jobs)
You can suspend running export jobs and later on resume these jobs or kill these jobs using Data Pump Export. You can start a job in one client machine and then, if because of some work, you can suspend it. Afterwards when your work has been finished you can continue the job from the same client, where you stopped the job, or you can restart the job from another client machine. For Example, suppose a DBA starts a full database export by typing the following command at one client machine CLNT1 by typing the following command $ e x p d ps c o t t / t i g e r @ m y d bF U L L = yD I R E C T O R Y = d a t a _ p u m p _ d i r D U M P F I L E = f u l l . d m pL O G F I L E = m y f u l l e x p . l o gJ O B _ N A M E = m y f u l l J o b After some time, the DBA wants to stop this job temporarily. Then he presses CTRL+C to enter into interactive mode. Then he will get the Export> prompt where he can type interactive commands Now he wants to stop this export job so he will type the following command
E x p o r t >S T O P _ J O B = I M M E D I A T E A r ey o us u r ey o uw i s ht os t o pt h i sj o b( [ y ] / n ) :y

The job is placed in a stopped state and exits the client. After finishing his other work, the DBA wants to resume the export job and the client machine from where he actually started the job is locked because, the user has locked his/her cabin. So now the DBA will go to another client machine and he reattach to the job by typing the following command
$ e x p d ph r / h r @ m y d bA T T A C H = m y f u l l j o b

After the job status is displayed, he can issue the C O N T I N U E _ C L I E N Tcommand to resume logging mode and restart the m y f u l l j o bjob.
E x p o r t >C O N T I N U E _ C L I E N T

A message is displayed that the job has been reopened, and processing status is output to the client. Note: After reattaching to the Job a DBA can also kill the job by typing KILL_JOB, if he doesnt want to continue with the export job.

Search Web www.oracle-dba-online.com

Forms Data Loader: Tool to load data into Oracle Applications using Macros and
Forms Playback Useful Links: The Best Data Conversion Tools Convert MS SQL to MySQL, Convert MS Access to MySQL, Convert MS Access to MSSQL, Convert CSV to MySQL, Convert Foxpro to MySQL, Convert Foxpro to MSSQL, Convert MS Access to Oracle , Convert MSSQL to Oracle, Convert CSV to Oracle

www.oracle-dba-online.com/data_pump_utility.htm

3/3

Вам также может понравиться