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