Oracle 12.2.0.1升级至12.2.0.1.190115

升级步骤

  • Oracle 12.2.0.1升级至12.2.0.1.190115
1、阅读readme文件
2、检查更新opatch
3、备份程序
4、使用opatchauto工具进行数据库升级
5、打OJVM补丁

1、阅读readme文件

2、检查更新opatch

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

3、备份程序

【备份软件】
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 &

4、使用opatchauto工具进行数据库升级

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此处遇到报错:
   
   
   
   
Oracle 12.2.0.1升级至12.2.0.1.190115_第1张图片
发现缺少文件,解决方法:
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

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依旧报错,查看日志:
Oracle 12.2.0.1升级至12.2.0.1.190115_第2张图片
[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;

5、打OJVM补丁

【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;

你可能感兴趣的:(Oracle 12.2.0.1升级至12.2.0.1.190115)