01 April, 2015

How to export the dump file for the Oracle database


How to export the dump file for the Oracle database:


Here is the easy and simple instructions and steps in exporting the dump file:
Command is : expdp parfile=export.par
where as my script file contents for export.par as below:

userid=agile/<PASSWORD>
schemas=<schema name>
logfile=EXP_DIR_AGILE:export_from_<SID>_schema.log
dumpfile=EXP_DIR_AGILE:export_from_<SID>_schema.dmp
FLASHBACK_TIME=systimestamp
EXCLUDE=STATISTICS

SQL query to list the DB directories: The database directories for the export can be found from SQL command at ORACLE database as below:

SELECT owner, directory_name, directory_path FROM all_directories; 


If we need to create one , create with the below syntax:
  create directory <DIR> as '<PATH';


make sure to give the grants to the schema user that is going to run to export the schema with sys dba. 

   grant read,write on directory DIR to DSXN_CMS;

More information about uploading the dump file to the Oracle support is available at 
https://support.oracle.com/epmos/faces/DocContentDisplay?_afrLoop=315317654246873&id=1547088.2&_afrWindowMode=0&_adf.ctrl-state=1299xos1m1_388

++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
Alternative method:
export_table.sh script is below: run it like:

csh exp.WEBP_table.csh WEBP traintrack /u01/home/oracle/product/11.2.0/dbhome_1 SKILLS_ASSESSMENT_SUBMISSION

 #!/bin/csh

setenv SID $1
setenv ORACLE_SID $1
setenv OWNERS $2
setenv DATA_PUMP_DIR /u02/exports/$SID
setenv ORACLE_HOME $3
setenv table $4
set now=`date +"%m-%d-%y"`
#export by list of schemas
$ORACLE_HOME/bin/expdp traintrack/h0tsp0t dumpfile=DATA_PUMP_DIR:exp_from_${SID}_${OWNERS}_$table logfile=DATA_PUMP_DIR:exp_from_{$SID}_{$OWNERS}_$table tables=$table

#remove the previous one
#rm $DATA_PUMP_DIR/exp_from_{$SID}_$OWNERS.dmp.gz

#compress it
###gzip $DATA_PUMP_DIR/exp_from_{$SID}_$OWNERS.dmp
###mv /u02/export/DSNPR/exp_from_{$SID}_$OWNER.log /dd890/orabackup/Dev-Test/DataPump/DSNPR/exp_from_{$SID}_{$OWNERS}_$now.log
###mv /u02/export/DSNPR/exp_from_{$SID}_$OWNERS.dmp.gz /dd890/orabackup/Dev-Test/DataPump/DSNPR/exp_from_{$SID}_{$OWNERS}_$now.dmp.gz

###find /dd890/orabackup/Dev-Test/DataPump/DSNPR/exp_from_* -mtime +10 -type f -exec rm "{}" \;



+++++++++++++++++++++++++++++++++++++++++++++++++++++++
 script import_table.sh is below : run it like
csh imp.WEBP_table.csh WEBP traintrack_sfdc /u01/home/oracle/product/11.2.0/dbhome_1 SKILLS_ASSESSMENT_SUBMISSION


#!/bin/csh
setenv SID $1
setenv ORACLE_SID $1
setenv OWNERS $2
setenv DATA_PUMP_DIR /u02/exports/$SID
setenv ORACLE_HOME $3
setenv table $4
set now=`date +"%m-%d-%y"`
#export by list of schemas
####$ORACLE_HOME/bin/impdp rman/cat dumpfile=DATA_PUMP_DIR:exp_from_${SID}_$OWNERS logfile=DATA_PUMP_DIR:imp_from_{$SID}_$OWNERS.log

#$ORACLE_HOME/bin/impdp \'/ AS SYSDBA\' tables=$table dumpfile=DATA_PUMP_DIR:exp_from_WEBP_traintrack_SKILLS_ASSESSMENT_SUBMISSION.dmp logfile=DATA_PUMP_DIR:imp_for_WEBP_traintrack_$table.log remap_schema=traintrack:traintrack_sfdc REMAP_TABLESPACE=traintrack:traintrack_sfdc

$ORACLE_HOME/bin/impdp \'/ AS SYSDBA\' tables="traintrack"."SKILLS_ASSESSMENT_SUBMISSION" dumpfile=DATA_PUMP_DIR:exp_from_WEBP_traintrack_SKILLS_ASSESSMENT_SUBMISSION.dmp logfile=DATA_PUMP_DIR:imp_for_WEBP_traintrack_$table.log remap_schema=traintrack:traintrack_sfdc REMAP_TABLESPACE=traintrack:traintrack_sfdc


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++


for schema:
Export: 
$ORACLE_HOME/bin/expdp traintrack/h0tsp0t dumpfile=DATA_PUMP_DIR:exp_from_${SID}_$OWNERS logfile=DATA_PUMP_DIR:exp_from_{$SID}_$OWNERS flashback_time=\"TO_TIMESTAMP\(TO_CHAR\(SYSDATE,\'YYYY-MM-DD HH24:MI:SS\'\),\'YYYY-MM-DD HH24:MI:SS\'\)\" EXCLUDE=STATISTICS schemas=$OWNERS

Import:
$ORACLE_HOME/bin/impdp \'/ AS SYSDBA\' dumpfile=DATA_PUMP_DIR:exp_from_WEBP_traintrack.dmp logfile=DATA_PUMP_DIR:imp_for_WEBP_traintrack_sfdc.log remap_schema=traintrack:traintrack_sfdc REMAP_TABLESPACE=traintrack:traintrack_sfdc







 

No comments:

Post a Comment