1. 程式人生 > >Oracle 12C RAC 升級

Oracle 12C RAC 升級

下載最新的OPatch工具

各個版本的opatch

Patch 6880880

Or using the next URL:

https://updates.oracle.com/download/6880880.html

 

下載補丁

https://support.oracle.com/epmos/faces/PatchSearchResults?_adf.ctrl-state=9lvomvbht_354&_afrLoop=254196006287159

 

升級準備

注意事項

本文件適用場景-Oracle RAC,其中GI Home和Database Homes未共享且未配置ACFS檔案系統

升級前開啟叢集,關閉監聽、ASM例項、資料庫例項、退出SQLPLUS,即與例項相關服務全部關閉

如果是首次安裝,則先不要安裝資料庫例項,升級Grid、RDBMS後,再安裝例項

RAC多節點升級,一個節點一個節點地操作,不要併發執行

12C升級不再需要emocmrsp命令

例項升級不再使用catbundle.sql(在12C中被廢棄),而是使用datapatch,目前12.2.0.1的例項無需升級

 

臨時環境變數配置(升級完畢後可刪除)

root .bash_profile

export UNZIPPED_PATCH_LOCATION=/orasoft

export GI_ORACLE_HOME=/u01/app/12.2.0/grid/product/db_1

export ORACLE_DB_HOME=/u01/app/oracle/product/12.2.0/db_1

 

Grid/oracle .bash_profile

export UNZIPPED_PATCH_LOCATION=/orasoft

 

 

更換OPatch目錄

root下執行

解壓patch包

export UNZIPPED_PATCH_LOCATION=/orasoft

export GI_ORACLE_HOME=/u01/app/12.2.0/grid/product/db_1

export ORACLE_DB_HOME=/u01/app/oracle/product/12.2.0/db_1

 

scp p6880880_122010_Linux-x86-64.zip crcsn2:/orasoft

 

cd $UNZIPPED_PATCH_LOCATION

unzip p6880880_122010_Linux-x86-64.zip

 

 

更換GI環境OPatch包

mv $GI_ORACLE_HOME/OPatch $GI_ORACLE_HOME/OPatch.old

cp -r $UNZIPPED_PATCH_LOCATION/OPatch $GI_ORACLE_HOME/

chown -R grid:oinstall $GI_ORACLE_HOME/OPatch

chmod -R 755 $GI_ORACLE_HOME/OPatch

ls -lrth $GI_ORACLE_HOME |grep OPatch

注意解壓後目錄許可權,至關重要。

 

 

更換Oracle環境下的OPatch包

mv $ORACLE_DB_HOME/OPatch $ORACLE_DB_HOME/OPatch.old

cp -r $UNZIPPED_PATCH_LOCATION/OPatch $ORACLE_DB_HOME/

chown -R oracle:oinstall $ORACLE_DB_HOME/OPatch

chmod -R 755 $ORACLE_DB_HOME/OPatch

ls -lrth $ORACLE_DB_HOME |grep OPatch

 

解壓 PSU

scp p2710* crcsn2:/orasoft

cd $UNZIPPED_PATCH_LOCATION

unzip p27105253_122010_Linux-x86-64.zip

unzip p27100009_122010_Linux-x86-64.zip

chown -R oracle:oinstall $UNZIPPED_PATCH_LOCATION

chmod -R 755 $UNZIPPED_PATCH_LOCATION

 

衝突檢測

su - grid

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir  $UNZIPPED_PATCH_LOCATION/27100009/27105253

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir  $UNZIPPED_PATCH_LOCATION/27100009/27335416

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir  $UNZIPPED_PATCH_LOCATION/27100009/27128906

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir  $UNZIPPED_PATCH_LOCATION/27100009/26839277

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir  $UNZIPPED_PATCH_LOCATION/27100009/27144050

 

su - oracle

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27105253

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27335416

 

系統空間檢查

grid使用者

su - grid

vim /tmp/patch_list_gihome.txt

/orasoft/27100009/27144050

/orasoft/27100009/26839277

/orasoft/27100009/27128906

/orasoft/27100009/27335416

/orasoft/27100009/27105253

 

$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt

 

oracle使用者

su - oracle

vim /tmp/patch_list_dbhome.txt

/orasoft/27100009/27335416

/orasoft/27100009/27105253

 

$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt

 

Oracle RAC,其中GI Home和Database Homes未共享且未配置ACFS檔案系統。

 

啟動叢集

/u01/app/12.2.0/grid/bin/crsctl start cluster -all

 

關閉以下服務

srvctl status listener

srvctl stop listener

srvctl status listener

 

$ sqlplus / as sysasm

SQL> shutdown immediate

 

關閉所有例項並退出plsql,然後稍等幾分鐘再開始下面的操作(因為有些程序的關閉不是瞬間的,需要那麼一點點時間)

grid升級

預執行分析,無錯誤後執行

$GI_ORACLE_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 -analyze

 

[[email protected] orasoft]# $GI_ORACLE_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009

 

OPatchauto session is initiated at Wed Apr 11 11:11:28 2018

 

System initialization log file is /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchautodb/systemconfig2018-04-11_11-11-29AM.log.

 

Session log file is /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/opatchauto2018-04-11_11-11-48AM.log

The id for this session is 6ETH

 

Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid/product/db_1

Patch applicability verified successfully on home /u01/app/12.2.0/grid/product/db_1

 

 

Bringing down CRS service on home /u01/app/12.2.0/grid/product/db_1

Prepatch operation log file location: /u01/app/grid/crsdata/crcsn1/crsconfig/crspatch_crcsn1_2018-04-11_11-12-34AM.log

CRS service brought down successfully on home /u01/app/12.2.0/grid/product/db_1

 

 

Start applying binary patch on home /u01/app/12.2.0/grid/product/db_1

Binary patch applied successfully on home /u01/app/12.2.0/grid/product/db_1

 

 

Starting CRS service on home /u01/app/12.2.0/grid/product/db_1

Postpatch operation log file location: /u01/app/grid/crsdata/crcsn1/crsconfig/crspatch_crcsn1_2018-04-11_11-16-09AM.log

CRS service started successfully on home /u01/app/12.2.0/grid/product/db_1

 

OPatchAuto successful.

 

--------------------------------Summary--------------------------------

 

Patching is completed successfully. Please find the summary as follows:

 

Host:crcsn1

CRS Home:/u01/app/12.2.0/grid/product/db_1

Summary:

 

==Following patches were SUCCESSFULLY applied:

 

Patch: /orasoft/27100009/26839277

Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log

 

Patch: /orasoft/27100009/27105253

Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log

 

Patch: /orasoft/27100009/27128906

Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log

 

Patch: /orasoft/27100009/27144050

Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log

 

Patch: /orasoft/27100009/27335416

Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log

 

 

 

OPatchauto session completed at Wed Apr 11 11:22:46 2018

Time taken to complete the session 11 minutes, 19 seconds

 

 

[[email protected] orasoft]# su - grid

Last login: Wed Apr 11 11:22:45 CST 2018

[[email protected] ~]$ $ORACLE_HOME/OPatch/opatch lspatches

27335416;OCW JAN 2018 RELEASE UPDATE 12.2.0.1.180116 (27335416)

27144050;Tomcat Release Update 12.2.0.1.0(ID:171023.0830) (27144050)

27128906;ACFS Release Update : 12.2.0.1.0 (27128906)

27105253;Database Release Update : 12.2.0.1.180116 (27105253)

26839277;DBWLM RELEASE UPDATE 12.2.0.1.0(ID:170913) (26839277)

 

以下命令檢視每個補丁的詳細情況

$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME

 

執行完第一個節點後,依次執行RAC其他節點

 

RDBMS升級

 

預執行分析,無錯誤後執行

$ORACLE_DB_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 -oh $ORACLE_DB_HOME -analyze

 

[[email protected] orasoft]# $ORACLE_DB_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 -oh $ORACLE_DB_HOME

 

OPatchauto session is initiated at Wed Apr 11 13:21:02 2018

 

System initialization log file is /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchautodb/systemconfig2018-04-11_01-21-05PM.log.

 

Session log file is /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/opatchauto2018-04-11_01-21-30PM.log

The id for this session is VYDV

 

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.2.0/db_1

Patch applicability verified successfully on home /u01/app/oracle/product/12.2.0/db_1

 

 

Verifying SQL patch applicability on home /u01/app/oracle/product/12.2.0/db_1

No step execution required.........

SQL patch applicability verified successfully on home /u01/app/oracle/product/12.2.0/db_1

 

Preparing to bring down database service on home /u01/app/oracle/product/12.2.0/db_1

No step execution required.........

Successfully prepared home /u01/app/oracle/product/12.2.0/db_1 to bring down database service

 

Performing prepatch operation on home /u01/app/oracle/product/12.2.0/db_1

Perpatch operation completed successfully on home /u01/app/oracle/product/12.2.0/db_1

 

Start applying binary patch on home /u01/app/oracle/product/12.2.0/db_1

Binary patch applied successfully on home /u01/app/oracle/product/12.2.0/db_1

 

Performing postpatch operation on home /u01/app/oracle/product/12.2.0/db_1

Postpatch operation completed successfully on home /u01/app/oracle/product/12.2.0/db_1

 

Preparing home /u01/app/oracle/product/12.2.0/db_1 after database service restarted

No step execution required.........

Prepared home /u01/app/oracle/product/12.2.0/db_1 successfully after database service restarted

 

Trying to apply SQL patch on home /u01/app/oracle/product/12.2.0/db_1

No step execution required.........

SQL patch applied successfully on home /u01/app/oracle/product/12.2.0/db_1

 

OPatchAuto successful.

 

--------------------------------Summary--------------------------------

 

Patching is completed successfully. Please find the summary as follows:

 

Host:crcsn1

RAC Home:/u01/app/oracle/product/12.2.0/db_1

Summary:

 

==Following patches were SKIPPED:

 

Patch: /orasoft/27100009/27128906

Reason: This patch is not applicable to this specified target type - "rac_database"

 

Patch: /orasoft/27100009/26839277

Reason: This patch is not applicable to this specified target type - "rac_database"

 

Patch: /orasoft/27100009/27144050

Reason: This patch is not applicable to this specified target type - "rac_database"

 

==Following patches were SUCCESSFULLY applied:

 

Patch: /orasoft/27100009/27105253

Log: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_13-21-45PM_1.log

 

Patch: /orasoft/27100009/27335416

Log: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_13-21-45PM_1.log

 

 

OPatchauto session completed at Wed Apr 11 13:22:32 2018

Time taken to complete the session 1 minute, 30 seconds

 

[[email protected] orasoft]# su - oracle

Last login: Wed Apr 11 13:22:32 CST 2018

[[email protected] ~]$ $ORACLE_HOME/OPatch/opatch lspatches

27335416;OCW JAN 2018 RELEASE UPDATE 12.2.0.1.180116 (27335416)

27105253;Database Release Update : 12.2.0.1.180116 (27105253)

 

OPatch succeeded.

 

以下命令檢視每個補丁的詳細情況

$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME

 

執行完第一個節點後,依次執行RAC其他節點

服務啟動

升級完畢後,服務自動啟動

 

例項升級

 

alter pluggable database all open;

 

SQL> show pdbs

 

    CON_ID CON_NAME   OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

 2 PDB$SEED   READ ONLY  NO

 3 CSPDB1   READ WRITE NO

 4 CSPDB2   READ WRITE NO

 5 CSPDB3   READ WRITE NO

 

[[email protected] ~]$ cd $ORACLE_HOME/OPatch

[[email protected] OPatch]$ ./datapatch -verbose

SQL Patching tool version 12.2.0.1.0 Production on Wed Apr 11 14:13:46 2018

Copyright (c) 2012, 2017, Oracle.  All rights reserved.

 

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_13959_2018_04_11_14_13_46/sqlpatch_invocation.log

 

Connecting to database...OK

Note:  Datapatch will only apply or rollback SQL fixes for PDBs

       that are in an open state, no patches will be applied to closed PDBs.

       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation

       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done

Determining current state...done

 

Current state of SQL patches:

Bundle series DBRU:

  ID 180116 in the binary registry and ID 180116 in PDB CDB$ROOT, ID 180116 in PDB PDB$SEED, ID 180116 in PDB CSPDB1, ID 180116 in PDB CSPDB2, ID 180116 in PDB CSPDB3, ID 180116 in PDB CSPDB4, ID 180116 in PDB CSPDB5, ID 180116 in PDB CSPDB6, ID 180116 in PDB CSPDB7, ID 180116 in PDB CSPDB8, ID 180116 in PDB CSPDB9, ID 180116 in PDB CSPDB10, ID 180116 in PDB CSPDB11, ID 180116 in PDB CSPDB12, ID 180116 in PDB CSPDB13, ID 180116 in PDB CSPDB14, ID 180116 in PDB CSPDB15, ID 180116 in PDB CSPDB16, ID 180116 in PDB CSPDB17, ID 180116 in PDB CSPDB18, ID 180116 in PDB CSPDB19, ID 180116 in PDB CSPDB20

 

Adding patches to installation queue and performing prereq checks...

Installation queue:

  For the following PDBs: CDB$ROOT PDB$SEED CSPDB1 CSPDB2 CSPDB3 CSPDB4 CSPDB5 CSPDB6 CSPDB7 CSPDB8 CSPDB9 CSPDB10 CSPDB11 CSPDB12 CSPDB13 CSPDB14 CSPDB15 CSPDB16 CSPDB17 CSPDB18 CSPDB19 CSPDB20

    Nothing to roll back

    Nothing to apply

 

SQL Patching tool complete on Wed Apr 11 14:16:44 2018

 

什麼也沒有做,Nothing to apply!

 

至此,升級完畢!