Windows+Oracle 10g 10.2.0.1 Upgrade to 10.2.0.5
一台测试的单机环境需要将10.2.0.1升级到10.2.0.5,升级步骤比较简单,在此简单记录下。
0. 停掉服务
进入服务管理(services.msc)将oracle的DBConsole、iSQL*Plus、Server和Listener全部停掉
1. 升级DBSOFTWARE
解压升级包,打开升级安装程序,选择已有的安装ORACLE_HOME和安装路径,一路next。安装完成后打开Listener、Server、DBConsole和iSQL*Plus服务。
2. 升级DATABASE
必须执行,否则无法使用已有数据库:
C:\Documents and Settings\ldy>sqlplus “/as sysdba”
SQL*Plus: Release 10.2.0.5.0 – Production on 星期三 2月 15 09:26:17 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
已连接到空闲例程。
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 1258291200 bytes
Fixed Size 2077232 bytes
Variable Size 318770640 bytes
Database Buffers 922746880 bytes
Redo Buffers 14696448 bytes
数据库装载完毕。
ORA-01092: ORACLE 实例终止。强制断开连接
这个时候去查看下alert.log:
——————–
ORA-00704: 引导程序进程失败
ORA-39700: 必须用 UPGRADE 选项打开数据库
——————–
有2种选择:DBUA自动升级和手工脚本执行,两种方式都需要把server和listener服务启动起来。
2.1. DBUA
界面操作,没啥好用的,一路next下去,操作时间看你的选项(是否进行备份、移动数据文件等等操作)和数据库安装的组件,30分钟到50分钟不等。
2.2. SQLPLUS执行脚本升级
操作步骤如下
C:\Documents and Settings\ldy>sqlplus “/as sysdba”
SQL*Plus: Release 10.2.0.5.0 – Production on 星期三 2月 15 09:28:44 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
已连接到空闲例程。
SQL> STARTUP UPGRADE
ORACLE 例程已经启动。
Total System Global Area 293601280 bytes
Fixed Size 1296356 bytes
Variable Size 92276764 bytes
Database Buffers 197132288 bytes
Redo Buffers 2895872 bytes
数据库装载完毕。
数据库已经打开。
SQL> SPOOL c:\upgrade_info.log
SQL> @?/rdbms/admin/utlu102i.sql;
Oracle Database 10.2 Upgrade Information Utility 02-15-2012 09:31:15
.
**********************************************************************
Database:
**********************************************************************
–> name: TEST
–> version: 10.2.0.1.0
–> compatible: 10.2.0.1.0
–> blocksize: 8192
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
–> SYSTEM tablespace is adequate for the upgrade.
…. minimum required size: 442 MB
…. AUTOEXTEND additional space required: 2 MB
–> UNDOTBS1 tablespace is adequate for the upgrade.
…. minimum required size: 403 MB
…. AUTOEXTEND additional space required: 173 MB
–> SYSAUX tablespace is adequate for the upgrade.
…. minimum required size: 194 MB
…. AUTOEXTEND additional space required: 4 MB
–> TEMP tablespace is adequate for the upgrade.
…. minimum required size: 58 MB
…. AUTOEXTEND additional space required: 38 MB
.
**********************************************************************
Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
– No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
– No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 10.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
–> Oracle Java Packages [upgrade] VALID
–> Oracle XML Database [upgrade] VALID
–> Oracle Workspace Manager [upgrade] VALID
–> Oracle interMedia [upgrade] VALID
–> Expression Filter [upgrade] VALID
–> EM Repository [upgrade] VALID
–> Rule Manager [upgrade] VALID
.
PL/SQL 过程已成功完成。
SQL> SPOOL OFF
可以看到执行这个脚本的作用只是作为升级前的信息收集准备工作:
表空间信息(不是全部表空间,只有:SYSTEM、UNDOTBS1、SYSAUX和TEMP4个表空间),当前大小(DAB_DATA_FILES.BYTES),升级过程中是否需要进行扩张以满足升级操作;参数信息,是否需要进行和更名,是否有作废的参数;最后的升级组件的清单。
SQL> spool c:\patch.log
SQL> @?/rdbms/admin/catupgrd.sql
……
一大堆的执行日志
……
COMP_TIMESTAMP UPGRD_END 2012-02-15 10:07:20
.
Oracle Database 10.2 Upgrade Status Utility 02-15-2012 10:07:20
.
Component Status Version HH:MM:SS
Oracle Database Server VALID 10.2.0.5.0 00:12:00
JServer JAVA Virtual Machine VALID 10.2.0.5.0 00:09:48
Oracle XDK VALID 10.2.0.5.0 00:00:32
Oracle Database Java Packages VALID 10.2.0.5.0 00:00:20
Oracle XML Database VALID 10.2.0.5.0 00:01:57
Oracle Workspace Manager VALID 10.2.0.5.0 00:00:48
Oracle interMedia VALID 10.2.0.5.0 00:05:42
Oracle Expression Filter VALID 10.2.0.5.0 00:00:18
Oracle Enterprise Manager VALID 10.2.0.5.0 00:01:40
Oracle Rule Manager VALID 10.2.0.5.0 00:00:09
.
Total Upgrade Time: 00:34:42
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC> The above PL/SQL lists the SERVER components in the upgraded
DOC> database, along with their current version and status.
DOC>
DOC> Please review the status and version columns and look for
DOC> any errors in the spool log file. If there are errors in the spool
DOC> file, or any components are not VALID or not the current version,
DOC> consult the Oracle Database Upgrade Guide for troubleshooting
DOC> recommendations.
DOC>
DOC> Next shutdown immediate, restart for normal operation, and then
DOC> run utlrp.sql to recompile any invalid application objects.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL>
检查下c:\patch.log看看是否有错误发生;上面最后的输出显示了本次升级耗时34分43秒,接下来重启数据库,执行下utlrp.sql编译无效对象,最后查看下升级结果:
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 1258291200 bytes
Fixed Size 2077232 bytes
Variable Size 385879504 bytes
Database Buffers 855638016 bytes
Redo Buffers 14696448 bytes
数据库装载完毕。
数据库已经打开。
SQL> @?/rdbms/admin/utlrp.sql
……
一大堆执行日志
……
SQL> select count(*) from dba_objects where status=’VALID’;
COUNT(*)
———-
46642
SQL> select count(*) from dba_objects where status=’INVALID’;
COUNT(*)
———-
0
SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
COMP_NAME
——————————————————————————–
VERSION STATUS
—————————— ———————-
Oracle Enterprise Manager
10.2.0.5.0 VALID
Oracle interMedia
10.2.0.5.0 VALID
Oracle XML Database
10.2.0.5.0 VALID
COMP_NAME
——————————————————————————–
VERSION STATUS
—————————— ———————-
Oracle Expression Filter
10.2.0.5.0 VALID
Oracle Rule Manager
10.2.0.5.0 VALID
Oracle Workspace Manager
10.2.0.5.0 VALID
COMP_NAME
——————————————————————————–
VERSION STATUS
—————————— ———————-
Oracle Database Catalog Views
10.2.0.5.0 VALID
Oracle Database Packages and Types
10.2.0.5.0 VALID
JServer JAVA Virtual Machine
10.2.0.5.0 VALID
COMP_NAME
——————————————————————————–
VERSION STATUS
—————————— ———————-
Oracle XDK
10.2.0.5.0 VALID
Oracle Database Java Packages
10.2.0.5.0 VALID
已选择11行。
SQL> select * from v$version;
BANNER
—————————————————————-
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 – 64bi
PL/SQL Release 10.2.0.5.0 – Production
CORE 10.2.0.5.0 Production
TNS for 64-bit Windows: Version 10.2.0.5.0 – Production
NLSRTL Version 10.2.0.5.0 – Production
最后是升级下DBConsole
C:\Documents and Settings\ldy>set ORACLE_SID=TEST
C:\Documents and Settings\ldy>emca -upgrade db
STARTED EMCA at Feb 15, 2012 10:19:12 AM
EM Configuration Assistant, Version 10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
ORACLE_HOME for the database to be upgraded: D:\oracle\product\10.2.0\db_1
Database SID: TEST
Listener port number: 1521
Do you wish to continue? [yes(Y)/no(N)]: Y
Feb 15, 2012 10:19:51 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at D:\oracle\product\10.2.0\db_1\cfgtoollog
s\emca\TEST\emca_2012-02-15_10-19-12-AM.log.
Feb 15, 2012 10:19:59 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) …
Feb 15, 2012 10:20:45 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) …
Feb 15, 2012 10:21:06 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Feb 15, 2012 10:21:06 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) …
Feb 15, 2012 10:30:56 AM oracle.sysman.emcp.EMConfig perform
SEVERE: Error starting Database Control
Refer to the log file at D:\oracle\product\10.2.0\db_1\cfgtoollogs\emca\TEST\emc
a_2012-02-15_10-19-12-AM.log for more details.
Could not complete the configuration. Refer to the log file at D:\oracle\product
\10.2.0\db_1\cfgtoollogs\emca\TEST\emca_2012-02-15_10-19-12-AM.log for more deta
ils.
报错了,检查了下日志
SEVERE: Error starting Database Control
Refer to the log file at D:\oracle\product\10.2.0\db_1\cfgtoollogs\emca\TEST\emca_2012-02-15_10-19-12-AM.log for more details.
Feb 15, 2012 10:30:56 AM oracle.sysman.emcp.EMConfig perform
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Error starting Database Control
at oracle.sysman.emcp.EMDBPostConfig.performUpgrade(EMDBPostConfig.java:766)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:235)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:196)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:184)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:494)
at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1161)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:478)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:426)
这个是升级之后的SSL认证bug,可以打补丁解决,如果不需要SSL访问,可以改成原来的非SSL模式即可打开:
C:\Documents and Settings\ldy>set ORACLE_SID=TEST
C:\Documents and Settings\ldy>emctl unsecure dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.5.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
https://gtlions:1158/em/console/aboutApplication
Configuring DBConsole for HTTP… Done.
DBCONSOLE already stopped… Done.
Agent is already stopped… Done.
Unsecuring dbconsole… Started.
DBConsole is now unsecured… Done.
Unsecuring dbconsole… Sucessful.
C:\Documents and Settings\ldy>emctl start dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.5.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
http://gtlions:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control …The OracleDBConsoleTE
ST service is starting…………….
The OracleDBConsoleTEST service was started successfully.
至此,升级补丁结束。
-The End-