drop users
if you are doing a refresh it is possible users already present in database. so drop them before importing
select 'drop user '||username||' cascade;' from dba_users
where username not in ('ANONYMOUS'
,'APEX_040200'
,'APEX_PUBLIC_USER'
,'APPQOSSYS'
,'AUDSYS'
,'BI'
,'CTXSYS'
,'DBSNMP'
,'DIP'
,'DVF'
,'DVSYS'
,'EXFSYS'
,'FLOWS_FILES'
,'GSMADMIN_INTERNAL'
,'GSMCATUSER'
,'GSMUSER'
,'HR'
,'IX'
,'LBACSYS'
,'MDDATA'
,'MDSYS'
,'OE'
,'ORACLE_OCM'
,'ORDDATA'
,'ORDPLUGINS'
,'ORDSYS'
,'OUTLN'
,'PM'
,'SCOTT'
,'SH'
,'SI_INFORMTN_SCHEMA'
,'SPATIAL_CSW_ADMIN_USR'
,'SPATIAL_WFS_ADMIN_USR'
,'SYS'
,'SYSBACKUP'
,'SYSDG'
,'SYSKM'
,'SYSTEM'
,'WMSYS'
,'XDB'
,'SYSMAN'
,'RMAN'
,'RMAN_BACKUP'
,'OWBSYS'
,'OWBSYS_AUDIT'
,'APEX_030200'
,'MGMT_VIEW'
,'OJVMSYS'
,'XS$NULL','IMPERVA','SYS$UMF')
order by username;
import without constarint, index, statistics and password_history
impdp_TROY.par
userid="/ as sysdba"
directory=TROY_DUMP
dumpfile=expdp_TROY_oel6-node04_23jul2020_%U.dmp
logfile=DATA_PUMP_DIR:impdp_TROY_oel6-node04_23jul2020.log
PARALLEL=12
job_name=impdp_TROY
full=y
exclude=statistics
EXCLUDE=PASSWORD_HISTORY
exclude=INDEX,CONSTRAINT
impdp_TROY.ksh
impdp parfile=impdp_TROY.par
generate sql file for index and constarints
while running index creation script make sure you set ORACLE_SID of target db where you want to import. this will only generate a sql file
userid="/ as sysdba"
directory=TROY_DUMP
dumpfile=expdp_TROY_oel6-node04_23jul2020_%U.dmp
logfile=DATA_PUMP_DIR:index_constraint_TROY_18Jul2020.log
sqlfile=DATA_PUMP_DIR:index_constraint_TROY_18Jul2020.sql
include=INDEX,CONSTRAINT
modify the sqlfile to use parallel 12. open the sql file press : and then
%s/PARALLEL 1/PARALLEL 12/g
add below to note timings
select name from v$database;
SELECT SYSTIMESTAMP FROM DUAL;
at the end of script add this
SELECT SYSTIMESTAMP FROM DUAL;
exit;
run index and constarint generation script
nohup sqlplus '/ as sysdba' @index_constraint_TROY_18Jul2020.sql > index_constraint_TROY_18Jul2020.out &