中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

【Oracle12C】11GR2升級到12CR1并插入CDB

發布時間:2020-08-08 16:36:11 來源:ITPUB博客 閱讀:150 作者:xysoul_云龍 欄目:關系型數據庫
轉自: 發表于 2013 年 07 月 08 日  惜分飛

聯系:手機(+86 13429648788) QQ(107644445)【Oracle12C】11GR2升級到12CR1并插入CDB

標題:11GR2升級到12CR1并插入CDB

作者:惜分飛©版權所有[未經本人同意,不得以任何形式轉載,否則有進一步追究法律責任的權利.]

ORACLE 12C已經發布了十多天,其中一個亮點就是pdb,而在12C之前的數據庫沒有pdb之說,也就是說如果要把以前的數據庫升級到12C,并且想讓該庫變成一個pdb,那所要做的工作就是先需要升級數據庫從12C之前版本升級到12C,然后把一個NO-CDB數據庫PLUG到CDB中.本blog演示:在前段時間意外的釋放出來ORACLE 11.2.0.4版本,利用該版本升級到12.1.0.1,并插入到一個cdb庫中
ORACLE 12C升級版本要求
【Oracle12C】11GR2升級到12CR1并插入CDB
11.2.0.4到12.1.0.1升級操作操作[升級整體參考文檔1503653.1]
當前相關組件版本信息

SQL>select*fromv$version;
 
BANNER
--------------------------------------------------------------------------------
OracleDatabase11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNSforLinux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
 
SQL> show parametername;
 
NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      ora11g
db_unique_name                       string      ora11g
global_names                         boolean    FALSE
instance_name                        string      ora11g
lock_name_space                      string
log_file_name_convert                string
processor_group_name                 string
service_names                        string      ora11g
 
SQL>selectCOMP_NAME,VERSION,STATUSfromdba_registry;
 
COMP_NAME                                VERSION                        STATUS
---------------------------------------- ------------------------------ ----------------------
OWB                                      11.2.0.4.0                     VALID
Oracle Application Express               3.2.1.00.12                    VALID
Spatial                                  11.2.0.4.0                     VALID
Oracle Multimedia                        11.2.0.4.0                     VALID
Oracle XMLDatabase                     11.2.0.4.0                     VALID
Oracle Text                              11.2.0.4.0                     VALID
Oracle Expression Filter                 11.2.0.4.0                     VALID
Oracle Rules Manager                     11.2.0.4.0                     VALID
Oracle Workspace Manager                 11.2.0.4.0                     VALID
OracleDatabaseCatalog Views            11.2.0.4.0                     VALID
OracleDatabasePackagesandTypes       11.2.0.4.0                     VALID
JServer JAVA Virtual Machine             11.2.0.4.0                     VALID
Oracle XDK                               11.2.0.4.0                     VALID
OracleDatabaseJava Packages            11.2.0.4.0                     VALID
OLAP Analytic Workspace                  11.2.0.4.0                     VALID
Oracle OLAP API                          11.2.0.4.0                     VALID
 
16rowsselected.

升級準備工作
執行Pre-Upgrade Utility,具體參考Note 884522.1 How to Download and Run Oracle’s Database Pre-Upgrade Utility

SQL> @/tmp/preupgrd.sql
Loading Pre-Upgrade Package...
Executing Pre-Upgrade Checks...
Pre-Upgrade Checks Complete.
      ************************************************************
 
Results of the checks are located at:
 /u02/app/oracle/cfgtoollogs/ora11g/preupgrade/preupgrade.log
 
Pre-Upgrade Fixup Script (runinsourcedatabase environment):
 /u02/app/oracle/cfgtoollogs/ora11g/preupgrade/preupgrade_fixups.sql
 
Post-Upgrade Fixup Script (run shortly after upgrade):
 /u02/app/oracle/cfgtoollogs/ora11g/preupgrade/postupgrade_fixups.sql
 
      ************************************************************
 
         Fixup scripts must be reviewed prior to being executed.
 
      ************************************************************
 
      ************************************************************
                   ====>> USER ACTION REQUIRED  <<====
      ************************************************************
 
 The following are *** ERROR LEVEL CONDITIONS *** that must be addressed
                    prior to attempting your upgrade.
            Failure todoso will resultina failed upgrade.
 
           You MUST resolve the above errors prior to upgrade
 
      ************************************************************

這里發生了改變,在12C之前版本直接顯示需要修改的相關操作,12C把相關操作封裝到了preupgrade_fixups.sql腳本,執行該腳本按照提示修復問題.
這里主要以下問題需要解決

ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE;
@/u01/app/oracle/product/12.1/db_1/rdbms/admin/emremove.sql
@/u02/app/oracle/product/11.2/db_1/olap/admin/catnoamd.sql
EXECUTE dbms_stats.gather_dictionary_stats;

執行dbupgdiag.sql收集升級前信息
如果有異常核對相應的MOS文章修改,具體見Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql) [ID 556610.1]

dbua升級數據庫
12C的dbua發生了不上變化,因為都是圖形化界面,不做過多描述,貼上幾幅區別較大圖進行說明,關于12C的dbua變化更加詳細信息請參考:Complete Checklist to Upgrade the Database to 12c Release 1 using DBUA [ID 1516557.1]
【Oracle12C】11GR2升級到12CR1并插入CDB
【Oracle12C】11GR2升級到12CR1并插入CDB
【Oracle12C】11GR2升級到12CR1并插入CDB


升級后檢查
執行postupgrade_fixups.sql腳本查看確定需要升級后處理事宜,因為是dbua升級數據庫,很多問題已經自動修復,無需人工再次干預,例如timezone(14–>18)


SQL>select*fromv$version;
 
BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
OracleDatabase12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production              0
PL/SQL Release 12.1.0.1.0 - Production                                                    0
CORE    12.1.0.1.0      Production                                                        0
TNSforLinux: Version 12.1.0.1.0 - Production                                            0
NLSRTL Version 12.1.0.1.0 - Production                                                    0
 
SQL>selectCOMP_NAME,VERSION,STATUSfromdba_registry;
 
COMP_NAME                                     VERSION                        STATUS
--------------------------------------------- ------------------------------ ----------------------
Oracle Application Express                    4.2.0.00.27                    VALID
OWB                                           11.2.0.4.0                     VALID
Spatial                                       12.1.0.1.0                     VALID
Oracle Multimedia                             12.1.0.1.0                     VALID
Oracle XMLDatabase                          12.1.0.1.0                     VALID
Oracle Text                                   12.1.0.1.0                     VALID
Oracle Workspace Manager                      12.1.0.1.0                     VALID
OracleDatabaseCatalog Views                 12.1.0.1.0                     VALID
OracleDatabasePackagesandTypes            12.1.0.1.0                     VALID
JServer JAVA Virtual Machine                  12.1.0.1.0                     VALID
Oracle XDK                                    12.1.0.1.0                     VALID
OracleDatabaseJava Packages                 12.1.0.1.0                     VALID
OLAP Analytic Workspace                       12.1.0.1.0                     VALID
Oracle OLAP API                               12.1.0.1.0                     VALID
 
14rowsselected.

升級前后oratab信息對比
dbua使用12C環境變量shell下執行,注意不要人工修改oratab記錄,執行完會自動修改

--升級前
[oracle@xifenfei ~]$grepora11g/etc/oratab
ora11g:/u02/app/oracle/product/11.2/db_1:N:            # line added by Agent
 
--升級后
[oracle@xifenfei ~]$grepora11g/etc/oratab
ora11g:/u01/app/oracle/product/12.1/db_1:N:            # line added by Agent

到此,我們可以確定11.2.0.4已經順利升級到12.1.0.1,升級過程比較順利,但是升級時間比較長,很可能和我的機器配置有關

NO-CDB PLUG CDB
把11.2.0.4升級到12.1.0.1的數據庫插入到一個CDB數據庫中,讓其成為CDB一部分
PLUG操作示意圖
【Oracle12C】11GR2升級到12CR1并插入CDB


升級后數據庫信息


SQL> selectcdb,NAME,dbidfromv$database;
 
CDBNAME           DBID
--- --------- ----------
NO ORA11G    4215674657
 
SQL>select*fromv$version;
 
BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
OracleDatabase12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production              0
PL/SQL Release 12.1.0.1.0 - Production                                                    0
CORE    12.1.0.1.0      Production                                                        0
TNSforLinux: Version 12.1.0.1.0 - Production                                            0
NLSRTL Version 12.1.0.1.0 - Production                                                    0

創建XML元數據文件

SQL> shutdown immediate
Databaseclosed.
Databasedismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
 
Total SystemGlobalArea  801701888 bytes
FixedSize                 2293496 bytes
VariableSize            314573064 bytes
DatabaseBuffers          478150656 bytes
Redo Buffers                6684672 bytes
Databasemounted.
SQL>alterdatabaseopenreadonly;
 
Databasealtered.
 
SQL>EXECDBMS_PDB.DESCRIBE( pdb_descr_file =>'/tmp/ora11g.xml');
 
PL/SQLproceduresuccessfully completed.
 
SQL> shutdown immediate
Databaseclosed.
Databasedismounted.
ORACLE instance shut down.

CDB數據庫信息

SQL>select*fromv$version;
 
BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
OracleDatabase12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production              0
PL/SQL Release 12.1.0.1.0 - Production                                                    0
CORE    12.1.0.1.0      Production                                                        0
TNSforLinux: Version 12.1.0.1.0 - Production                                            0
NLSRTL Version 12.1.0.1.0 - Production                                                    0
 
SQL> show pdbs;
 
    CON_ID CON_NAME                      OPENMODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                      READONLY NO
         3 PDB1                           MOUNTED
         4 PDB2                           MOUNTED

檢查升級后數據庫是否適合插入到該cdb

SQL>setserveroutputon;
 declare
         compat boolean :=FALSE;
    begin
       compat := dbms_pdb.check_plug_compatibility(pdb_descr_file =>'/tmp/ora11g.xml');
        if compat
        then
               dbms_output.put_line('Yes');
       else
               dbms_output.put_line('No');
      endif;
   end;SQL>   2    3    4    5    6    7    8    9   10   11 
 12  /
No
 
PL/SQLproceduresuccessfully completed.

因為是第一次插入所以顯示是No,可以忽略該問題繼續插入

插入no-cdb to cdb庫

SQL>CREATEPLUGGABLEDATABASEora11g USING'/tmp/ora11g.xml'NOCOPY;
 
Pluggabledatabasecreated.
 
SQL> show pdbs
 
    CON_ID CON_NAME                      OPENMODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                      READONLY NO
         3 PDB1                           MOUNTED
         4 PDB2                           MOUNTED
         5 ORA11G                         MOUNTED

根據官方文檔描述,如果是第一次是no-cdb plug cdb,需要先open一次庫

SQL>altersessionsetcontainer=ora11g;
 
Session altered.
 
SQL>alterdatabaseopen;
alterdatabaseopen
*
ERRORatline 1:
ORA-24344: successwithcompilation error
 
 
SQL> !oerr ora 24344
24344, 00000,"success with compilation error"
// *Cause:  A sql/plsql compilation error occurred.
// *Action:ReturnOCI_SUCCESS_WITH_INFO alongwiththe error code
 
SQL> show pdbs;
 
    CON_ID CON_NAME                      OPENMODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         5 ORA11G                        READWRITE YES

出現ORA-24344,但是數據庫正常open到read write模式,忽略該錯誤,繼續執行

執行noncdb_to_pdb腳本

SQL>altersessionsetcontainer=ora11g;
 
Session altered.
 
SQL> shutdown immediate
PluggableDatabaseclosed.
SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
 
 
--遇到Warning,腳本自動忽略該錯誤,繼續執行,在最后該腳本編譯的時候會修復該問題,原因很可能是某個plslq異常
SQL>alterpluggabledatabase"&pdbname"openrestricted;
old   1:alterpluggabledatabase"&pdbname"openrestricted
new   1:alterpluggabledatabase"ORA11G"openrestricted
 
Warning: PDB alteredwitherrors.

同步pdb信息

[oracle@xifenfei ~]$ sqlplus sys/xifenfei@ora11gassysdba
 
SQL*Plus: Release 12.1.0.1.0 ProductiononMon Jul 1 03:05:42 2013
 
Copyright (c) 1982, 2013, Oracle. Allrights reserved.
 
 
Connectedto:
OracleDatabase12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
Withthe Partitioning,RealApplication Clusters, Automatic Storage Management, OLAP,
Advanced AnalyticsandRealApplication Testing options
 
SYS% ora11g>alterpluggabledatabaseopenrestricted;
 
Pluggabledatabasealtered.
 
SYS% ora11g> execdbms_pdb.sync_pdb();
 
PL/SQLproceduresuccessfully completed.
 
SYS% ora11g>alterpluggabledatabasecloseimmediate;
 
Pluggabledatabasealtered.
 
SYS% ora11g>alterpluggabledatabaseopen;
 
Pluggabledatabasealtered.

確定no-cdb plug cdb 成功

SYS% ora11g> conn /assysdba
Connected.
SYS% cdb1> show pdbs
 
    CON_ID CON_NAME                      OPENMODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                      READONLY NO
         3 PDB1                           MOUNTED
         4 PDB2                           MOUNTED
         5 ORA11G                        READWRITENO

到這里已經完全完成了11.2.0.4數據庫插入到12.1.0.1中,實現把11GR2轉化為CDB數據庫中的一個PDB

  • 升級到Oracle 10.2.0.4
  • ORACLE 12C PDB 維護基礎介紹
  • expdp遭遇ORA-39006/ORA-39213故障解決
  • ORA-06553: PLS-801: internal error [56319]
  • 深入分析數據庫版本相關視圖
  • 設置pdb隨cdb一起啟動
  • Oracle 10.2.0.x升級到11.2.0.3
  • ORACLE 12C PDB部分功能測試
  • exp導出數據報EXP-00056/ORA-01403錯誤
  • 恢復被rm意外刪除數據文件
  • 修改props$.NLS_CHARACTERSET導致ORA-00900異常恢復
  • 關于ORACLE 11G密碼大小寫敏感猜想(USER$.SPARE4)
此條目發表在 ORACLE 12C, Oracle安裝升級 分類目錄。將固定鏈接加入收藏夾。


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

洱源县| 称多县| 珠海市| 淳化县| 永清县| 宝坻区| 喀什市| 开江县| 青州市| 朝阳县| 云南省| 安徽省| 资中县| 滨海县| 双桥区| 武安市| 郎溪县| 成都市| 泸西县| 沽源县| 封丘县| 凤冈县| 理塘县| 金沙县| 平果县| 鲁甸县| 佛山市| 剑阁县| 铜鼓县| 宁海县| 准格尔旗| 额济纳旗| 吴桥县| 瓮安县| 靖安县| 潼关县| 尤溪县| 班玛县| 当阳市| 尼木县| 昌平区|