# 10.2.0.1 升級 到 10.2.0.5
环境介绍:
当前Oracle版本:10.2.0.1+数据库
升级Oracle版本:10.2.0.5+数据库
#关闭实例,监听 和 OEM
[oracle@XAG105 zhs]$ emctl stop dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://XAG105:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
... Stopped.
[oracle@XAG105 zhs]$ dbca
[oracle@XAG105 zhs]$
[oracle@XAG105 zhs]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 17-AUG-2018 18:49:01
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XAG105)(PORT=1521)))
The command completed successfully
[oracle@XAG105 zhs]$
[oracle@XAG105 zhs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 17 18:49:17 2018
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
修改版本标识,以安装相对rhel6而言较老的oracle
可以先保存一份:
cp /etc/redhat-release /etc/redhat-release.bak
vi /etc/redhat-release
原:CentOS Linux release 7.3.1611 (Core)
修改为: redhat-4
[oracle@XAG105 setup]$ unzip p8202632_10205_Linux-x86-64.zip
[oracle@XAG105 setup]$ cd Disk1/
[oracle@XAG105 Disk1]$ env | grep ORA
ORACLE_SID=MPACC
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[oracle@XAG105 Disk1]$ ./runInstaller
这里继续点击“continue”即可,待Oracle完成安装后,再手工执行相应脚本完成链接即可。
当oracle完成安装后,如下操作
[oracle@hyl bin]$ /u01/app/oracle/product/10.2.0/db_1/bin/relink all
--执行脚本后,会自动完成重链接操作
cp /etc/redhat-release.bak /etc/redhat-release
#手工升级库
sqlplus / as sysdba
#升级模式启动DB
SQL> startup upgrade
SQL> SPOOL /home/oracle/update.log
#重建数据字典
SQL> @/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catupgrd.sql
SQL> SPOOL OFF
#重建数据字典完成后,重启数据库
SQL> shutdown immediate;
SQL> startup
#编译无效对象
SQL> @/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/utlrp.sql
#检查升级后状态
#查看版本
SQL>select * from v$version;
SQL> col comp_name format a40
SQL> col version for a20
SQL> SELECT COMP_NAME, VERSION, STATUS MODIFID FROM SYS.DBA_REGISTRY;
[oracle@XAG105 setup]$ unzip p8350262_10205_Generic.zip
[oracle@XAG105 setup]$ cd 8350262/
[oracle@XAG105 8350262]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply
Invoking OPatch 10.2.0.4.9
Oracle Interim Patch Installer version 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.9
OUI version : 10.2.0.5.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2018-08-20_22-45-56PM.log
Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
ApplySession applying interim patch '8350262' to OH '/u01/app/oracle/product/10.2.0/db_1'
Running prerequisite checks...
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '8350262' for restore. This might take a while...
Backing up files affected by the patch '8350262' for rollback. This might take a while...
Patching component oracle.sysman.agent.core, 10.2.0.5.0a...
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/RootCert.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/SecConstants.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/RootCert.class"
Updating jar file "/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/SecConstants.class"
ApplySession adding interim patch '8350262' to inventory
Verifying the update...
Inventory check OK: Patch ID 8350262 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 8350262 are present in Oracle Home.
OPatch succeeded.
[oracle@XAG105 8350262]$
#重新配置EM
#检查/etc/hosts 文件
[oracle@XAG105 admin]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.40.105 XAG105 XAG105.COM
[oracle@XAG105 admin]$
#启动监听:
[oracle@XAG105 admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 17-AUG-2018 19:36:51
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.5.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XAG105)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XAG105)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date 17-AUG-2018 19:36:51
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XAG105)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@XAG105 admin]$
[oracle@XAG105 admin]$
#删除OEM的 dbconsole 和repository
[oracle@XAG105 admin]$ emca -deconfig dbcontrol db -repos drop
STARTED EMCA at Aug 17, 2018 7:38:26 PM
EM Configuration Assistant, Version 10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
Database SID: MPACC
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: yes
Aug 17, 2018 7:38:53 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/MPACC/emca_2018-08-17_07-38-26-PM.log.
Aug 17, 2018 7:38:53 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Aug 17, 2018 7:38:56 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Aug 17, 2018 7:38:56 PM oracle.sysman.emcp.EMReposConfig dropRepository
INFO: Dropping the EM repository (this may take a while) ...
Aug 17, 2018 7:39:15 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Aug 17, 2018 7:39:15 PM
[oracle@XAG105 admin]$
#重建EM的dbcontrol 和 repository
[oracle@XAG105 admin]$ emca -config dbcontrol db -repos create
STARTED EMCA at Aug 17, 2018 7:39:31 PM
EM Configuration Assistant, Version 10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
Database SID: MPACC
Listener port number: 1521
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /u01/app/oracle/product/10.2.0/db_1
Local hostname ................ XAG105
Listener port number ................ 1521
Database SID ................ MPACC
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: yes
Aug 17, 2018 7:40:05 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/MPACC/emca_2018-08-17_07-39-31-PM.log.
Aug 17, 2018 7:40:05 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Aug 17, 2018 7:40:56 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Aug 17, 2018 7:40:59 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Aug 17, 2018 7:43:35 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Aug 17, 2018 7:43:35 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...