0% found this document useful (0 votes)
100 views

Datapump Scripts

The document provides instructions for using Oracle's Data Pump utilities - expdp and impdp - to export and import database objects like tables, schemas, and tablespaces. It describes various parameters that can be used with expdp and impdp like TABLES, DUMPFILE, LOGFILE, REMAP_SCHEMA, and ATTACH to control what is exported or imported, specify file names, and resume import jobs. It also provides examples of using expdp and impdp on the command line and via parameter files to export and import tables, schemas, and transportable tablespaces between databases.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Datapump Scripts

The document provides instructions for using Oracle's Data Pump utilities - expdp and impdp - to export and import database objects like tables, schemas, and tablespaces. It describes various parameters that can be used with expdp and impdp like TABLES, DUMPFILE, LOGFILE, REMAP_SCHEMA, and ATTACH to control what is exported or imported, specify file names, and resume import jobs. It also provides examples of using expdp and impdp on the command line and via parameter files to export and import tables, schemas, and transportable tablespaces between databases.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Datapump:
================================================================================
===============================
export table;
expdp system/sys@orcl tables=ggg.sample directory=datapump dumpfile=sample.dmp l
ogfile=expdpsample.log
impdp system/sys@orcl tables=sample REMAP_SCHEMA=ggg:hhh directory=datapump dum
pfile=sample.dmp logfile=impdpsample.log
CREATE OR REPLACE DIRECTORY datapump AS 'C:\Documents and Settings\narasimha\dat
apump';
GRANT READ, WRITE ON DIRECTORY datapump TO sys;
===============================================================================
===========================
Datapump:
=========
impdb sample.par
username:
pwd:
import>stop_job
sample.par
DIRECTORY=TEST_DIR1
DUMPFILE=RTMSGLD3_RP1D1_25Aug.dmp
LOGFILE=Imp_RTMSGLD3_RP1D1_25Aug.log
REMAP_SCHEMA=RTMSGLD3:RTMSGLS1
REMAP_TABLESPACE=USERS:RTMSGLS1DAT
REMAP_TABLESPACE=SYSTEM:RTMSGLS1DAT
REMAP_TABLESPACE=RTMSGLD3IND:RTMSGLS1IND
exp file=/oracle/thes1d.dmp log=/oracle/exp/thes1d.log buffer=10000000 owner=th
es1
dba_admin
Pwd:taut0l0gy

imp file=/oracle/thes1.dmp log=/oracle/thes1.log fromuser=THES1 touser=THES1 bu
ffer=10000000

dba_admin
Pwd:taut0l0gy
select count(*) from dba_objects where owner='THES1';
select status,OBJECT_NAME ,OBJECT_TYPE from dba_objects where owner='THES1' and
status='INVALID';
expdp <userid/password> file=empdept.dmp tables=(EMP,DEPT) log=empdept.log
impdp <userid/password> file=empdept.dmp log=empdept.log
tar file sample:
oracle@sacux131 # more imp.par
JOB_NAME=DM_IMP
DIRECTORY=DATA_PUMP_DIR
DUMPFILE=exp_BW_USER_FLEX_GDM.dmp
LOGFILE=DM_IMP.log
=================================================
oracle@sacux131 # more imp_user.par
DIRECTORY=DATA_PUMP_DIR
DUMPFILE=exp_user.dmp
REMAP_SCHEMA=bw_user:bw_user_dev
REMAP_SCHEMA=flex_gdm:flex_gdm_dev
LOGFILE=imp_user.log
================================================
oracle@sacux131 # more exp_metadata.par
DIRECTORY=DATA_PUMP_DIR
DUMPFILE=exp_metadata.dmp
schemas=BW_USER,FLEX_GDM
content=metadata_only
LOGFILE=exp_metadata.log
==============================================
Import> STOP_JOB=IMMEDIATE
Are you sure you wish to stop this job ([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 c
lient 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
$impdp hr/hr@mydb ATTACH=myfulljob
After the job status is displayed, he can issue the CONTINUE_CLIENT command to r
esume logging mode and restart the myfulljob job.
Import> CONTINUE_CLIENT
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_JO
B, if he doesnt want to continue with the import job.
http://www.oracle-dba-online.com/data_pump_import_utility.htm
=======================================================
Determine Transportability dbms_tts.transport_set_check(
tablespace_name IN VARCHAR2, TRUE);
dbms_tts.transport_set_check('uwdata', TRUE);
View Violations; If Any SELECT * FROM TRANSPORT_SET_VIOLATIONS;
Generate A Transportable Set ALTER TABLESPACE <tablespace_name> READ ONLY;
ALTER TABLESPACE tools READ ONLY;
Export Tablespace
Although the Export utility is used, only data dictionary structural information
(metadata) for the tablespaces is exported. EXP TRANSPORT_TABLESPACE=Y
TABLESPACES=(<comma_delimited_list_of_tablespaces>)
TRIGGERS=Y CONSTRAINTS=N GRANTS=N FILE=<file_name>
EXP TRANSPORT_TABLESPACE=y TABLESPACES=(sales_1,sales_2)
TRIGGERS=y CONSTRAINTS=n GRANTS=n FILE=expdat.dmp
Import Tablespace IMP TRANSPORT_TABLESPACE=<Y | N> FILE=<file_name>
DATAFILES=('<comma_delimited_list_of_data_files>)
TABLESPACES=(<comma_delimited_list_of_tablespaces>)
TTS_OWNERS=(<comma_delimited_list_of_schema_owners>)
FROMUSER=(dcranney,jfee) TOUSER=(smith,williams)
IMP TRANSPORT_TABLESPACE=y FILE=expdat.dmp
DATAFILES=('/db/sales_jan','/db/sales_feb')
TABLESPACES=(sales_1,sales_2) TTS_OWNERS=(dcranney,jfee)
FROMUSER=(dcranney,jfee) TOUSER=(smith,williams)
Import Parameter File TRANSPORT_TABLESPACE=y
FILE=expdat.dmp
DATAFILES=('/db/sales_jan','/db/sales_feb')
TABLESPACES=(sales_1, sales_2)
TTS_OWNERS=(dcranney, jfee)
FROMUSER=(dcranney, jfee)
TOUSER=(smith, williams
================================================================================
exp
# create a name pipe
mknod export_pipe p

gzip < export.pipe > EXP_SUM_PO_RECEIPTS.dmp.gz &
exp file=export.pipe log=EXP_SUM_PO_RECEIPTS_MDR_COMPANY_ZONES.log TABLES=MDSSRU
N.SUM_PO_RECEIPTS

IMP
# create a name pipe
mknod imp_pipe p
# read the zip file and output to pipe
gunzip < EXP_SUM_PO_RECEIPTS.dmp.gz > imp_pipe &
# feed the pipe
imp file=imp_pipe log=imp_pipe.log INDEXFILE=index.log fromuser=MDSSRUN touser=M
DSSRUN

imp file=imp_pipe log=dswp175_TRX_BASE_imp.log fromuser=dswp175 touser=dswp175 t
ables=DC_DST_UNIT_DATA_COLLECTION,TRX_BASE

You might also like