Oracle 迁移 序列

---删除序列
select 'drop sequence ' || sequence_owner || '.' || SEQUENCE_NAME || ';'
from dba_sequences
where sequence_owner IN ('AMS', 'AIS')

---序列当前值

select 'create sequence ' || sequence_owner || '.' || SEQUENCE_NAME ||
' start with ' || LAST_NUMBER || ' maxvalue ' || MAX_VALUE ||
' minvalue ' || MIN_VALUE || ' increment by ' || INCREMENT_BY ||
' cache ' || CACHE_SIZE || ' ' ||
decode(CYCLE_FLAG, 'N', 'NOCYCLE', 'CYCLE') || ' ' ||
decode(ORDER_FLAG, 'N', 'NOORDER', 'ORDER') || ' ;'
from dba_sequences
where sequence_owner IN ('AMS', 'AIS')
and cache_size != 0



 

select 'create sequence ' || sequence_owner || '.' || SEQUENCE_NAME ||
' start with ' || LAST_NUMBER || ' maxvalue ' || MAX_VALUE ||
' minvalue ' || MIN_VALUE || ' increment by ' || INCREMENT_BY ||
' cache ' || CACHE_SIZE || ' ' ||
decode(CYCLE_FLAG, 'N', 'NOCYCLE', 'CYCLE') || ' ' ||
decode(ORDER_FLAG, 'N', 'NOORDER', 'ORDER') || ' ;'
from dba_sequences 
where sequence_owner IN ('AMS', 'AIS')
and cache_size != 0

posted @ 2019-04-04 13:47  钱若梨花落  阅读(790)  评论(0编辑  收藏  举报