Oracle 12.2.0.1升級至12.2.0.1.190115

升級步驟

  • Oracle 12.2.0.1升級至12.2.0.1.190115
一、閱讀readme文件
二、檢查更新opatch
三、備份程序
四、使用opatchauto工具進行數據庫升級
五、打OJVM補丁

一、閱讀readme文件html

 

二、檢查更新opatchnode

12.1.0.2.0】版本是12.1.0.1.3 更新至12.2.0.1.13之上
【12.2.0.1.0】版本是12.2.0.1.6 更新至12.2.0.1.12之上
--更新opatchhttps://updates.oracle.com/download/6880880.html Opatch下載地址連接:https://share.weiyun.com/5d28Fqi 密碼:521215  【打補丁的工具】連接:https://share.weiyun.com/5krgk4P 密碼:521215  【補丁包】$ORACLE_HOME/OPatch/opatch version
$ORACLE_HOME/OPatch/opatch lspatches

chmod -R 777 /oracle/soft/p6880880_122010_Linux-x86-64.zip

--------------------------------oracle opatch
su - oracle
ls -ld $ORACLE_HOME/OPatch*
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch`date +\%Y\%m\%d`bak && cd /oracle/soft && unzip p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME
$ORACLE_HOME/OPatch/opatch version

RAC環境下沒法在grid用戶下直接執行,會報權限不足,須要root用戶mv opatch
--------------------------------grid opatch
su - grid
ls -ld $ORACLE_HOME/OPatch*
cd $ORACLE_HOME/OPatch
pwd
su - 
mv /oracle/app/12.2.0/grid/OPatch /oracle/app/12.2.0/grid/OPatch`date +\%Y\%m\%d`
unzip /oracle/soft/p6880880_122010_Linux-x86-64.zip -d /oracle/app/12.2.0/grid   【注意此處改成你grid的目錄】
chown -R grid:oinstall /oracle/app/12.2.0/grid/OPatch
su - grid
$ORACLE_HOME/OPatch/opatch version

三、備份程序linux

【備份軟件】
su - root
mkdir -p /oracle/backup_soft
nohup tar -cvf /oracle/backup_soft/`date +\%Y\%m\%d`_oracle.tar            /oracle/app/oracle            >/oracle/backup_soft/`date +\%Y\%m\%d`_oracle.tar.log &
nohup tar -cvf /oracle/backup_soft/`date +\%Y\%m\%d`_12.2.0.tar            /oracle/app/12.2.0            >/oracle/backup_soft/`date +\%Y\%m\%d`_12.2.0.tar.log &
nohup tar -cvf /oracle/backup_soft/`date +\%Y\%m\%d`_grid.tar              /oracle/app/grid              >/oracle/backup_soft/`date +\%Y\%m\%d`_grid.tar.log &
nohup tar -cvf /oracle/backup_soft/`date +\%Y\%m\%d`_oraInventory.tar      /oracle/app/oraInventory      >/oracle/backup_soft/`date +\%Y\%m\%d`_oraInventory.tar.log &
nohup tar -cvf /oracle/backup_soft/`date +\%Y\%m\%d`_etc.tar               /etc                          >/oracle/backup_soft/`date +\%Y\%m\%d`_etc.tar.log &

四、使用opatchauto工具進行數據庫升級web

su – root
mkdir -p /oracle/soft/12c_patch
cd /oracle/soft/12c_patch
unzip /oracle/soft/p28980109_122010_Linux-x86-64.zip -d /oracle/soft/12c_patch   【解壓目錄位置無所謂,主要是下面更改的權限問題】
chmod -R 777 /oracle/soft/12c_patch

方法1:GI和DB分開打
【To patch only the GI home】
su - root
export UNZIPPED_PATCH_LOCATION=/oracle/soft/12c_patch/28980109          【注意此處你解壓的位置可能不是這裏,須要定義不一樣的位置】
export GI_HOME=/oracle/app/12.2.0/grid                                  【注意此處你的gird的home目錄可能不是這個,須要根據實際來修改】
export PATH=$PATH:$GI_HOME/OPatch
opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $GI_HOME -analyze此處遇到報錯:
  
  
  
  
  

 
發現缺乏文件,解決方法:
yum install perl*
查找Basename.pm文件,若是root目錄下沒有,則拷到對應的目錄下:
find / -name "Basename.pm"
cp /usr/share/perl5/File/Basename.pm /root/perl5/lib/perl5/File/Basename.pm
find / -name "Cwd.pm"
ln -s /u01/app/12.2.0/grid/perl/lib/5.22.0/x86_64-linux-thread-multi /root/perl5/lib/perl5 【注意此處的目錄可能不一致】
export PERL5LIB=/u01/app/12.2.0/grid/perl/lib/5.22.0 【注意此處的目錄可能不一致】
再次執行:
opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $GI_HOME -analyze

yum install perl*查找Basename.pm文件,若是root目錄下沒有,則拷到對應的目錄下:
find / -name "Basename.pm"
cp /usr/share/perl5/File/Basename.pm /root/perl5/lib/perl5/File/Basename.pm
find / -name "Cwd.pm"
ln -s /u01/app/12.2.0/grid/perl/lib/5.22.0/x86_64-linux-thread-multi /root/perl5/lib/perl5 【注意此處的目錄可能不一致】
export PERL5LIB=/u01/app/12.2.0/grid/perl/lib/5.22.0 【注意此處的目錄可能不一致】
再次執行:
opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $GI_HOME -analyze
find / -name "Basename.pm"
cp /usr/share/perl5/File/Basename.pm /root/perl5/lib/perl5/File/Basename.pm
find / -name "Cwd.pm"
ln -s /u01/app/12.2.0/grid/perl/lib/5.22.0/x86_64-linux-thread-multi /root/perl5/lib/perl5 【注意此處的目錄可能不一致】
export PERL5LIB=/u01/app/12.2.0/grid/perl/lib/5.22.0 【注意此處的目錄可能不一致】
再次執行:
opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $GI_HOME -analyze
cp /usr/share/perl5/File/Basename.pm /root/perl5/lib/perl5/File/Basename.pmfind / -name "Cwd.pm"
ln -s /u01/app/12.2.0/grid/perl/lib/5.22.0/x86_64-linux-thread-multi /root/perl5/lib/perl5 【注意此處的目錄可能不一致】
export PERL5LIB=/u01/app/12.2.0/grid/perl/lib/5.22.0 【注意此處的目錄可能不一致】
再次執行:opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $GI_HOME -analyze
opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $GI_HOME 【To patch only the DB home】 su - root export UNZIPPED_PATCH_LOCATION=/oracle/soft/12c_patch/28980109 【注意此處須要修改成你解壓補丁包的位置】 export ORACLE_HOME=/oracle/app/oracle/product/12.2.0/db_1 【注意修改你此處的oracle家目錄位置】 export PATH=$PATH:$ORACLE_HOME/OPatch opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $ORACLE_HOME -analyze依舊報錯,查看日誌:
[root@gsrzrac01 /root]
#find / -name "Cwd.pm"
/opt/oracle/products/12.2.0/perl/lib/5.22.0/x86_64-linux-thread-multi/Cwd.pm
/opt/grid/products/12.2.0/perl/lib/5.22.0/x86_64-linux-thread-multi/Cwd.pm
/usr/lib64/perl5/vendor_perl/Cwd.pm

[root@gsrzrac01 /root]
#export PERL5LIB=/opt/grid/products/12.2.0/perl/lib/5.22.0 【切換了用戶,致使臨時定義的變量失效了,從新定義變量】

以後再次執行:
opatchauto apply $UNZIPPED_PATCH_LOCATION/ 28828733 -oh $ORACLE_HOME - analyze
opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -oh $ORACLE_HOME 方法2:GI+DB一塊兒打 su - root export UNZIPPED_PATCH_LOCATION=/oracle/soft/12c_patch/28980109 export GI_HOME=/oracle/app/12.2.0/grid export PATH=$PATH:$GI_HOME/OPatch opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 -analyze opatchauto apply $UNZIPPED_PATCH_LOCATION/28828733 --12C補丁列表信息 $ORACLE_HOME/OPatch/opatch version $ORACLE_HOME/OPatch/opatch lspatches $ORACLE_HOME/OPatch/opatch lsinventory --檢查數據字典中補丁信息 set lines 500 pages 500 col description for a80 col action_time for a35 col action for a10 col comments for a50 col VERSION for a20 col NAMESPACE for a20 col BUNDLE_SERIES for a20 select * from registry$history; select patch_id,version,action,status,action_time,description from dba_registry_sqlpatch;

五、打OJVM補丁sql

【OJVM】
1、ojvm補丁檢查
su - oracle
export PATCH_TOP_DIR=/oracle/soft/12c_patch/28980109
export PATH=$PATH:$ORACLE_HOME/OPatch
opatch prereq CheckConflictAgainstOHWithDetail -ph $PATCH_TOP_DIR/28790651

2、關閉全部服務(shut down all the services (database, ASM, listeners, nodeapps, and CRS daemons)
For an Oracle RAC environment, shut down all the services (database, ASM, listeners, nodeapps, and CRS daemons) running from the Oracle home on all the nodes you want to patch. su – root
/oracle/app/12.2.0/grid/bin/crsctl stop cluster -all -----中止全部節點集羣服務


3、打OJVM補丁,全部節點都要打(OPatch is used on only one node at a time.)
su - oracle
export PATCH_TOP_DIR=/oracle/soft/12c_patch/28980109
export PATH=$PATH:$ORACLE_HOME/OPatch
cd $PATCH_TOP_DIR/28790651
$ORACLE_HOME/OPatch/opatch apply
$ORACLE_HOME/OPatch/opatch lspatches
$ORACLE_HOME/OPatch/opatch lsinventory

第一個節點打徹底部補丁,去其餘計算節點,挨個打完。4、啓服務 (After all nodes are patched, start all services. ) su – root /oracle/app/12.2.0/grid/bin/crsctl start cluster -all -----啓動全部節點集羣服務 5、Loading Modified SQL Files Into the Database 1)Starting the Database for Post Installation Steps in an Oracle RAC Environment On only one node, perform the following steps to start an Oracle RAC database in startup upgrade mode. sqlplus / as sysdba SQL> startup 啓動全部服務的時候數據庫資源以及啓動了 SQL> alter system set cluster_database=false scope=spfile; $ORACLE_HOME/bin/srvctl stop database -d ndscdb sqlplus / as sysdba SQL> startup upgrade 2) cd $ORACLE_HOME/OPatch ./datapatch -verbose 過程見下面 sqlplus / as sysdba SQL> shutdown immediate; 3)Restarting the Database after Running the Post Installation Steps in an Oracle RAC Environment To start the database back in normal mode sqlplus / as sysdba SQL> startup SQL> alter system set cluster_database=true scope=spfile; SQL> shutdown immediate; $ORACLE_HOME/bin/srvctl start database -d ndscdb 6、失效對象 cd $ORACLE_HOME/rdbms/admin sqlplus / as sysdba SQL> @utlrp.sql set lin 300 pages 5000 col object_name for a40 col owner for a20 select count(*) from dba_objects where status='INVALID'; select count(*) from dba_objects where status='INVALID' and owner='SYS'; select owner,object_name,object_type,status from dba_objects where status='INVALID'; 7、檢查數據字典中補丁信息 set lines 500 pages 500 col description for a75 col action_time for a35 col action for a10 col comments for a50 col VERSION for a25 col NAMESPACE for a20 col BUNDLE_SERIES for a20 select * from registry$history; select patch_id,version,action,status,action_time,description from dba_registry_sqlpatch;
相關文章
相關標籤/搜索