手工升級到Oracle 12C

来源:https://www.cnblogs.com/aries0228/archive/2023/09/15/17702943.html
-Advertisement-
Play Games

一、升級路線 10.2.0.5,11.1.0.7,11.2.0.2以上版本可以直接升級到12c。 10.2.0.5以前的版本和11.2.0.1版需要先升級到中間版本,再升級到12c。 二、環境說明 操作系統:Red Hat 8 Linux 64位 源資料庫版本:Oracle 11.2.0.3 目標數 ...


一、升級路線

  • 10.2.0.5,11.1.0.7,11.2.0.2以上版本可以直接升級到12c。
  • 10.2.0.5以前的版本和11.2.0.1版需要先升級到中間版本,再升級到12c。

二、環境說明

  • 操作系統:Red Hat 8 Linux 64位
  • 源資料庫版本:Oracle 11.2.0.3
  • 目標資料庫版本:Oracle 12.1.0.2

三、升級步驟簡述

  • 備份源資料庫(RMan)
  • 執行Pre-Upgrade Information Tool(preupgrd.sql)
  • 準備新版本的Oracle Home
  • 關閉資料庫實例
  • 使用12c啟動資料庫,進入升級模式
  • 執行並行升級實用程式(catctl.pl)
  • 執行Post-Upgrade Status Tool(utlu121s.sql)
  • 執行附加腳本(catuppst.sql和utlrp.sql)
  • 完成升級階段

四、升級步驟

4.1、備份資料庫

4.2、執行Pre-Upgrade Information Tool

4.2.1、運行預升級工具腳本

使用目標版本資料庫(Oracle 12C)目錄/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/下的preupgrd.sql腳本。在源資料庫的SQL*Plus內執行。

1 sqlplus /nolog
2 
3 SQL*Plus: Release 11.2.0.3.0 Production on Thu Sep 14 15:43:31 2023
4 
5 Copyright (c) 1982, 2011, Oracle.  All rights reserved.
6 
7 SQL> conn / as sysdba
8 Connected.
9 SQL> @/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/preupgrd.sql

此工具是用來分析源資料庫存在的問題,並生成用來生成解決問題的腳本。

Loading Pre-Upgrade Package...


***************************************************************************
Executing Pre-Upgrade Checks in RCAT...
***************************************************************************


      ************************************************************

                   ====>> ERRORS FOUND for RCAT <<====

 The following are *** ERROR LEVEL CONDITIONS *** that must be addressed
                    prior to attempting your upgrade.
            Failure to do so will result in a failed upgrade.


 1) Check Tag:    PURGE_RECYCLEBIN
    Check Summary: Check that recycle bin is empty prior to upgrade
    Fixup Summary:
     "The recycle bin will be purged."

            You MUST resolve the above error prior to upgrade

      ************************************************************

      ************************************************************

               ====>> PRE-UPGRADE RESULTS for RCAT <<====

ACTIONS REQUIRED:

1. Review results of the pre-upgrade checks:
 /u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade.log

2. Execute in the SOURCE environment BEFORE upgrade:
 /u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade_fixups.sql

3. Execute in the NEW environment AFTER upgrade:
 /u01/app/oracle/cfgtoollogs/rcat/preupgrade/postupgrade_fixups.sql

      ************************************************************

***************************************************************************
Pre-Upgrade Checks in RCAT Completed.
***************************************************************************

***************************************************************************
***************************************************************************

以上結果提示,必須先清空源數據的回收站。

建議關註預升級檢查記錄:/u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade.log。

4.2.2、升級前腳本

升級前在源環境運行升級前修複腳本:/u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade_fixups.sql,此腳本用來修複在源數據發現的問題。

1 SQL> @/u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade_fixups.sql
Pre-Upgrade Fixup Script Generated on 2023-09-14 15:51:38  Version: 12.1.0.2 Build: 006
Beginning Pre-Upgrade Fixups...
Executing in container RCAT

**********************************************************************
Check Tag:     EM_PRESENT
Check Summary: Check if Enterprise Manager is present
Fix Summary:   Execute emremove.sql prior to upgrade.
**********************************************************************
Fixup Returned Information:
WARNING: --> Enterprise Manager Database Control repository found in the database

     In Oracle Database 12c, Database Control is removed during
     the upgrade. To save time during the Upgrade, this action
     can be done prior to upgrading using the following steps after
     copying rdbms/admin/emremove.sql from the new Oracle home
   - Stop EM Database Control:
    $> emctl stop dbconsole

   - Connect to the Database using the SYS account AS SYSDBA:

   SET ECHO ON;
   SET SERVEROUTPUT ON;
   @emremove.sql
     Without the set echo and serveroutput commands you will not 
     be able to follow the progress of the script.
**********************************************************************


**********************************************************************
Check Tag:     AMD_EXISTS
Check Summary: Check to see if AMD is present in the database
Fix Summary:   Manually execute ORACLE_HOME/oraolap/admin/catnoamd.sql script to remove OLAP.
**********************************************************************
Fixup Returned Information:
INFORMATION: --> OLAP Catalog(AMD) exists in database

     Starting with Oracle Database 12c, OLAP Catalog component is desupported.
     If you are not using the OLAP Catalog component and want
     to remove it, then execute the 
     ORACLE_HOME/olap/admin/catnoamd.sql script before or 
     after the upgrade.
**********************************************************************


**********************************************************************
Check Tag:     PURGE_RECYCLEBIN
Check Summary: Check that recycle bin is empty prior to upgrade
Fix Summary:   The recycle bin will be purged.
**********************************************************************
Fixup Succeeded
**********************************************************************


**********************************************************************
Check Tag:     APEX_UPGRADE_MSG
Check Summary: Check that APEX will need to be upgraded.
Fix Summary:   Oracle Application Express can be manually upgraded prior to database upgrade.
**********************************************************************
Fixup Returned Information:
INFORMATION: --> Oracle Application Express (APEX) can be
     manually upgraded prior to database upgrade

     APEX is currently at version 3.2.1.00.10 and will need to be
     upgraded to APEX version 4.2.5 in the new release.
     Note 1: To reduce database upgrade time, APEX can be manually
             upgraded outside of and prior to database upgrade.
     Note 2: See MOS Note 1088970.1 for information on APEX
             installation upgrades.
**********************************************************************


**********************************************************************
                      [Pre-Upgrade Recommendations]
**********************************************************************

                        *****************************************
                        ********* Dictionary Statistics *********
                        *****************************************

Please gather dictionary statistics 24 hours prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
    EXECUTE dbms_stats.gather_dictionary_stats;

^^^ MANUAL ACTION SUGGESTED ^^^


           **************************************************
                ************* Fixup Summary ************

 1 fixup routine was successful.
 3 fixup routines returned INFORMATIONAL text that should be reviewed.

**************** Pre-Upgrade Fixup Script Complete *********************

提出的建議如下:

  • 發現了Enterprise Manager,在升級過程中會刪除EM庫,為了減少升級時間,可以先刪除。已自動處理。
  • 發現了OLAP Catalog組件,在12C中不再支持OLAP Catalog組件,可以在升級前或升級後使用catnoamd.sql腳本刪除,這裡就不刪除了,升級後再說。

  • 回收站是空的,不需要處理。如果回收站不是空的,將自動清空回收站。
  • 發現了APEX,APEX版本升級會占用比較多的時間,oracle建議可以手工升級,參考: 1088970.1,這裡也不管了,一起升級。

  • 建議在資料庫升級的24小時之前執行EXECUTE dbms_stats.gather_dictionary_stats;,收集數據字典統計信息。
1 SQL> EXECUTE dbms_stats.gather_dictionary_stats;
 4.2.3、升級後腳本

升級後在新環境運行升級後修複腳本:/u01/app/oracle/cfgtoollogs/rcat/preupgrade/postupgrade_fixups.sql,此腳本用來修複資料庫升級後的問題。

4.3、準備12c Oracle Home

編輯/etc/oratab文件,將RCAT的環境變數指向Oracle 12C的Oracle Home。

1 [oracle@orasrv admin]$ vim /etc/oratab
rcat:/u01/app/oracle/product/12.1.0/dbhome_1:Y

4.4、關閉資料庫實例

1 SQL> shutdown immediate

4.5、使用12c啟動資料庫,進入升級模式

1 SQL*Plus: Release 12.1.0.2.0 Production on Thu Sep 14 16:36:59 2023
2 
3 Copyright (c) 1982, 2014, Oracle.  All rights reserved.
4 
5 SQL> conn / as sysdba
6 Connected to an idle instance.
7 SQL> startup upgrade
8 ORA-01078: failure in processing system parameters
9 LRM-00109: could not open parameter file '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initrcat.ora'

以上提示說明需要參數文件initrcat.ora,我們將11g資料庫的參數文件複製到12c的相應目錄

1 [oracle@orasrv ~]$ cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilercat.ora /u01/app/oracle/product/12.1.0/dbhome_1/dbs/

再次啟動

 1 SQL> startup upgrade

4.6、執行並行升級實用程式

1 SQL> @/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catupgrd.sql
DOC>######################################################################
DOC>######################################################################
DOC>                                 NOTE
DOC>
DOC>    The catupgrd.sql is being deprecated in the 12.1 release of the
DOC>    Oracle Database.  Customers are encouraged to use catctl.pl as
DOC>    the replacement for catupgrd.sql when upgrading the database dictionary.
DOC>
DOC>                    cd $ORACLE_HOME/rdbms/admin
DOC>                    $ORACLE_HOME/perl/bin/perl catctl.pl -n 4 catupgrd.sql
DOC>
DOC>    Refer to the Oracle Database Upgrade Guide for more information.
DOC>
DOC>    This database upgrade procedure must be called with the following
DOC>    argument when invoking from the SQL prompt:
DOC>
DOC>                    @catupgrd.sql PARALLEL=NO
DOC>
DOC>######################################################################
DOC>######################################################################
DOC>#
old   2: WHERE  UPPER('&&1') = 'PARALLEL=NO' OR
new   2: WHERE  UPPER('') = 'PARALLEL=NO' OR
old   3:        UPPER('&&1') = 'PARALLEL=YES'
new   3:        UPPER('') = 'PARALLEL=YES'
SELECT (to_number(count(*)))/(to_number(count(*))) FROM DUAL
                            *
ERROR at line 1:
ORA-01476: divisor is equal to zero
Disconnected
from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

在12c中,使用升級腳本catctl.pl代替了catupgrd.sql,升級腳本的執行方式也發生了變化。根據以上提示可知,在Linux環境下需按以下方式執行: 

[oracle@orasrv ~]$ cd $ORACLE_HOME/rdbms/admin
[oracle@orasrv admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -n 2 catupgrd.sql

 -n後參數2代表並行度為2,可按CPU核數進行設置。接下來就進入到漫長的升級過程: 

Argument list for [catctl.pl]
SQL Process Count     n = 2
SQL PDB Process Count N = 0
Input Directory       d = 0
Phase Logging Table   t = 0
Log Dir               l = 0
Script                s = 0
Serial Run            S = 0
Upgrade Mode active   M = 0
Start Phase           p = 0
End Phase             P = 0
Log Id                i = 0
Run in                c = 0
Do not run in         C = 0
Echo OFF              e = 1
No Post Upgrade       x = 0
Reverse Order         r = 0
Open Mode Normal      o = 0
Debug catcon.pm       z = 0
Debug catctl.pl       Z = 0
Display Phases        y = 0
Child Process         I = 0

catctl.pl version: 12.1.0.2.0
Oracle Base           = /u01/app/oracle

Analyzing file catupgrd.sql
Log files in /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin
catcon: ALL catcon-related output will be written to catupgrd_catcon_4741.lst
catcon: See catupgrd*.log files for output generated by scripts
catcon: See catupgrd_*.lst files for spool files, if any
Number of Cpus        = 2
SQL Process Count     = 2

------------------------------------------------------
Phases [0-73]
Serial   Phase #: 0 Files: 1     Time: 99s   
Serial   Phase #: 1 Files: 5     Time: 23s   
Restart  Phase #: 2 Files: 1     Time: 0s    
Parallel Phase #: 3 Files: 18    Time: 27s   
Restart  Phase #: 4 Files: 1     Time: 0s    
Serial   Phase #: 5 Files: 5     Time: 32s   
Serial   Phase #: 6 Files: 1     Time: 26s   
Serial   Phase #: 7 Files: 4     Time: 5s    
Restart  Phase #: 8 Files: 1     Time: 0s    
Parallel Phase #: 9 Files: 62    Time: 63s   
Restart  Phase #:10 Files: 1     Time: 0s    
Serial   Phase #:11 Files: 1     Time: 43s   
Restart  Phase #:12 Files: 1     Time: 0s    
Parallel Phase #:13 Files: 91    Time: 49s   
Restart  Phase #:14 Files: 1     Time: 0s    
Parallel Phase #:15 Files: 111   Time: 64s   
Restart  Phase #:16 Files: 1     Time: 0s    
Serial   Phase #:17 Files: 3     Time: 40s   
Restart  Phase #:18 Files: 1     Time: 0s    
Parallel Phase #:19 Files: 32    Time: 56s   
Restart  Phase #:20 Files: 1     Time: 0s    
Serial   Phase #:21 Files: 3     Time: 43s   
Restart  Phase #:22 Files: 1     Time: 0s    
Parallel Phase #:23 Files: 23    Time: 105s  
Restart  Phase #:24 Files: 1     Time: 0s    
Parallel Phase #:25 Files: 11    Time: 71s   
Restart  Phase #:26 Files: 1     Time: 0s    
Serial   Phase #:27 Files: 1     Time: 20s   
Restart  Phase #:28 Files: 1     Time: 0s    
Serial   Phase #:30 Files: 1     Time: 0s    
Serial   Phase #:31 Files: 257   Time: 51s   
Serial   Phase #:32 Files: 1     Time: 0s    
Restart  Phase #:33 Files: 1     Time: 0s    
Serial   Phase #:34 Files: 1     Time: 43s   
Restart  Phase #:35 Files: 1     Time: 0s    
Restart  Phase #:36 Files: 1     Time: 17s   
Serial   Phase #:37 Files: 4     Time: 74s   
Restart  Phase #:38 Files: 1     Time: 0s    
Parallel Phase #:39 Files: 13    Time: 55s   
Restart  Phase #:40 Files: 1     Time: 0s    
Parallel Phase #:41 Files: 10    Time: 46s   
Restart  Phase #:42 Files: 1     Time: 0s    
Serial   Phase #:43 Files: 1     Time: 44s   
Restart  Phase #:44 Files: 1     Time: 0s    
Serial   Phase #:45 Files: 1     Time: 38s   
Serial   Phase #:46 Files: 1     Time: 0s    
Restart  Phase #:47 Files: 1     Time: 0s    
Serial   Phase #:48 Files: 1     Time: 115s  
Restart  Phase #:49 Files: 1     Time: 0s    
Serial   Phase #:50 Files: 1     Time: 69s   
Restart  Phase #:51 Files: 1     Time: 0s    
Serial   Phase #:52 Files: 1     Time: 51s   
Restart  Phase #:53 Files: 1     Time: 0s    
Serial   Phase #:54 Files: 1     Time: 147s  
Restart  Phase #:55 Files: 1     Time: 0s    
Serial   Phase #:56 Files: 1     Time: 81s   
Restart  Phase #:57 Files: 1     Time: 0s    
Serial   Phase #:58 Files: 1     Time: 124s  
Restart  Phase #:59 Files: 1     Time: 0s    
Serial   Phase #:60 Files: 1     Time: 200s  
Restart  Phase #:61 Files: 1     Time: 0s    
Serial   Phase #:62 Files: 1     Time: 1016s 
Restart  Phase #:63 Files: 1     Time: 0s    
Serial   Phase #:64 Files: 1     Time: 32s   
Serial   Phase #:65 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0/dbhome_1/lib; export LD_LIBRARY_PATH;/

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 一、什麼是kafka,什麼是rabbit Kafka是由Scala語言開發的一種分散式流處理框架,主要用於處理活躍的流式數據,以及大數據量的數據處理。它採用發佈-訂閱模型,支持消息的批量處理,數據的存儲和獲取是本地磁碟順序批量操作,這使得消息處理的效率較高,吞吐量較大。 RabbitMQ則是由Erl ...
  • InlineHook 是一種電腦安全編程技術,其原理是在電腦程式執行期間進行攔截、修改、增強現有函數功能。它使用鉤子函數(也可以稱為回調函數)來截獲程式執行的各種事件,併在事件發生前或後進行自定義處理,從而控制或增強程式行為。Hook技術常被用於系統加速、功能增強、等領域。本章將重點講解Hook... ...
  • pycharm作為開發python程式的最適合編輯器,幾乎已經普及了所有的python開發者 但是還有很多同學不會免費使用pycharm的方法,今天我就給大家普及兩種Pycharm安裝和免費激活的方式 本文提供圖文教程,一步一步地演示永久激活 Pycharm 的方法。適用於最新的幾個版本,步驟簡單, ...
  • 問題 在Spring Cloud項目中,前後端分離目前很常見,在調試時,會遇到兩種情況的跨域: 前端頁面通過不同功能變數名稱或IP訪問微服務的後臺,例如前端人員會在本地起HttpServer 直連後臺開發本地起的服務,此時,如果不加任何配置,前端頁面的請求會被瀏覽器跨域限制攔截,所以,業務服務常常會添加如下 ...
  • 在開發應用程式時,記錄日誌是一項關鍵的任務,以便在應用程式運行時追蹤問題、監視性能和保留審計記錄。Go 語言提供了靈活且強大的日誌記錄功能,可以通過多種方式配置和使用。其中一個常用的日誌記錄庫是 github.com/natefinch/lumberjack,它提供了一個方便的方式來處理日誌文件的輪 ...
  • 本章節主要討論瞭如何通過零拷貝技術來優化文件傳輸的性能。零拷貝技術主要通過減少用戶態和內核態之間的上下文切換次數和數據拷貝次數來提高性能。具體來說,介紹了兩種實現零拷貝的方式:mmap + write和sendfile。使用mmap + write可以減少一次數據拷貝過程,而使用sendfile系統... ...
  • 第1個虛擬項目 1. 前言 點燈開啟了我們的FPGA之路,那麼我們來繼續沙盤演練。 用一個虛擬項目,來入門練習,以此步入數字邏輯的大門。 Key Words:FIFO 、SOF 、EOF、計數器、緩存、時序圖、方案設計 2. 項目要求 1) 輸入報文長度64~2048位元組; 2) 輸入報文之間最小間 ...
  • 本文將從 e2e 的基本介紹,e2e 的使用與擴展,session 日誌隔離三個維度為大家帶來 ChunJun e2e & session 日誌隔離的分享。 大量具體代碼和演示請看視頻教程⬇️ 視頻課程: https://www.bilibili.com/video/BV1ru411P7oZ/?sp ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...