Im trying to import a database from a dump into oracle, and once the import has completed, I'd like to make some changes to that data. What would be best way to accomplish this? The script below will import the dump file and remap the schema, but the job seems to fork and the changes try to run before the datapump completes. I am an Oracle novice, trying to run this on Oracle SE database. Thanks in advance for all advise/pointers.
begin
declare
h1 NUMBER;
h1_status varchar2(200);
begin
h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'FULL', job_name => 'COPYBACK_IMPORT', version => 'COMPATIBLE');
dbms_datapump.add_file(handle => h1, filename => 'COPYBACK.LOG', directory => 'DATA_PUMP_DIR', filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
dbms_datapump.add_file(handle => h1, filename => 'COPYBACK.LOG', directory => 'DATA_PUMP_DIR', filetype => 3);
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0);
dbms_datapump.add_file(handle => h1, filename => 'SOME_DB_DUMP.dmp', directory => 'DATA_PUMP_DIR', filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
dbms_datapump.metadata_remap(handle => h1, name => 'REMAP_TABLESPACE', old_value => 'SOME_TS', value => 'USERS');
dbms_datapump.metadata_remap(handle => h1, name => 'REMAP_SCHEMA', old_value => 'SOMETHING', value => 'DBADMIN');
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
dbms_datapump.set_parameter(handle => h1, name => 'REUSE_DATAFILES', value => 0);
dbms_datapump.set_parameter(handle => h1, name => 'TABLE_EXISTS_ACTION', value => 'REPLACE');
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
dbms_datapump.wait_for_job(handle => h1, job_state => h1_status);
dbms_datapump.detach(handle => h1);
end;
begin
update DBADMIN.users set passwd = 'new_passwd', p_passwordencoding = 'plain' where p_uid = 'some_user';
delete from DBADMIN.props where name='system.locked';
end;
end;
/