Thursday, January 14, 2010

simple full export/import of 11g database

The following script will make the nessecary database object for making a full backup set of a oracle 11g database on a windows machine.

log in as sys

create a directory object pointing to the direktory where the backup set is to be created

Create directory expdp_dir as  'C:\Oracle\backupset';

grant the nessecary priviliges to the system user

Grant read,write on directory expdp_dir to system;

finally from the command prompt

expdp system/manager DIRECTORY=expdp_dir DUMPFILE=expfull_DB.dmp FULL=y LOGFILE=expfull_DB.log

thats it!, two files expfull_DB.dmp and expfull_DB.log in the c:\oracle\backupset directory.

if you only want to backup a schema then use the following from the command prompt

C:\>expdp scott/toger DIRECTORY=expdp_dir DUMPFILE=scott_exp.dmp SCHEMAS=scott LOGFILE=scott_imp.log

Importing a backup set i equally simple

from the command prompt

impdp system/manager DIRECTORY=expdp_dir DUMPFILE=expfull_DB.dmp FULL=y LOGFILE=impfull_DB.log

and for a single schema

impdp scott/tiger DIRECTORY=expdp_dir DUMPFILE=scott_exp.dmp
SCHEMAS=scott LOGFILE=scott_imp.log

7 comments:

a said...

Thank you very much. This commands were really useful!!!

Anonymous said...

Thanks for the straight forward how-to

Nkerifac said...

I tried your commands but for the last one(i.e the expdp), I had the following error:
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name EXPDP_DIR is invalid
whereas expdp_dir was created sucessfully.

Anonymous said...

We have a customer with a 2.5TB database - to evaluate the work we need to do - we would like to see a portion of that database (say 20%) of the complete database - all tables? Can this be easily done?

Drew Fyock said...

You must make sure that the directory already exists.
If using 'C:\Oracle\backupset', you must create that directory in the file system first.

Unknown said...

Thanks a lot!

Simple, fast, straight and direct to the point!!

Anonymous said...

i did it and it worked....had to manually create the directory though