The steps I did to copy schema's content from schema user_a
to schema user_b
in Oracle:
DBMS is located inside an Oracle Linux Server container.
let's assume the schemas are defined like that:
create user user_a identified by user_a_pass default tablespace tablespace_a;
grant
create materialized view,
create procedure,
create sequence,
create session,
create table,
create type,
create trigger,
create view to user_a;
create user user_b identified by user_b_pass default tablespace tablespace_a;
grant
create materialized view,
create procedure,
create sequence,
create session,
create table,
create type,
create trigger,
create view to user_b;
The important point here: the schemas have access to the same tablespace and have create session privilege.
in order to copy, data schemas' directory are required:
check granted directory:
select tp.grantee, tp.table_name from all_tab_privs tp where tp.privilege = 'WRITE' and tp.type = 'DIRECTORY';
check that the directory's path phisically exists and a group dba
has an access to that.
if directory is not assigned to the schema user, do that:
create or replace directory user_dir as '/opt/oracle/product/19c/dbhome_1/user_dir_name';
grant read, write on directory user_dir to user_a;
grant read, write on directory user_dir to user_b;
run export:
expdp user_a/user_a_pass@host/database schemas=user_a directory=user_dir dumpfile=user_a.dmp logfile=schema_exp.log
run import:
impdp user_b/user_b_pass@host/database directory=user_dir dumpfile=user_a.dmp logfile=schema_imp.log remap_schema=user_a:user_b