0
点赞
收藏
分享

微信扫一扫

大库迁移#5回退

"将源库用户unlock;

查询用户状态

" "

alter user xxx account unlock;



set lines 300

select USERNAME,ACCOUNT_STATUS,CREATED,DEFAULT_TABLESPACE,TEMPORARY_TABLESPACE  from dba_users  

 where USERNAME in ('username'

) order by 3;

select 'alter table '||owner||'.'||table_name||' enable constraint '|| CONSTRAINT_NAME||';' from dba_constraints where CONSTRAINT_TYPE='R' and owner in('username');

"

将源库外键enable "

alter table xx.xxx enable constraint FK_PC_xxx;


"

"将源库用户unlock;

查询用户状态

" "

alter user xxx account unlock;



set lines 300

select USERNAME,ACCOUNT_STATUS,CREATED,DEFAULT_TABLESPACE,TEMPORARY_TABLESPACE  from dba_users  

 where USERNAME in ('username'

) order by 3;

select 'alter table '||owner||'.'||table_name||' enable constraint '|| CONSTRAINT_NAME||';' from dba_constraints where CONSTRAINT_TYPE='R' and owner in('username');


"

将源库外键enable "

alter table xxx.xx enable constraint FK_PC_xx_SE;


"

比对对象 "对比目标端有源端没有的对象或者对象状态不一样

select owner,object_type,object_name,status from dba_objects where owner in ('username')

minus

select owner,object_type,object_name,status from dba_objects@TO_CFR where owner in ('username');


对比源端有目标端没有的对象或者对象状态不一样

select owner,object_type,object_name,status from dba_objects@TO_CFR where owner in ('username')

minus

select owner,object_type,object_name,status from dba_objects where owner in ('username');


select owner,object_name,object_type from dba_objects where to_char(created,'yyyymmdd')>'20230701' or to_char(last_ddl_time,'yyyymmdd') >'20230701';

"

重建序列 "

select SEQUENCE_OWNER,count(*) from dba_sequences where SEQUENCE_OWNER in  ('username')

group by SEQUENCE_OWNER

order by 2 desc;

SEQUENCE_OWNER

----------  
 PICCOPR COUNT(*)

----------  
       214

select 'drop sequence '||SEQUENCE_OWNER||'.'||SEQUENCE_NAME||';' from dba_sequences where SEQUENCE_OWNER in ('username');

"

目标序列导入到源端 "

expdp system/*******  dumpfile=20230609_seq.dmp directory=dmp logfile=20230609_seq.log schemas=username  include=sequence


导入序列

impdp system/******* directory=DMP dumpfile=20230609_seq.dmp logfile=20230609_imp_seq.log

 

select SEQUENCE_OWNER,count(*) from dba_sequences where SEQUENCE_OWNER in  ('username')

group by SEQUENCE_OWNER

order by 2 desc;

SEQUENCE_OWNER

----------  
 PICCOPR COUNT(*)

----------  
       214

"

举报

相关推荐

0 条评论