對序列進行遷移時產生間斷的原因
我們知道建立序列時,會有預設的或者指定的 n個值會cache到記憶體中,當資料庫所在的伺服器down 機或者遷移序列時,會發生序列丟失的問題。現在就第二種進行實驗。這裡並沒有什麼方法可以解決序列 間隔的問題,如果有,也請大家給以事例。
yang@rac1>create sequence yang_seq ;
Sequence created.
yang@rac1>select yang_seq.nextval from dual;
NEXTVAL
----------
1
yang@rac1>/
NEXTVAL
----------
2
yang@rac1>/
NEXTVAL
----------
3
yang@rac1>/
NEXTVAL
----------
4
yang@rac1>/
NEXTVAL
----------
5
yang@rac1>/
NEXTVAL
----------
6
yang@rac1>/
NEXTVAL
----------
7
匯出序列:
oracle@rac1:rac1 /tmp>expdp yang/yang directory=dumpdir dumpfile=sequence.dmp include=sequence
Export: Release 11.2.0.1.0 - Production on Fri Apr 1 22:59:31 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "YANG"."SYS_EXPORT_SCHEMA_01": yang/******** directory=dumpdir dumpfile=sequence.dmp include=sequence
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Master table "YANG"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for YANG.SYS_EXPORT_SCHEMA_01 is:
/tmp/dump/sequence.dmp
Job "YANG"."SYS_EXPORT_SCHEMA_01" successfully completed at 23:01:06
刪除序列
yang@rac1>drop sequence yang_seq;
Sequence dropped.
匯入序列:
oracle@rac1:rac1 /tmp>impdp yang/yang directory=dumpdir dumpfile=sequence.dmp table_exists_action=skip include=sequence
Import: Release 11.2.0.1.0 - Production on Fri Apr 1 23:06:21 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Master table "YANG"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "YANG"."SYS_IMPORT_FULL_01": yang/******** directory=dumpdir dumpfile=sequence.dmp table_exists_action=skip include=sequence
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Job "YANG"."SYS_IMPORT_FULL_01" successfully completed at 23:07:21
再次驗證:
yang@rac1>select yang_seq.nextval from dual;
NEXTVAL
----------
21
從7 間斷了13個 (注意:預設的是20個)
從下面的實驗中可以看出 我們匯入sequence時 資料庫都做了什麼:
oracle@rac1:rac1 /tmp>impdp yang/yang directory=dumpdir dumpfile=sequence.dmp SQLFILE=seq.sql
Import: Release 11.2.0.1.0 - Production on Fri Apr 1 23:15:16 2011
Data Mining and Real Application Testing options
Master table "YANG"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "YANG"."SYS_SQL_FILE_FULL_01": yang/******** directory=dumpdir dumpfile=sequence.dmp SQLFILE=seq.sql
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Job "YANG"."SYS_SQL_FILE_FULL_01" successfully completed at 23:16:13
oracle@rac1:rac1 /tmp>cd dump
oracle@rac1:rac1 /tmp/dump>ls
export.log import.log seq.sql sequence.dmp t.dmp
oracle@rac1:rac1 /tmp/dump>cat seq.sql
-- CONNECT YANG
ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
-- new object type path: SCHEMA_EXPORT/SEQUENCE/SEQUENCE
CREATE SEQUENCE "YANG"."YANG_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE ;
每次匯入佇列時,會從cache 的 N+1 開始(N 為建立序列時cache 在記憶體中的值 )。這就是為什麼會出現間斷了。
yang@rac1>create sequence yang_seq ;
Sequence created.
yang@rac1>select yang_seq.nextval from dual;
NEXTVAL
----------
1
yang@rac1>/
NEXTVAL
----------
2
yang@rac1>/
NEXTVAL
----------
3
yang@rac1>/
NEXTVAL
----------
4
yang@rac1>/
NEXTVAL
----------
5
yang@rac1>/
NEXTVAL
----------
6
yang@rac1>/
NEXTVAL
----------
7
匯出序列:
oracle@rac1:rac1 /tmp>expdp yang/yang directory=dumpdir dumpfile=sequence.dmp include=sequence
Export: Release 11.2.0.1.0 - Production on Fri Apr 1 22:59:31 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "YANG"."SYS_EXPORT_SCHEMA_01": yang/******** directory=dumpdir dumpfile=sequence.dmp include=sequence
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Master table "YANG"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for YANG.SYS_EXPORT_SCHEMA_01 is:
/tmp/dump/sequence.dmp
Job "YANG"."SYS_EXPORT_SCHEMA_01" successfully completed at 23:01:06
刪除序列
yang@rac1>drop sequence yang_seq;
Sequence dropped.
匯入序列:
oracle@rac1:rac1 /tmp>impdp yang/yang directory=dumpdir dumpfile=sequence.dmp table_exists_action=skip include=sequence
Import: Release 11.2.0.1.0 - Production on Fri Apr 1 23:06:21 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Master table "YANG"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "YANG"."SYS_IMPORT_FULL_01": yang/******** directory=dumpdir dumpfile=sequence.dmp table_exists_action=skip include=sequence
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Job "YANG"."SYS_IMPORT_FULL_01" successfully completed at 23:07:21
再次驗證:
yang@rac1>select yang_seq.nextval from dual;
NEXTVAL
----------
21
從7 間斷了13個 (注意:預設的是20個)
從下面的實驗中可以看出 我們匯入sequence時 資料庫都做了什麼:
oracle@rac1:rac1 /tmp>impdp yang/yang directory=dumpdir dumpfile=sequence.dmp SQLFILE=seq.sql
Import: Release 11.2.0.1.0 - Production on Fri Apr 1 23:15:16 2011
Data Mining and Real Application Testing options
Master table "YANG"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "YANG"."SYS_SQL_FILE_FULL_01": yang/******** directory=dumpdir dumpfile=sequence.dmp SQLFILE=seq.sql
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Job "YANG"."SYS_SQL_FILE_FULL_01" successfully completed at 23:16:13
oracle@rac1:rac1 /tmp>cd dump
oracle@rac1:rac1 /tmp/dump>ls
export.log import.log seq.sql sequence.dmp t.dmp
oracle@rac1:rac1 /tmp/dump>cat seq.sql
-- CONNECT YANG
ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
-- new object type path: SCHEMA_EXPORT/SEQUENCE/SEQUENCE
CREATE SEQUENCE "YANG"."YANG_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE ;
每次匯入佇列時,會從cache 的 N+1 開始(N 為建立序列時cache 在記憶體中的值 )。這就是為什麼會出現間斷了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-691503/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 遷移學習時間序列分類遷移學習
- Velero系列文章(四):使用Velero進行生產遷移實戰
- 如何對伺服器進行24小時不間斷監控?伺服器
- oracle goldengate 在節點之間進行 遷移OracleGo
- 瞭解下Mysql的間隙鎖及產生的原因MySql
- 時間序列分析(一)--移動平均
- 用R語言進行時間序列ARMA模型分析R語言模型
- Redo wastage產生的原因AST
- “遷移策略+新容器執行時”應對有狀態應用的冷熱遷移挑戰
- 用Python語言進行時間序列ARIMA模型分析Python模型
- PostgreSQL中對日期時間進行分組SQL
- 使用RMAN進行資料遷移
- 今天晚上進行資料遷移
- 產生top sql的原因(zt)SQL
- 【時間序列分析】01. 時間序列·平穩序列
- oracle11g_如何模擬產生行連結或行遷移chained_rowsOracleAI
- 銀行業生產系統儲存資料遷移方法及實踐行業
- 生產環境資料遷移問題彙總
- 使用DistCp將Hadoop進行雲遷移時注意事項TCPHadoop
- 生產訂單中排程的時間元素
- 使用vplex的mirror功能對儲存層LUN進行資料的遷移
- 新舊系統更替產生的資料遷移問題
- 對軟體專案中產生的需求進行分級管理
- 分割槽表對應的表空間遷移案例
- 空間遷移
- Vue1.x 遷移 Vue2.x(專案進行不斷修改)Vue
- 生產系統 SQL 執行異常原因分析SQL
- 對Oracle分割槽表進行表空間遷移並處理ORA-14511問題Oracle
- Fastjson反序列化遠端程式碼執行漏洞產生原因及修復建議ASTJSON
- Oracle 產生序列的 6 種方法Oracle
- 對軟體專案中產生的需求進行分級管理 (轉)
- 時間序列知識圖譜-《利用Python進行資料分析》Python
- 阿里雲資料庫遷移方案-不間斷業務阿里資料庫
- 將VAE用於時間序列:生成時間序列的合成資料
- 企業向雲遷移的原因-資訊圖
- 呼叫webservice時提示對操作的回覆訊息正文進行反序列化時出錯Web
- 核間遷移的影響
- 利用sqlldr工具進行資料遷移時發現的問題解決方法SQL