注意:生产环境请根据实际环境做相应的变更。
参考文档:
SuperCluster - 11.2.0.4 Grid Infrastructure and Database Upgrade for 11.2.0.3 (文档 ID 1919830.1)
Oracle Grid Infrastructure 11.2.0.4.x Patch Set Update SUPPLEMENTAL README (文档 ID 1641136.1)
How to backup a Grid Infrastructure installation (文档 ID 1482803.1)
Complete Checklist for Manual Upgrades to 11gR2 (文档 ID 837570.1)
注意,grid和oracle都是rolling的方式升级(一个节点先关集群升级,另一个节点对外服务),所以不需要停机窗口,但是前提需要保证业务连的都是scanip,且集群中没有单实例数据库
从其他用户回切到root用户,其他用户必须在wheel组里
uid=1000(grid) gid=1001(oinstall) groups=10(wheel),1001(oinstall),1002(dba),1003(racoper),1004(asmdba),1006(asmadmin)
1 升级前准备
1.1查看数据库、操作系统基本信息
[root@rac1 ~]# uname -a
Linux ex01db01.shandongair.com.cn 2.6.32-400.21.1.el5uek #1 SMP Wed Feb 20 01:35:01 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@ex01db02 ~]# su - oracle
ORACLE_DB=test02
ORACLE_UNQNAME=test02
ORACLE_SID=test022
ORACLE_BASE=/u01/app/oracle
ORACLE_TRACE=/u01/app/oracle/diag/rdbms/test02/test022/trace
ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
CRS_HOME=/u01/app/11.2.0.3/grid
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0.3/dbhome_1/lib:
PATH=/usr/local/bin:/bin:/usr/bin:/u01/app/oracle/product/11.2.0.3/dbhome_1/bin:/u01/app/oracle/product/11.2.0.3/dbhome_1/OPatch:/u01/app/11.2.0.3/grid/bin
[oracle@ex01db02 ~]$ export ORACLE_SID=webora2
[oracle@ex01db02 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jun 21 10:16:25 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> set linesize 300 pagesize 500
SQL> col comp_name format a36
SQL> col status format a10
SQL> select comp_name,version,status from dba_registry;
COMP_NAME VERSION STATUS
------------------------------------ ------------------------------ ----------
OWB 11.2.0.3.0 VALID
Oracle Application Express 3.2.1.00.12 VALID
Oracle Enterprise Manager 11.2.0.3.0 VALID
OLAP Catalog 11.2.0.3.0 VALID
Spatial 11.2.0.3.0 VALID
Oracle Multimedia 11.2.0.3.0 VALID
Oracle XML Database 11.2.0.3.0 VALID
Oracle Text 11.2.0.3.0 VALID
Oracle Expression Filter 11.2.0.3.0 VALID
Oracle Rules Manager 11.2.0.3.0 VALID
Oracle Workspace Manager 11.2.0.3.0 VALID
Oracle Database Catalog Views 11.2.0.3.0 VALID
Oracle Database Packages and Types 11.2.0.3.0 VALID
JServer JAVA Virtual Machine 11.2.0.3.0 VALID
Oracle XDK 11.2.0.3.0 VALID
Oracle Database Java Packages 11.2.0.3.0 VALID
OLAP Analytic Workspace 11.2.0.3.0 VALID
Oracle OLAP API 11.2.0.3.0 VALID
Oracle Real Application Clusters 11.2.0.3.0 VALID
19 rows selected.
SQL> select name from v$database;
NAME
---------
WEBORA
SQL>
1.2备份数据库
有一个人专门负责数据库的备份,包括
数据库热备全备脚本:
#!/bin/sh
. ~/.bash_profile
DATE=`date +%Y-%m-%d-%H-%M-%S`
rman target / log=/backup/scripts/rmanfull_log/rmanfull_log_$DATE <<eof
run{
allocate channel d1 type disk;
allocate channel d2 type disk;
backup as compressed backupset database format '/backup/rmanfull/full%U%T' include current controlfile;
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup format '/backup/rmanfull/arch_full%T%U' archivelog all;
crosscheck archivelog all;
delete noprompt archivelog until time='sysdate-1/3';
crosscheck archivelog all;
backup spfile format '/backup/rmanfull/spfile_%d_%T_%s_%p.bak';
backup current controlfile format '/backup/rmanfull/ctl_%d_%T_%t.bak';
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
release channel d1;
release channel d2;
}
eof
1.3备份集群
节点一:
[root@ex01db01 ~]# su - grid
ORACLE_SID=+ASM1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/11.2.0.3/grid
LD_LIBRARY_PATH=/u01/app/11.2.0.3/grid/lib:
PATH=/usr/local/bin:/bin:/usr/bin:/u01/app/11.2.0.3/grid/bin:/u01/app/11.2.0.3/grid/OPatch
[grid@ex01db01 ~]$ su root
Password: sdayxwh200~
OLR:
[root@ex01db01 grid]# ocrconfig -local -manualbackup
ex01db01 2016/06/22 18:53:05 /u01/app/11.2.0.3/grid/cdata/ex01db01/backup_20160622_185305.olr
ex01db01 2016/06/21 15:55:20 /u01/app/11.2.0.3/grid/cdata/ex01db01/backup_20160621_155520.olr
ex01db01 2013/07/22 14:32:11 /u01/app/11.2.0.3/grid/cdata/ex01db01/backup_20130722_143211.olr
OCR:
[root@ex01db01 grid]# ocrconfig -manualbackup
ex01db02 2016/06/22 18:53:30 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20160622_185330.ocr
ex01db02 2016/06/21 15:57:32 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20160621_155732.ocr
ex01db01 2013/07/22 15:13:11 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20130722_151311.ocr
节点二:
OLR:
[root@ex01db02 ~]# /u01/app/11.2.0.3/grid/bin/ocrconfig -local -manualbackup
ex01db02 2016/06/22 18:55:22 /u01/app/11.2.0.3/grid/cdata/ex01db02/backup_20160622_185522.olr
ex01db02 2016/06/21 15:57:13 /u01/app/11.2.0.3/grid/cdata/ex01db02/backup_20160621_155713.olr
ex01db02 2013/07/22 14:36:23 /u01/app/11.2.0.3/grid/cdata/ex01db02/backup_20130722_143623.olr
OCR:
[root@ex01db02 ~]# /u01/app/11.2.0.3/grid/bin/ocrconfig -manualbackup
ex01db02 2016/06/22 18:55:27 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20160622_185527.ocr
ex01db02 2016/06/22 18:53:30 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20160622_185330.ocr
ex01db02 2016/06/21 15:57:32 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20160621_155732.ocr
ex01db01 2013/07/22 15:13:11 /u01/app/11.2.0.3/grid/cdata/ex01-cluster/backup_20130722_151311.ocr
上述数据库的备份专门一个人负责
下面的归档备份专门一个人负责
归档全备脚本:
#!/bin/sh
. ~/.bash_profile
DATE=`date +%Y-%m-%d-%H-%M-%S`
rman target / log=/backup/scripts/archbak_log/archbak_log_$DATE <<eof
run{
allocate channel d1 type disk;
allocate channel d2 type disk;
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup format '/backup/archbak/arch_full%T%U' archivelog all;
crosscheck archivelog all;
delete noprompt archivelog until time='sysdate-1/3';
crosscheck archivelog all;
backup spfile format '/backup/archbak/spfile_%d_%T_%s_%p.bak';
backup current controlfile format '/backup/archbak/ctl_%d_%T_%t.bak';
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
release channel d1;
release channel d2;
}
eof
详见脚本
1.5关闭数据库,备份软件
使用lvm的snap进行os的备份
节点一root用户执行:
对GPT 表做备份
dd if=/dev/sda of=/backup/zyr_upgrade_bak/fs_20160622ex01db01_GPT.bin bs=512 count=34
备份/u01
lvcreate -L100G -s -n snap_LVDbOra1 /dev/VGExaDb/LVDbOra1
为创建的快照设置卷标
e2label /dev/VGExaDb/snap_LVDbOra1 U01_SNAP1
查看是否创建成功
lvs
备份/
lvcreate -L30G -s -n snap_LVDbSys1 /dev/VGExaDb/LVDbSys1
为创建的快照设置卷标
e2label /dev/VGExaDb/snap_LVDbSys1 ROOT_SNAP1
查看是否创建成功
lvs
备份/boot
tar cvf /backup/zyr_upgrade_bak/fs_20160622ex01bd01_bak.tar /boot >ex01db01_tar.out 2>ex01db01_stderr.out
节点二root用户执行:
对GPT 表做备份
dd if=/dev/sda of=/backup/zyr_upgrade_bak/fs_20160622ex01db02_GPT.bin bs=512 count=34
备份/u01
lvcreate -L100G -s -n snap_LVDbOra2 /dev/VGExaDb/LVDbOra1
为创建的快照设置卷标
e2label /dev/VGExaDb/snap_LVDbOra2 U01_SNAP1
查看是否创建成功
lvs
备份/
lvcreate -L30G -s -n snap_LVDbSys2 /dev/VGExaDb/LVDbSys1
为创建的快照设置卷标
e2label /dev/VGExaDb/snap_LVDbSys2 ROOT_SNAP1
查看是否创建成功
lvs
备份/boot
tar cvf /backup/zyr_upgrade_bak/fs_20160622ex01bd02_bak.tar /boot >ex01db02_tar.out 2>ex01db02_stderr.out
不建议采用下面的操作进行备份(滚动备份rac)
节点一操作
srvcrl stop instance –d fxsjqar -n ex01db01
关闭集群
crsctl stop crs –f
cp -p /etc/init.d/init.ohasd /backup/software/soft_back/
cp -p /etc/init.d/ohasd /backup/software/soft_back/
cp -p /etc/inittab /backup/software/soft_back/
cp -p /etc/oracle/setasmgid /backup/software/soft_back/
cp -pr /opt/oracle /backup/software/soft_back/
cp -pr /etc/oracle/lastgasp /backup/software/soft_back/
cp -pr /etc/oracle/oprocd /backup/software/soft_back/
cp -pr /etc/oracle/scls_scr /backup/software/soft_back/
cp -p /etc/oracle/ocr.loc /backup/software/soft_back/
cp -p /etc/oracle/olr.loc /backup/software/soft_back/
mkdir /backup/software/soft_back/rc0.d/
mkdir /backup/software/soft_back/rc1.d/
mkdir /backup/software/soft_back/rc2.d/
mkdir /backup/software/soft_back/rc3.d/
mkdir /backup/software/soft_back/rc3.d/
mkdir /backup/software/soft_back/rc4.d/
mkdir /backup/software/soft_back/rc5.d/
mkdir /backup/software/soft_back/rc5.d/
mkdir /backup/software/soft_back/rc6.d/
cp /etc/rc0.d/K15ohasd /backup/software/soft_back/rc0.d/
cp /etc/rc1.d/K15ohasd /backup/software/soft_back/rc1.d/
cp /etc/rc2.d/K15ohasd /backup/software/soft_back/rc2.d/
cp /etc/rc3.d/K15ohasd /backup/software/soft_back/rc3.d/
cp /etc/rc3.d/S96ohasd /backup/software/soft_back/rc3.d/
cp /etc/rc4.d/K15ohasd /backup/software/soft_back/rc4.d/
cp /etc/rc5.d/K15ohasd /backup/software/soft_back/rc5.d/
cp /etc/rc5.d/S96ohasd /backup/software/soft_back/rc5.d/
cp /etc/rc6.d/K15ohasd /backup/software/soft_back/rc6.d/
cp -p /etc/oraInst.loc /backup/software/soft_back/
cp -pr /u01/app/oraInventory /backup/software/soft_back/
cp -p /etc/oratab /backup/software/soft_back/
tar zcf u01_`date +%Y-%m-%d_%H-%M-%S`.tar.gz /u01/*
启动集群
crsctl start crs
确保节点一资源都起来了
crsctl stat res –t
节点二操作
srvcrl stop instance –d fxsjqar -n ex01db02
关闭集群
crsctl stop crs –f
cp -p /etc/init.d/init.ohasd /backup/software/soft_back/
cp -p /etc/init.d/ohasd /backup/software/soft_back/
cp -p /etc/inittab /backup/software/soft_back/
cp -p /etc/oracle/setasmgid /backup/software/soft_back/
cp -pr /opt/oracle /backup/software/soft_back/
cp -pr /etc/oracle/lastgasp /backup/software/soft_back/
cp -pr /etc/oracle/oprocd /backup/software/soft_back/
cp -pr /etc/oracle/scls_scr /backup/software/soft_back/
cp -p /etc/oracle/ocr.loc /backup/software/soft_back/
cp -p /etc/oracle/olr.loc /backup/software/soft_back/
mkdir /backup/software/soft_back/rc0.d/
mkdir /backup/software/soft_back/rc1.d/
mkdir /backup/software/soft_back/rc2.d/
mkdir /backup/software/soft_back/rc3.d/
mkdir /backup/software/soft_back/rc3.d/
mkdir /backup/software/soft_back/rc4.d/
mkdir /backup/software/soft_back/rc5.d/
mkdir /backup/software/soft_back/rc5.d/
mkdir /backup/software/soft_back/rc6.d/
cp /etc/rc0.d/K15ohasd /backup/software/soft_back/rc0.d/
cp /etc/rc1.d/K15ohasd /backup/software/soft_back/rc1.d/
cp /etc/rc2.d/K15ohasd /backup/software/soft_back/rc2.d/
cp /etc/rc3.d/K15ohasd /backup/software/soft_back/rc3.d/
cp /etc/rc3.d/S96ohasd /backup/software/soft_back/rc3.d/
cp /etc/rc4.d/K15ohasd /backup/software/soft_back/rc4.d/
cp /etc/rc5.d/K15ohasd /backup/software/soft_back/rc5.d/
cp /etc/rc5.d/S96ohasd /backup/software/soft_back/rc5.d/
cp /etc/rc6.d/K15ohasd /backup/software/soft_back/rc6.d/
cp -p /etc/oraInst.loc /backup/software/soft_back/
cp -pr /u01/app/oraInventory /backup/software/soft_back/
cp -p /etc/oratab /backup/software/soft_back/
tar zcf u01_`date +%Y-%m-%d_%H-%M-%S`.tar.gz /u01/*
启动集群
crsctl start crs
crsctl stat res –t
2 升级grid集群(一个节点40分钟)
2.1上传解压11.2.0.4.0 grid软件压缩包到/backup/software目录
[root@rac1 11.2.0.4.0]# ls –l //查看解压的压缩包,使用root用户解压即可
total 3667808
drwxr-xr-x 7 root root 4096 Aug 27 2013 database
drwxr-xr-x 7 root root 4096 Aug 27 2013 grid
-rw-r--r-- 1 root root 1395582860 May 3 2014 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r-- 1 root root 1151304589 May 3 2014 p13390677_112040_Linux-x86-64_2of7.zip
-rw-r--r-- 1 root root 1205251894 May 3 2014 p13390677_112040_Linux-x86-64_3of7.zip
2.2升级grid
提前上传软件,提前解压,包括grid和oracle软件。
升级以前一定要确认两个节点的crs都启动起来了
[root@rac1 grid]# crsctl stat res –t
[root@rac2 grid]# crsctl stat res –t
[grid@rac1 grid]$ pwd //进入grid安装包目录
/backup/software/11.2.0.4.0/grid
字符界面即可
[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -upgrade -src_crshome /u01/app/11.2.0.3/grid -dest_crshome /u01/app/11.2.0.4/grid -dest_version 11.2.0.4.0 -n ex01db01,ex01db02 -rolling -fixup -fixupdir /home/grid/fixit -verbose
查看一下fixit目录里面的文件,看有些错误是否需要修复
[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -upgrade -n rac1,rac2 -src_crshome /u01/app/11.2.0.3/grid/ -dest_crshome /u01/app/11.2.0.4/grid/ -dest_version 11.2.0.4.0 –verbose //预安装检查
[root@rac1 ~]# mkdir -p /u01/app/11.2.0.4/grid/ //节点1创建新的grid软件目录
[root@rac2 ~]# mkdir -p /u01/app/11.2.0.4/grid/ //节点2创建新的grid软件目录
[root@rac1 ~]# chown -R grid:oinstall /u01/app/11.2.0.4/ //节点1赋予新建grid目录权限
[root@rac1 ~]# chmod -R 775 /u01/app/11.2.0.4/ //节点1赋予新建grid目录权限
[root@rac2 ~]# chown -R grid:oinstall /u01/app/11.2.0.4/ //节点2赋予新建grid目录权限
[root@rac2 ~]# chmod -R 775 /u01/app/11.2.0.4/ //节点2赋予新建grid目录权限
[grid@rac1 grid]$ ./runInstaller //升级grid
选择skip software update,点击next
选择update选项,点击next
选择所有语言,点击next //不用添加所用语言,添加中文即可
进行grid互信测试,成功后,点击next //前面已经检查过,这个地方可以不测试
注:必须保证RAC集群的各个节点集群处于正常启动状态,否则会报错。
与原有属组保持一致,点击next
指定grid软件安装到新的目录下,点击next,路径要写对
[grid@rac1 u01]$ crsctl query crs softwareversion
Oracle Clusterware version on node [rac1] is [11.2.0.3.0]
[grid@rac2 ~]$ crsctl query crs softwareversion
Oracle Clusterware version on node [rac2] is [11.2.0.3.0]
忽略DNS解析错误,点击next
点击install
出现运行脚本的界面后先执行以下操作再运行脚本
以下所有命令所有数据库节点都需要执行,同时要注意,我们需要升级的11.2.0.4目录下面的OPatch
更新. Bash_profile 中$ORACLE_HOME为/u01/app/11.2.0.4/grid/
同时注意OPatch要出现在PATH中
更新OPatch
[root@rac1 software]# cd /u01/app/11.2.0.4/grid/
[root@rac1 grid]# mv OPatch/ bak_OPatch/
mkdir OPatch
[root@rac1 grid]# cp -r /backup/software/OPatch/ ./OPatch/
[root@rac1 grid]# chown -R grid:oinstall ./OPatch/
上面升级了OPatch,两个节点上都做一下
chown -R grid:oinstall /backup/software/22378167/
10、unmount ACFS文件系统、DBFS文件系统
a、如果 ACFS文件系统、DBFS文件系统已经用于Oracle database software
执行以下命令找出CRS控制的ACFS的资源名
crsctl stat res -w "TYPE = ora.acfs.type" -p | grep VOLUME
关闭ACFS资源
srvctl stop filesystem -d <volume device path> -n <node to stop file system on>
b、如果 ACFS文件系统、DBFS文件系统没有被用,但是已经mount
root用户执行以下命令unmount
/sbin/acfsutil registry
/bin/umount <mount-point>
查看是否卸载成功
/sbin/acfsutil info fs
成功提示:
验证两个节点的时间是否一致
Grid用户执行:
一定要which opatch,确认这个命令来自于11.2.0.4这个目录
opatch napply -oh /u01/app/11.2.0.4/grid -local /backup/software/22378167/22191577/21948348/
opatch napply -oh /u01/app/11.2.0.4/grid -local /backup/software/22378167/22191577/21948355/
opatch apply -oh /u01/app/11.2.0.4/grid -local /backup/software/22378167/22191577/21948347/
12、重新挂载 ACFS文件系统、DBFS文件系统
a、如果 ACFS文件系统、DBFS文件系统已经用于Oracle database software
执行以下命令找出CRS控制的ACFS的资源名
crsctl stat res -w "TYPE = ora.acfs.type" -p | grep VOLUME
使用ACFS资源
srvctl start filesystem -d <volume device path> -n <node to start file system on>
b、如果 ACFS文件系统、DBFS文件系统没有被用,但是之前mount过
root用户执行以下命令mount
/sbin/acfsutil registry
/bin/mount <mount-point>
查看是否卸载成功
/sbin/acfsutil info fs
重新更新. Bash_profile 中$ORACLE_HOME为/u01/app/11.2.0.3/grid/
[root@rac1 grid]# /u01/app/11.2.0.4/grid/rootupgrade.sh //节点1运行升级脚本
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0.4/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_par
User ignored Prerequisites during installation
Installing Trace File Analyzer
ASM upgrade has started on first node.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.cvu' on 'rac1'
CRS-2673: Attempting to stop 'ora.oc4j' on 'rac1'
CRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1'
CRS-2673: Attempting to stop 'ora.ARCH.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'
CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.cvu' on 'rac1' succeeded
CRS-2677: Stop of 'ora.registry.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac1'
CRS-2677: Stop of 'ora.scan1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.rac2.vip' on 'rac1'
CRS-2677: Stop of 'ora.rac2.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ARCH.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac1'
CRS-2677: Stop of 'ora.ons' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac1'
CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac1'
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
OLR initialization - successful
Replacing Clusterware entries in inittab
clscfg: EXISTING configuration version 5 detected.
clscfg: version 5 is 11g Release 2.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
[root@rac1 grid]#
[root@rac2 grid]# /u01/app/11.2.0.4/grid/rootupgrade.sh //节点2运行升级脚本
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0.4/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_par ams
User ignored Prerequisites during installation
Installing Trace File Analyzer
clscfg: EXISTING configuration version 5 detected.
clscfg: version 5 is 11g Release 2.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Started to upgrade the Oracle Clusterware. This operation may take a few minutes.
Started to upgrade the CSS.
Started to upgrade the CRS.
The CRS was successfully upgraded.
Successfully upgraded the Oracle Clusterware.
Oracle Clusterware operating version was successfully set to 11.2.0.4.0
ASM upgrade has finished on last node.
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
[root@rac2 grid]#
[root@rac2 grid]# crsctl check cluster -all
**************************************************************
rac1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
rac2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
[root@rac1 /]# /u01/app/11.2.0.4/grid/bin/crsctl query crs softwareversion //检查集群版本
Oracle Clusterware version on node [rac1] is [11.2.0.4.0]
[root@rac1 grid]# /u01/app/11.2.0.4/grid/bin/crsctl query crs activeversion //检查当前使用集群版本
Oracle Clusterware active version on the cluster is [11.2.0.4.0]
[root@rac2 /]# /u01/app/11.2.0.4/grid/bin/crsctl query crs softwareversion //检查集群版本
Oracle Clusterware version on node [rac2] is [11.2.0.4.0]
[root@rac2 grid]# /u01/app/11.2.0.4/grid/bin/crsctl query crs activeversion //检查当前使用集群版本
Oracle Clusterware active version on the cluster is [11.2.0.4.0]
[root@rac1 /]# /u01/app/11.2.0.4/grid/bin/crsctl stat res –t //检查升级后集群资源状态
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARCH.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATA.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCR.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.registry.acfs
ONLINE ONLINE rac1
ONLINE ONLINE rac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac1
ora.cvu
1 ONLINE ONLINE rac1
ora.oc4j
1 ONLINE ONLINE rac2
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac11g.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac1
[root@rac1 /]#
忽略验证错误,点击next,至此grid升级完成
更新. Bash_profile 中$ORACLE_HOME为/u01/app/11.2.0.4/grid/
2.3验证
opatch lsinventory | grep "Patch"
[root@rac1 /]# /u01/app/11.2.0.4/grid/bin/crsctl query crs softwareversion//检查集群版本
Oracle Clusterware version on node [rac1] is [11.2.0.4.0]
[root@rac1 grid]# /u01/app/11.2.0.4/grid/bin/crsctl query crs activeversion//检查当前使用集群版本
Oracle Clusterware active version on the cluster is [11.2.0.4.0]
[root@rac2 /]# /u01/app/11.2.0.4/grid/bin/crsctl query crs softwareversion//检查集群版本
Oracle Clusterware version on node [rac2] is [11.2.0.4.0]
[root@rac2 grid]# /u01/app/11.2.0.4/grid/bin/crsctl query crs activeversion//检查当前使用集群版本
Oracle Clusterware active version on the cluster is [11.2.0.4.0]
3 升级oracle软件及数据库(软件一个节点40分钟,数据库一个30分钟)
3.1、上传解压11.2.0.4.0 oracle软件压缩包到/backup/software目录
[root@rac1 11.2.0.4.0]# ls –l //查看解压的oracle软件
total 3667808
drwxr-xr-x 7 root root 4096 Aug 27 2013 database
drwxr-xr-x 7 root root 4096 Aug 27 2013 grid
-rw-r--r-- 1 root root 1395582860 May 3 2014 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r-- 1 root root 1151304589 May 3 2014 p13390677_112040_Linux-x86-64_2of7.zip
-rw-r--r-- 1 root root 1205251894 May 3 2014 p13390677_112040_Linux-x86-64_3of7.zip
3.2、升级oracle软件及数据库
注:升级数据库必须保证数据库的sga_size大于1028M
[root@rac1 ~]# mkdir -p /u01/app/oracle/product/11.2.0.4/dbhome_1/ //节点1创建新的oracle软件目录
[root@rac2 ~]# mkdir -p /u01/app/oracle/product/11.2.0.4/dbhome_1/ //节点2创建新的oracle软件目录
[root@rac1 ~]# chown -R oracle:oinstall /u01/app/oracle/product/11.2.0.4/ //节点1赋予新建oracle软件目录权限
[root@rac1 ~]# chmod -R 775 /u01/app/oracle/product/11.2.0.4/ //节点1赋予新建oracle软件目录权限
[root@rac2 ~]# chown -R oracle:oinstall /u01/app/oracle/product/11.2.0.4/ //节点2赋予新建oracle软件目录权限
[root@rac2 ~]# chmod -R 775 /u01/app/oracle/product/11.2.0.4/ //节点2赋予新建oracle软件目录权限
[root@rac1 ~]# xhost + //允许任何用户使用图形界面
access control disabled, clients can connect from any host
[root@rac1 ~]# su – oracle //切换到oracle用户
[oracle@rac1 ~]$ cd /backup/software/11.2.0.4.0/database/ //进入高版本oracle软件安装目录
[oracle@rac1 database]$ ./runInstaller //升级oracle软件
去掉打勾,点击next
选择跳过软件更新,点击next
选择更新database软件,点击next
输入oracle用户密码,点击test,测试互信通过后,点击next
导入所有语言,点击next
选择安装企业版oracle软件,点击next
更改oracle软件安装至新的目录,点击next
选择相应的管理组,点击next
忽略DNS解析和scan警告,点击next
点击install,等待安装完成
在集群各节点运行脚本,完成后点击OK
[root@rac1 11.2.0.4]# /u01/app/oracle/product/11.2.0.4/dbhome_1/root.sh //节点1运行root脚本
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0.4/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@rac1 11.2.0.4]#
[root@rac2 11.2.0.4]# /u01/app/oracle/product/11.2.0.4/dbhome_1/root.sh //节点2运行root脚本
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0.4/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
升级数据库到最新的Patch
换oralce用户的环境变量ORACLE_HOME为11.2.0.4的目录,注意增加OPatch目录
使用root用户执行patch升级脚本,升级oracle用户的PSU
[root@rac1 ~]# cd /u01/app/oracle/product/11.2.0.4/dbhome_1/
mv OPatch/ bak_OPatch/
cp -r /backup/software/OPatch/ ./OPatch/
chown -R oracle:oinstall OPatch/
chmod -R 775 OPatch/
[root@rac2 db_1]# su - oracle
[oracle@rac2 ~]$ opatch version
OPatch Version: 11.2.0.3.12
OPatch succeeded.
[root@rac1 22378167]# chown -R oracle:oinstall /backup/software/22378167/
登陆oracle用户,生成oracle用户的ocm响应文件
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /backup/software/22378167/oracle_ocm.rsp
登陆oracle用户,执行软件升级脚本
注意:这个地方,不要使用ORACLE_HOME
需要su - oracle
su root,执行,如果提示找不到pm文件,那么多数是权限的问题,增加755即可
opatch auto /backup/software/22378167/22191577 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 -ocmrf /backup/software/22378167/oracle_ocm.rsp
勾选不再显示此页,点击cancel,我们采用脚本升级数据库,请忽略下图。
注意,这个界面是点击数据库升级中的ok以后的界面提示。
3.3、脚本升级数据库步骤
3.3.1关闭数据库监听,全备数据库归档日志
su -grid
olsnodes
crsctl stat res -t //显示集群中的listern
srvctl disable listener -n ex01db01
srvctl disable listener -n ex01db02
srvctl disable scan_listener
srvctl stop listener -n ex01db01 -f
srvctl stop listener -n ex01db02 -f
srvctl stop scan_listener
crsctl stat res -t
ps -ef|grep LOCAL=NO|grep -v grep|awk '{print $2}'|xargs kill -9
//查处各个节点所有已存在连接并kill掉,必须oracle用户执行。
ps -ef|grep LOCAL=NO|grep -v grep|awk '{print $2}'
确认没有输出
下面就可以进行备份了
节点一操作:
su - oracle
export ORACLE_SID=CRMDB1
sqlplus / as sysdba
select instance_name from v$instance;
select group#,thread#,sequence#,status from v$log;
alter system archive log current;
select group#,thread#,sequence#,status from v$log;
exit
节点二操作:
su - oracle
export ORACLE_SID=CRMDB2
sqlplus / as sysdba
select instance_name from v$instance;
select group#,thread#,sequence#,status from v$log;
alter system archive log current;
select group#,thread#,sequence#,status from v$log;
exit
3.3.1更改各节点环境变量
在任意节点的oracle系统用户下使用srvctl命令更新oracle用户目录
[oracle@rac1 ~]$ srvctl upgrade database -d rac11g -o /u01/app/oracle/product/11.2.0.4/dbhome_1/
[oracle@rac1 ~]$ cat .bash_profile //查看节点1 oracle环境变量
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# User specific environment and startup programs
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_SID=test021
export ORACLE_UNQNAME=test02
export ORACLE_DB=test02
export CRS_HOME=/u01/app/11.2.0.3/grid
export ORACLE_TRACE=${ORACLE_BASE}/diag/rdbms/${ORACLE_DB}/${ORACLE_SID}/trace
export EDITOR=vi
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$CRS_HOME/bin
env | grep ORACLE;env | grep CRS_HOME; env | grep PATH
export PATH
[oracle@rac1 ~]$ . .bash_profile //环境变量生效
[grid@rac1 ~]$ cat .bash_profile //查看节点1 grid环境变量
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# User specific environment and startup programs
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_SID=test021
export ORACLE_UNQNAME=test02
export ORACLE_DB=test02
export CRS_HOME=/u01/app/11.2.0.4/grid
export ORACLE_TRACE=${ORACLE_BASE}/diag/rdbms/${ORACLE_DB}/${ORACLE_SID}/trace
export EDITOR=vi
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$CRS_HOME/bin
env | grep ORACLE;env | grep CRS_HOME; env | grep PATH
export PATH
[grid@rac1 ~]$ . .bash_profile //环境变量生效
[oracle@rac2 ~]$ cat .bash_profile //查看节点2 oracle环境变量
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# User specific environment and startup programs
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_SID=test022
export ORACLE_UNQNAME=test02
export ORACLE_DB=test02
export CRS_HOME=/u01/app/11.2.0.3/grid
export ORACLE_TRACE=${ORACLE_BASE}/diag/rdbms/${ORACLE_DB}/${ORACLE_SID}/trace
export EDITOR=vi
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$CRS_HOME/bin
env | grep ORACLE;env | grep CRS_HOME; env | grep PATH
[oracle@rac2 ~]$ . .bash_profile //环境变量生效
[grid@rac2 ~]$ cat .bash_profile //查看节点2 grid环境变量
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# User specific environment and startup programs
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_SID=test022
export ORACLE_UNQNAME=test02
export ORACLE_DB=test02
export CRS_HOME=/u01/app/11.2.0.4/grid
export ORACLE_TRACE=${ORACLE_BASE}/diag/rdbms/${ORACLE_DB}/${ORACLE_SID}/trace
export EDITOR=vi
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$CRS_HOME/bin
env | grep ORACLE;env | grep CRS_HOME; env | grep PATH
[grid@rac2 ~]$ . .bash_profile //环境变量生效
归档全备脚本:
#!/bin/sh
. ~/.bash_profile
DATE=`date +%Y-%m-%d-%H-%M-%S`
rman target / log=/backup/scripts/archbak_log/archbak_log_$DATE <<eof
run{
allocate channel d1 type disk;
allocate channel d2 type disk;
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup format '/backup/archbak/arch_full%T%U' archivelog all;
crosscheck archivelog all;
delete noprompt archivelog until time='sysdate-1/3';
crosscheck archivelog all;
backup spfile format '/backup/archbak/spfile_%d_%T_%s_%p.bak';
backup current controlfile format '/backup/archbak/ctl_%d_%T_%t.bak';
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
release channel d1;
release channel d2;
}
eof
3.3.2脚本升级数据库
用11.2.0.3的软件将数据库open,然后创建数据库恢复点(数据库升级成功后需要删除drop RESTORE POINT grpt_bf_upgr;)
CREATE RESTORE POINT grpt_bf_upgr GUARANTEE FLASHBACK DATABASE;
SELECT * FROM V$RESTORE_POINT where name = 'GRPT_BF_UPGR';
注:如果有dataguard,则需要设归档路径2为alter system set log_archive_dest_state_2=DEFER;
然后dataguard端取消日志应用:alter database recover managed standby database cancel;
注:升级前必须关闭各节点实例
[oracle@rac2 ~]$ cp /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/init* /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
[oracle@rac1 ~]$ cp /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/init* /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
[oracle@rac2 ~]$ cp /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/orapw* /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
[oracle@rac1 ~]$ cp /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/orapw* /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
[oracle@rac2 ~]$
cp /u01/app/oracle/product/11.2.0.3/dbhome_1/network/admin/tnsnames.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/
[oracle@rac1 ~]$
cp /u01/app/oracle/product/11.2.0.3/dbhome_1/network/admin/tnsnames.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/
查询两个节点以下文件的权限
Oracle用户
-rwsr-s--x 1 oracle asmadmin 239626641 Feb 11 2015 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/oracle
Grid用户
-rwsr-s--x 1 grid oinstall 209914471 Feb 11 2015 /u01/app/11.2.0.4/grid/bin/oracle
如果不对,则需要关闭集群进行修改
Chown oracle:asmadmin /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle
chmod 6751 /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle
使用.3的oracle软件登陆
SQL> alter system set cluster_database=false scope=spfile; //修改参数
set lines 200
记录原来的listener_networks参数之后将其修改为空
select name, value from v$parameter where name='listener_networks';
alter system set listener_networks='' sid='*' scope=both;
SQL> spool /home/oracle/invalidthams.txt
SQL>select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where status='INVALID'; //检查升级前数据库无效对象。
SQL> spool off
grid用户,11.2.0.3软件
srvctl stop database -d message -o immediate
下面的工作需要修改ORACLE_HOME=11.2.0.4,同时使用srvctl,修改启动目录为11.2.0.4,在一个节点执行srvctl upgrade即可
oracle用户,11.2.0.4软件
srvctl upgrade database -d message -o /u01/app/oracle/product/11.2.0.4/dbhome_1/
SQL> startup upgrade //upgrade模式打开节点2数据库
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 1040191464 bytes
Database Buffers 201326592 bytes
Redo Buffers 8892416 bytes
Database mounted.
Database open.
SQL> spool /home/oracle/invalid.txt
SQL>select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where status='INVALID'; //检查升级前数据库无效对象。
SQL> spool off
SQL> @?/rdbms/admin/utlu112i.sql //运行预升级检查脚本,必须运行该脚本
SQL> @?/rdbms/admin/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 04-20-2016 19:00:38
Script Version: 11.2.0.4.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name: RAC11G
--> version: 11.2.0.3.0
--> compatible: 11.2.0.0.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V14
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 919 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 631 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Real Application Clusters [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle Application Express [upgrade] VALID
... APEX will only be upgraded if the version of APEX in
... the target Oracle home is higher than the current one.
--> Oracle OLAP API [upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> Database contains schemas with objects dependent on DBMS_LDAP package.
.... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
.... USER APEX_030200 has dependent objects.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
**********************************************************************
Oracle recommends removing all hidden parameters prior to upgrading.
To view existing hidden parameters execute the following command
while connected AS SYSDBA:
SELECT name,description from SYS.V$PARAMETER WHERE name
LIKE '\_%' ESCAPE '\'
Changes will need to be made in the init.ora or spfile.
**********************************************************************
Oracle recommends reviewing any defined events prior to upgrading.
To view existing non-default events execute the following commands
while connected AS SYSDBA:
Events:
SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'
Changes will need to be made in the init.ora or spfile.
*********************************************************************
SQL> set echo on
SQL> spool /home/oracle/upgrade.log
SQL> set time on
建议VNC跑
17:00:51 SQL> @?/rdbms/admin/catupgrd.sql //运行数据库升级脚本
[oracle@rac2 ~]$ tail -100f upgrade.log //查看升级日志
17:29:00 SQL>
17:29:00 SQL> SET SERVEROUTPUT OFF
17:29:00 SQL> SET VERIFY ON
17:29:00 SQL> commit;
Commit complete.
17:29:00 SQL>
17:29:00 SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
17:29:10 SQL>
17:29:10 SQL>
17:29:10 SQL> DOC
17:29:10 DOC>#######################################################################
17:29:10 DOC>#######################################################################
17:29:10 DOC>
17:29:10 DOC> The above sql script is the final step of the upgrade. Please
17:29:10 DOC> review any errors in the spool log file. If there are any errors in
17:29:10 DOC> the spool file, consult the Oracle Database Upgrade Guide for
17:29:10 DOC> troubleshooting recommendations.
17:29:10 DOC>
17:29:10 DOC> Next restart for normal operation, and then run utlrp.sql to
17:29:10 DOC> recompile any invalid application objects.
17:29:10 DOC>
17:29:10 DOC> If the source database had an older time zone version prior to
17:29:10 DOC> upgrade, then please run the DBMS_DST package. DBMS_DST will upgrade
17:29:10 DOC> TIMESTAMP WITH TIME ZONE data to use the latest time zone file shipped
17:29:10 DOC> with Oracle.
17:29:10 DOC>
17:29:10 DOC>#######################################################################
17:29:10 DOC>#######################################################################
17:29:10 DOC>#
17:29:10 SQL>
17:29:10 SQL> Rem Set errorlogging off
17:29:10 SQL> SET ERRORLOGGING OFF;
17:29:10 SQL>
17:29:10 SQL> REM END OF CATUPGRD.SQL
17:29:10 SQL>
17:29:10 SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
17:29:10 SQL> REM This forces user to start a new sqlplus session in order
17:29:10 SQL> REM to connect to the upgraded db.
17:29:10 SQL> exit
[oracle@rac2 ~]$
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 19:43:03 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 630501376 bytes
Fixed Size 2255872 bytes
Variable Size 406848512 bytes
Database Buffers 213909504 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
SQL> @?/rdbms/admin/utlrp.sql //运行无效对象重编译脚本
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2015-12-17 17:33:42
DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2015-12-17 17:34:34
DOC> The following query reports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL>
SQL>select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where status='INVALID'; //检查升级后数据库无效对象。
[oracle@rac2 ~]$ sqlplus / as sysdba //登录节点2数据库
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 17 17:53:28 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount //启动到mount状态
SQL> alter system set cluster_database=true scope=spfile; //修改参数
System altered.
SQL> shutdown immediate //关闭节点2 数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 17 18:12:18 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
SQL> startup //重启数据库
相关参数修改查询:
select distinct(value) from gv$parameter where name = '_file_size_increase_increment'
如果结果与下图不符,则设置
alter system set "_file_size_increase_increment"=2143289344 sid='*' scope=both;
如果_kill_diagnostics_timeout" and "_lm_rcvr_hang_allow_time"被设置,则取消
select distinct(name), value from gv$parameter where name in ('_kill_diagnostics_timeout','_lm_rcvr_hang_allow_time');
SYS@PRIM1> alter system reset "_kill_diagnostics_timeout" sid='*' scope=spfile;
SYS@PRIM1> alter system reset "_lm_rcvr_hang_allow_time" sid='*' scope=spfile;
重新设置listener_networks参数为原来的值
SYS@PRIM1> alter system set listener_networks='<original value>' sid='*' scope=both;
SQL> spool /home/oracle/upgrade.log
SQL> set time on
SQL> @?/rdbms/admin/catbundle.sql psu apply
SQL>@?/rdbms/admin/catbundle.sql exa apply ---此步骤一体机执行
@?/rdbms/admin/utlrp.sql
查看日志
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
catbundle_EXA_<database SID>_APPLY_<TIMESTAMP>.log ---此步骤一体机执行
catbundle_EXA_<database SID>_GENERATE_<TIMESTAMP>.log ---此步骤一体机执行
验证:
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 21 14:39:03 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> shutdown immediate
SQL> startup
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> set linesize 300 pagesize 500
col comp_name format a36
col status format a10
select comp_name,version,status from dba_registry;
SQL> SQL> SQL>
COMP_NAME VERSION STATUS
------------------------------------ ------------------------------ ----------
OWB 11.2.0.3.0 VALID
Oracle Application Express 3.2.1.00.12 VALID
Oracle Enterprise Manager 11.2.0.4.0 VALID
OLAP Catalog 11.2.0.4.0 VALID
Spatial 11.2.0.4.0 VALID
Oracle Multimedia 11.2.0.4.0 VALID
Oracle XML Database 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
Oracle Database Catalog Views 11.2.0.4.0 VALID
Oracle Database Packages and Types 11.2.0.4.0 VALID
JServer JAVA Virtual Machine 11.2.0.4.0 VALID
Oracle XDK 11.2.0.4.0 VALID
Oracle Database Java 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
Oracle Real Application Clusters 11.2.0.4.0 VALID
19 rows selected.
SQL> select action,comments from registry$history;
14:24:16 SQL> select action,comments from registry$history;
ACTION COMMENTS
------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
APPLY Patchset 11.2.0.2.0
APPLY Patchset 11.2.0.2.0
VIEW INVALIDATE view invalidation
UPGRADE Upgraded from 11.2.0.3.0
APPLY PSU 11.2.0.4.160119
5 rows selected.
14:24:55 SQL>
删除之前创建的数据库恢复点
DROP RESTORE POINT GRPT_BF_UPGR;
启动节点二
至此,rac升级完成
重跑exachk做进一步确认
全部升级完成,经过1~2周测试应用没问题后
1、删除/和/u01的快照
节点一root用户执行:
lvremove /dev/VGExaDb/snap1_LVDbOra1
lvs
lvremove /dev/VGExaDb/snap1_LVDbSys1
lvs
节点二root用户执行:
lvremove /dev/VGExaDb/snap1_LVDbOra2
lvs
lvremove /dev/VGExaDb/snap1_LVDbSys2
lvs
2、Run Exachk or HealthCheck
3、Re-configure the Enterprise Manager Cloud Control 12c targets in the EM Console to use the new Oracle Homes
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31345818/viewspace-2121087/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31345818/viewspace-2121087/