Schema Refresh:
Step 1>> check the presteps on source and target
select name from v$database;
select distinct owner from dba_segments where owner like 'owner_name';
select sum(bytes)/1024/1024/1024 from dba_segments where owner like 'owner_name';
SELECT COUNT(*) FROM DBA_segments WHERE OWNER='owner_name';
SELECT COUNT(*) FROM DBA_OBJECTS WHERE OWNER='owner_name';
select segment_type,tablespace_name,count(*) from dba_segments where owner='owner_name' group by segment_type,tablespace_name;
Select constraint_type,status,count(*) from dba_constraints where owner='owner_name' group by constraint_type,status;
select owner ,object_type,status, count(*) from dba_objects where owner='owner_name' group by owner, object_type, status;
Step 2>>
Take the export or backup of schema on both source and target
exp file=exp_xxx.dmp log=exp_xxxx.log owner=schema_name compress=n consistent=y buffer=10240000
(or)
expdp dumpfile=expdp_xxx.dmp logfile=expdp_xxx.log directory=xxxx schemas=xxxx,xxxx
Step 3>>
Now drop the objects on target:
select 'drop table schema_name.'||table_name||' cascade constraints;' from dba_tables where owner='schema_name';
select 'drop '||object_type||' schema_name."'||object_name||'";' from dba_objects where owner='schema_name';
if it is 10g
select 'purge table schema_name.'||table_name||' cascade constraints;' from dba_tables where owner='schema_name';
select 'purge '||object_type||' schema_name."'||object_name||'" ;' from dba_objects where owner='schema_name';
select 'purge table '||owner||'."'||object_name||'";' FROM dba_RECYCLEBIN where owner='schema_name';
Step 4>>>
Now proceed with import on target:
imp file=exp_xxx.dmp log=exp_xxxx.log owner=schema_name consistent=y buffer=10240000 fromuser=xxx touser=xxxx
(or)
impdp dumpfile=expdp_xxx.dmp logfile=expdp_xxx.log directory=xxxx schemas=xxxx,xxxx
Step 1>> check the presteps on source and target
select name from v$database;
select distinct owner from dba_segments where owner like 'owner_name';
select sum(bytes)/1024/1024/1024 from dba_segments where owner like 'owner_name';
SELECT COUNT(*) FROM DBA_segments WHERE OWNER='owner_name';
SELECT COUNT(*) FROM DBA_OBJECTS WHERE OWNER='owner_name';
select segment_type,tablespace_name,count(*) from dba_segments where owner='owner_name' group by segment_type,tablespace_name;
Select constraint_type,status,count(*) from dba_constraints where owner='owner_name' group by constraint_type,status;
select owner ,object_type,status, count(*) from dba_objects where owner='owner_name' group by owner, object_type, status;
Step 2>>
Take the export or backup of schema on both source and target
exp file=exp_xxx.dmp log=exp_xxxx.log owner=schema_name compress=n consistent=y buffer=10240000
(or)
expdp dumpfile=expdp_xxx.dmp logfile=expdp_xxx.log directory=xxxx schemas=xxxx,xxxx
Step 3>>
Now drop the objects on target:
select 'drop table schema_name.'||table_name||' cascade constraints;' from dba_tables where owner='schema_name';
select 'drop '||object_type||' schema_name."'||object_name||'";' from dba_objects where owner='schema_name';
if it is 10g
select 'purge table schema_name.'||table_name||' cascade constraints;' from dba_tables where owner='schema_name';
select 'purge '||object_type||' schema_name."'||object_name||'" ;' from dba_objects where owner='schema_name';
select 'purge table '||owner||'."'||object_name||'";' FROM dba_RECYCLEBIN where owner='schema_name';
Step 4>>>
Now proceed with import on target:
imp file=exp_xxx.dmp log=exp_xxxx.log owner=schema_name consistent=y buffer=10240000 fromuser=xxx touser=xxxx
(or)
impdp dumpfile=expdp_xxx.dmp logfile=expdp_xxx.log directory=xxxx schemas=xxxx,xxxx
0 comments:
Post a Comment