vendredi 9 janvier 2015

Various types of exp/imp expdp/impdp invocations

Use sysdba to exp/imp

  • imp '"sys/password as sysdba"' file=file.dmp ignore=yes full=y commit=y
  • exp '"sys/password as sysdba"' file=file.dmp  full=y log=file.lst

Export/import on network

  • export FIC=testimp.$1.$$
  • export FIC_PIPE=$FIC.pipe
  • export FIC_LOG=$FIC.log
  • export FIC_LOG_EXP=$FIC.log
  • /usr/sbin/mknod  $FIC_PIPE p
  • imp system/xxx@tttt fromuser=$1 touser=$1 log=$FIC_LOG file=$FIC_PIPE &
  • exp system/xxxxx file=$FIC_PIPE log=${FIC_LOG_EXP} owner=$1 


DataPump in pl/sql sample


declare
  h1   NUMBER;
begin
     h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'SCHEMA', job_name => 'IMPORT004306', version => 'COMPATIBLE'); 
    dbms_datapump.set_parallel(handle => h1, degree => 3); 
    dbms_datapump.add_file(handle => h1, filename => 'imp_infocom.LOG', directory => 'MYN_DIR', filetype => 3); 
    dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0); 
    dbms_datapump.add_file(handle => h1, filename => 'export_%U.dmp', directory => 'MYN_DIR', filetype => 1); 
    dbms_datapump.metadata_remap(handle => h1, name => 'USER1', old_value => 'USER2', value => 'COFACC_ATLAS'); 
    dbms_datapump.metadata_remap(handle => h1, name => 'REMAP_TABLESPACE', old_value => 'TBS', value => 'TBS2'); 
    dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''USER1'')'); 
    dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC'); 
    dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1); 
    dbms_datapump.set_parameter(handle => h1, name => 'SKIP_UNUSABLE_INDEXES', value => 0); 
    dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0); 
    dbms_datapump.detach(handle => h1); 
end;
/

Aucun commentaire:

Enregistrer un commentaire