17
12.1.0.2 已经发布一段时间了,随着用户的增多,目前 12C 很多用户,需要将数据库从低版本升级到 12C,本文就升级 升级前,首选需要查看文档,了解哪些版本可以升级 Complete Checklist for Upgrading to Orac 另外,12C 在很多硬件&系统层面的需求有变更,需要提前准 我在升级的过程中就遇到一些问题,不得不终止升级,调整 How to Upgrade to Oracle Database 12c Re How to Upgrade to/Downgrade from Grid In C 的版本稳定性,以及各个方面的功能性,得到大家的认可。 级过程,做了详细的记录。(突然想起“多图杀猫”这个词) 级到 12C cle Database 12c Release 1 using DBUA (Doc ID 15 准备和调整整完成后,才重新升级。 elease1 (12.1.0) and Known Issues (Doc ID 208570 nfrastructure 12c and Known Issues (Doc ID 15797 516557.1) 05.1) 762.1)

How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

  • Upload
    others

  • View
    27

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

12.1.0.2 已经发布一段时间了,随着用户的增多,目前 12C

很多用户,需要将数据库从低版本升级到 12C,本文就升级过程

升级前,首选需要查看文档,了解哪些版本可以升级到

Complete Checklist for Upgrading to Oracle

另外,12C 在很多硬件&系统层面的需求有变更,需要提前准备和调整

我在升级的过程中就遇到一些问题,不得不终止升级,调整完成后

How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1)

How to Upgrade to/Downgrade from Grid Infrastructure 12c and Known Issues (Doc ID 1579762.1)

12C 的版本稳定性,以及各个方面的功能性,得到大家的认可。

本文就升级过程,做了详细的记录。(突然想起“多图杀猫”这个词)

了解哪些版本可以升级到 12C

Complete Checklist for Upgrading to Oracle Database 12c Release 1 using DBUA (Doc ID 1516557.1)

需要提前准备和调整。

调整完成后,才重新升级。

How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1)

Infrastructure 12c and Known Issues (Doc ID 1579762.1)

Database 12c Release 1 using DBUA (Doc ID 1516557.1)

How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1)

Infrastructure 12c and Known Issues (Doc ID 1579762.1)

Page 2: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

在上面需求之外,补充注意几点:

1. OCR diskgroup,至少需要 5G 空间,由于 12C 有 managment database,需要存放到 OCR diskgroup

2. 需要明确在 ASM instance 中设定参数 asm_diskstring='/dev/raw/*' , 如果不设置的话,在升级过程中,重启 cssd 进程会失败,

无法找到 voting disk

原因:如果不设置这个参数,11.2 版本,默认是到/dev/raw/*查找 voting disk,但是 12C 默认是到/dev/sd*去查找 voting disk。

势必会遇到读取权限问题,进而启动 cssd 失败。(如果使用 ASMlib,也是相同的道理,在升级前,就明确设置这个参数,不让 oracle

使用默认的方式去查找磁盘)

3. 需要保证两个节点的全部资源都正常运行,才可以升级

Page 3: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

上面的准备条件完成后,开始实际的升级步骤。

1. 创建需求目录

~~~~~~~~~~oracle 目录~~~~~~~~~~~~~~~~

# mkdir -p /u01/app/oracle/product/12.1.0/dbhome_1

# chown -R oracle:oinstall /u01/app/oracle/product/12.1.0

# chmod -R 755 /u01/app/oracle/product/12.1.0

~~~~~~~~~~grid 目录~~~~~~~~~~~~~~~~

# mkdir -p /u01/app/12.1.0/grid

# chown -R grid:oinstall /u01/app/12.1.0/grid

# chmod -R 755 /u01/app/12.1.0/grid

修改环境变量

~~~~~~~~~~~~~~oracle 用户~~~~~~~~~~~~~~两个节点 ORACLE_SID 设置不同

$ vi ~/.bash_profile

export PATH

export ORACLE_SID=orcl1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export PATH=$ORACLE_HOME/bin:$PATH

umask 022

==========原有设定===========

export ORACLE_SID=orcl1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/jdk/bin:${PATH}

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

~~~~~~~~~~grid 用户~~~~~~~~~~~~~~~~两个节点 ORACLE_SID 设置不同

export ORACLE_SID=+ASM1

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/12.1.0/grid

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/jdk/bin:${PATH}

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

==========原有设定===========

export ORACLE_SID=+ASM1

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/jdk/bin:${PATH}

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

2. 开始执行升级过程,其实与新安装的步骤基本是相同的

su - grid

cd /tmp/patch/

unzip linuxamd64_12c_grid_1of2.zip

unzip linuxamd64_12c_grid_2of2.zip

cd /tmp/patch/grid

./runInstaller

Page 4: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

3. 选择 Upgrade Oracle Grid

Page 5: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

4. 这里开始遇到问题,由于之前的 OCR 空间只有 3G,这里提示,至少需要 4424MB

Page 6: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

5. 检查一下磁盘组空间,我由于是测试环境,磁盘设置较小,并且使用 external redundancy,如果是生产环境,建议使用 normal redundancy,并且根据实际情况分配磁

盘组

6. OCR 磁盘空间不够,扩展 OCR 磁盘组,扩展步骤如下(物理磁盘添加,裸设备分配,这里不做详细解释):

a. 查询当前的 ASM 磁盘分配情况

SQL> set line 400

SQL> col path for a20

SQL> select name,PATH,GROUP_NUMBER from v$asm_disk;

NAME PATH GROUP_NUMBER

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

/dev/raw/raw4 0 <<<<<<<<<<<<<<<<<<<新增加的 6G 空盘

OCR_0000 /dev/raw/raw1 3

FRA_0000 /dev/raw/raw3 2

DATA_0000 /dev/raw/raw2 1

b. 查询磁盘组当前空间

SQL> select GROUP_NUMBER,NAME,TOTAL_MB from v$asm_diskgroup;

GROUP_NUMBER NAME TOTAL_MB

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

1 DATA 8192

2 FRA 8192

3 OCR 3072

增加磁盘到磁盘组 OCR

SQL> ALTER DISKGROUP ocr ADD DISK '/dev/raw/raw4' NAME ocr001;

Diskgroup altered.

d. 再次查询磁盘组空间

SQL> select GROUP_NUMBER,NAME,TOTAL_MB from v$asm_diskgroup;

GROUP_NUMBER NAME TOTAL_MB

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

1 DATA 8192

2 FRA 8192

3 OCR 9216 <<<<<<<<<<<<<<<<<<<扩展完成

查询磁盘,现在可以看到,磁盘已经有属主

SQL> select name,PATH,GROUP_NUMBER from v$asm_disk;

Page 7: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

NAME PATH GROUP_NUMBER

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

OCR_0000 /dev/raw/raw1 3

OCR001 /dev/raw/raw4 3 <<<<<<<<<<<<<<<<<<<新扩展的 OCR 磁盘

FRA_0000 /dev/raw/raw3 2

DATA_0000 /dev/raw/raw2 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7. 需要保证两个节点的全部资源都正常运行,才可以升级

由于节点 2 的 DB instace 没有启动,手动启动,然后点击 OK 重试解决

8. 测试环境,没有使用 EM,没有选择。

根据实际请求确定是不是要使用 EM

Page 8: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

9. 检查一下用户实际的组是不是对,没有问题的话,下一步

10. 手动修改成,之前创建的路径

Page 9: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade
Page 10: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

11. 这里有一些告警,建议将每一个告警都解决掉。

提 ASM 磁盘组的问题,注意下面的描述,12C 开始如果不设置 ASM_diskstring,默认就会查找/dev/sd*。

个人比较懒,也就注定后面遇到了问题。

Page 11: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade
Page 12: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

12. 在 node1 执行脚本,失败!!!

13. 查询错误,搜索到下面文档,提及 ASM 参数设置的问题

FAILS TO START ORA.CSSD WHEN UPGRADING GRID 12C ON NODE 1 (Doc ID 1917543.1)

检查 OCSSD log,可以看到 voting disk 是无法识别的,而之前 11.2 是正常运行的,为什么?

就是由于 12C 默认扫描磁盘的方式变为/dev/sd*导致的

~~~~~~~~~~~~~upgrade.sh 执行失败~~~~~~~~~~~~~~~~~~~~

2017-01-18 14:12:14.881694 : CSSD:1102797120: clssscthrdmain: Starting thread GMPResponse

2017-01-18 14:12:14.883050 : CSSD:486086176: clssscUpdateInitState: Set state to 0x000c1e46, based on prior state of 0x000c1e06 and requested change of

0x00000040

2017-01-18 14:12:14.883097 : CSSD:486086176: clssnmReadDiscoveryProfile: voting file discovery string()

2017-01-18 14:12:14.883101 : CSSD:486086176: clssnkInit: NK generic layer initializing.

2017-01-18 14:12:14.884219 : CSSD:1100556608: clssscthrdmain: Starting thread clssnmvDDiscThread

2017-01-18 14:12:14.884454 : GPNP:1100556608: clsgpnp_Init: [at clsgpnp0.c:654] '/u01/app/12.1.0/grid' in effect as GPnP home base.

2017-01-18 14:12:14.884461 : GPNP:1100556608: clsgpnp_Init: [at clsgpnp0.c:708] GPnP pid=29401, cli=clsuGpnpg GPNP comp tracelevel=1, depcomp tracelevel=0,

tlsrc:ORA_DAEMON_LOGGING_LEVELS, apitl:0, complog:1, tstenv:0, devenv:0, envopt:0, flags=2003

2017-01-18 14:12:14.887900 : GPNP:1100556608: clsgpnpkwf_initwfloc: [at clsgpnpkwf.c:402] Using FS Wallet Location :

/u01/app/12.1.0/grid/gpnp/node1/wallets/peer/

2017-01-18 14:12:14.887926 : GPNP:1100556608: clsgpnpkwf_initwfloc: [at clsgpnpkwf.c:414] Wallet readable. Path:

/u01/app/12.1.0/grid/gpnp/node1/wallets/peer/

2017-01-18 14:12:14.913073 : GPNP:1100556608: clsgpnp_profileGetXmlAttrValVA: [at clsgpnp.c:3351] (:GPNP00135:)Didn't find attribute Mode in profile

2017-01-18 14:12:14.913101 : GPNP:1100556608: clsgpnp_Term: [at clsgpnp0.c:1347] GPnP cli=clsuGpnpg

2017-01-18 14:12:14.914477 : CLSF:1100556608: Allocated CLSF context

2017-01-18 14:12:14.914484 : CSSD:1100556608: clssnmvDDiscThread: using discovery string for initial discovery

2017-01-18 14:12:14.914492 : SKGFD:1100556608: Discovery with str::

2017-01-18 14:12:14.914537 : SKGFD:1100556608: UFS discovery with ::

2017-01-18 14:12:14.914545 : SKGFD:1100556608: Execute glob on the string /dev/sd*

2017-01-18 14:12:14.914639 : SKGFD:1100556608: running stat on disk:/dev/sde

2017-01-18 14:12:14.914656 : SKGFD:1100556608: running stat on disk:/dev/sdd

2017-01-18 14:12:14.914663 : SKGFD:1100556608: running stat on disk:/dev/sdc

2017-01-18 14:12:14.914669 : SKGFD:1100556608: running stat on disk:/dev/sdb

Page 13: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

2017-01-18 14:12:14.914675 : SKGFD:1100556608: running stat on disk:/dev/sda1

2017-01-18 14:12:14.914681 : SKGFD:1100556608: running stat on disk:/dev/sda2

2017-01-18 14:12:14.914687 : SKGFD:1100556608: running stat on disk:/dev/sda

2017-01-18 14:12:14.914696 : SKGFD:1100556608: Fetching UFS disk :/dev/sda:

2017-01-18 14:12:14.914718 : SKGFD:1100556608: OSS discovery with ::

2017-01-18 14:12:14.915332 : CSSD:1100556608: clssnmvDiskVerify: Successful discovery of 0 disks

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

14. 根据文档,是建议 downgrade 到 11.2 之后,修改 asm_diskstring='/dev/raw/*',然后再次升级。无非就是磁盘没有权限读取,我直接修改/dev/sd* 为 777,然后再

次执行 rootupgrade.sh 脚本(注意,两个节点都需要修改)

成功执行

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[root@node1 ~]# /u01/app/12.1.0/grid/rootupgrade.sh

Performing root user operation.

The following environment variables are set as:

ORACLE_OWNER= grid

ORACLE_HOME= /u01/app/12.1.0/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/12.1.0/grid/crs/install/crsconfig_params

2017/01/18 18:29:20 CLSRSC-4015: Performing install or upgrade action for Oracle Trace File Analyzer (TFA) Collector.

2017/01/18 18:29:21 CLSRSC-4003: Successfully patched Oracle Trace File Analyzer (TFA) Collector.

2017/01/18 18:29:23 CLSRSC-464: Starting retrieval of the cluster configuration data

2017/01/18 18:33:49 CLSRSC-465: Retrieval of the cluster configuration data has successfully completed.

2017/01/18 18:33:49 CLSRSC-363: User ignored prerequisites during installation

2017/01/18 18:48:06 CLSRSC-472: Attempting to export the OCR

2017/01/18 18:48:06 CLSRSC-482: Running command: 'ocrconfig -upgrade grid oinstall'

Page 14: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

2017/01/18 18:48:18 CLSRSC-473: Successfully exported the OCR

2017/01/18 18:48:22 CLSRSC-486:

At this stage of upgrade, the OCR has changed.

Any attempt to downgrade the cluster after this point will require a complete cluster outage to restore the OCR.

2017/01/18 18:48:22 CLSRSC-541:

To downgrade the cluster:

1. All nodes that have been upgraded must be downgraded.

2017/01/18 18:48:22 CLSRSC-542:

2. Before downgrading the last node, the Grid Infrastructure stack on all other cluster nodes must be down.

2017/01/18 18:48:22 CLSRSC-543:

3. The downgrade command must be run on the node node1 with the '-lastnode' option to restore global configuration data.

2017/01/18 18:48:38 CLSRSC-343: Successfully started Oracle Clusterware stack

clscfg: EXISTING configuration version 5 detected.

clscfg: version 5 is 11g Release 2.

Successfully taken the backup of node specific configuration in OCR.

Successfully accumulated necessary OCR keys.

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

2017/01/18 18:49:08 CLSRSC-474: Initiating upgrade of resource types

2017/01/18 18:49:48 CLSRSC-482: Running command: 'upgrade model -s 11.2.0.4.0 -d 12.1.0.2.0 -p first'

2017/01/18 18:49:48 CLSRSC-475: Upgrade of resource types successfully initiated.

2017/01/18 18:50:02 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

15. 检查确认一下,GI 已经升级成功

[grid@node1 ~]$ /u01/app/12.1.0/grid/OPatch/opatch lsinventory

Oracle Interim Patch Installer version 12.1.0.1.3

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

Oracle Home : /u01/app/12.1.0/grid

Central Inventory : /u01/app/oraInventory

from : /u01/app/12.1.0/grid/oraInst.loc

OPatch version : 12.1.0.1.3

OUI version : 12.1.0.2.0

Log file location : /u01/app/12.1.0/grid/cfgtoollogs/opatch/opatch2017-01-18_19-02-38PM_1.log

Lsinventory Output file location : /u01/app/12.1.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-01-18_19-02-38PM.txt

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

Installed Top-level Products (1):

Oracle Grid Infrastructure 12c 12.1.0.2.0

There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

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

OPatch succeeded.

Page 15: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

16. 节点 2 也升级成功

[grid@node2 ~]$ /u01/app/12.1.0/grid/OPatch/opatch lsinventory

Oracle Interim Patch Installer version 12.1.0.1.3

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

Oracle Home : /u01/app/12.1.0/grid

Central Inventory : /u01/app/oraInventory

from : /u01/app/12.1.0/grid/oraInst.loc

OPatch version : 12.1.0.1.3

OUI version : 12.1.0.2.0

Log file location : /u01/app/12.1.0/grid/cfgtoollogs/opatch/opatch2017-01-18_19-12-36PM_1.log

Lsinventory Output file location : /u01/app/12.1.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-01-18_19-12-36PM.txt

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

Installed Top-level Products (1):

Oracle Grid Infrastructure 12c 12.1.0.2.0

There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

Patch level status of Cluster nodes :

Patching Level Nodes

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

0 node1,node2

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

17. 脚本执行完截图

Page 16: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

18. 在 GI 升级和安装的过程,CVU 在这里经常报错,一般是由于没有使用 DNS,CVU 会调用 nslookup 进行检测,自然会返回失败,但是我们使用的是/etc/hosts,这里可

以忽略。

Page 17: How to Upgrade to Oracle Database 12c Release1 (12.1.0 ......How to Upgrade to Oracle Database 12c Release1 (12.1.0) and Known Issues (Doc ID 2085705.1) How to Upgrade to/Downgrade

19 . 至此,GI 部分升级已经完成了!!

大功告成了吗?

是不是少点什么?

/dev/sd* 手动修改的 777 权限,这个是隐患,在每次 OS 重启之后,它们的权限还是会变回去的。

解决方法有两种:

1. 在/etc/inittab 中添加 chmod 777 /dev/sd*

2. 修改 asm_diskstring 参数

作为 DBA,我们自然是要通过 DB 的手段解决这个问题:

在其中一个节点上修改 asm_diskstring

[grid@node2 ~]$ sqlplus / as sysasm

SQL> show parameter asm_diskstring

NAME TYPE VALUE

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

asm_diskstring string

SQL> alter system set asm_diskstring='/dev/raw/*' scope=spfile; --<<<<<<<<<< asm_diskstring 设置为/dev/raw/*

这样明确告诉 OCSSD 进程去/dev/raw/*查找 voting disk,问题解决。

20. GI 部分已经升级完成,剩下就是 DB 部分,请参考另一个文档 DB upgrade 11.2 to 12C.pdf