從ORACLE中用語句匯出序列

2021-05-22 00:32:46 字數 741 閱讀 1097

今天從資料庫中匯出幾張表,但發現需要的序列都沒匯出來,於是網上找找方法,發現了如下語句

select

'create sequence username.'|| t.sequence_name || ' minvalue '||min_value||' maxvalue '||max_value||' start with '||last_number||' increment by '||increment_by||' cache '||cache_size||' ;'

from dba_sequences t where sequence_owner='username';

注意語句中的username  第乙個username是你匯入到的資料庫使用者名稱, 第二個username是你所匯出資料庫的使用者名稱注意要大寫

例如從testfrom使用者中匯出序列到testto中

select

'create sequence testto.'|| t.sequence_name || ' minvalue '||min_value||' maxvalue '||max_value||' start with '||last_number||' increment by '||increment_by||' cache '||cache_size||' ;'

from dba_sequences t where sequence_owner='testfrom';

查詢之後倒成文字,然後在到資料庫中執行,重新建立序列 ,問題解決。

從Oracle中匯出SQL語句

b color green size large oracle獲取ddl create table 的幾種常用的方法 size color b 一 可以通過toad plsql develop等第三方工具進行匯出dll操作,用這種辦法的好處在於操作簡單方便,但需要安裝,下面簡單介紹一下用這兩個工具獲...

ORACLE匯出序列

最近遇到oracle匯出序列時有問題 即序列的當前值和資料庫中一些表的id最大值不一致,我們的資料庫表的主鍵是從序列中取的 需要重新匯入序列,發現exp不能單獨匯出序列,由於資料量龐大,所以又不想再導一遍資料。在網上搜尋了一下找到乙個比較好的辦法 第一步 在原資料庫上執行如下語句 select cr...

oracle 常用語句

oracle 產看表空間 select total.name tablespace name free space,total space free space used space,total space from select tablespace name,sum bytes 1024 102...