oracle10.2.0.1升级到10.2.0.4oracle10.2.0.1升级到10.2.0.4
环境:
Windows Server2003 R2, 32位系统
Oracle 10g 版本:10.2.0.1 .0
补丁包:p6810189_10204_Win32
D:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Productionon 星期六 3月 14 07:55:34 2015
Copyright (c) 1982, 2005, Oracle. All rights reserved.
# 关闭数据库
SQL> connect sys as sysdba
输入口令:
已连接。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> quit
从 OracleDatabase 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Miningoptions 断开
#找不到ORACLE_SID
D:\>emctl stop dbconsole
Environment variable ORACLE_SID notdefined. Please define it.
#设置ORACLE_SID
D:\>set oracle_sid=orcl
#停掉dbconsole
D:\>emctl stop dbconsole
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.1.0
Copyright (c) 1996, 2005 OracleCorporation. All rights reserved.
http://moss.dec:5500/em/console/aboutApplication
OracleDBConsoleorcl 服务正在停止............
OracleDBConsoleorcl 服务已成功停止。
#停掉isqlplusctl
D:\>isqlplusctl stop
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Stopping iSQL*Plus ...
iSQL*Plus stopped.
#停掉监听
D:\oracle\product\10.2.0\db_2\BIN>lsnrctl stop
LSNRCTL for 32-bit Windows: Version10.2.0.1.0 - Production on 14-3月 -2015 08:01:32
Copyright (c) 1991, 2005, Oracle. All rights reserved.
正在连接到(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
命令执行成功
D:\oracle\product\10.2.0\db_2\BIN>
#Windows 系统里面可以直接找到安装文件,然后双击直接执行。不像Linux系统需要敲命令。
#检查安装程序要求.....
#满足条件后弹出欢迎页面
#选定路径,由于我装过两次Oracle所有有两个路径,默认跳出的路径不对,后来我手工选了要升级的那个数据库路径。
#由于没有购买Oracle产品,所有没有Metalink账号,这里只能跳过,不注册。
#概要:有4个组件可以升级
#这里不像Linux需要用root账号在终端执行一条命令,Windows 中升级后就直接到下面一步。
#退出。
#尝试启动数据库,不过忘了要启什么服务。后来就索性重启服务器了。
D:\oracle\product\10.2.0\db_2\BIN>sqlplus/nolog
SQL*Plus: Release 10.2.0.4.0 - Productionon 星期六 3月 14 08:26:01 2015
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> connect sys as sysdba
输入口令:
ERROR:
ORA-12560: TNS: 协议适配器错误
SQL> quit
D:\oracle\product\10.2.0\db_2\BIN>setoracle_sid=orcl
D:\oracle\product\10.2.0\db_2\BIN>sqlplus/nolog
SQL*Plus: Release 10.2.0.4.0 - Productionon 星期六 3月 14 08:27:28 2015
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> connect sys as sysdba
输入口令:
ERROR:
ORA-12560: TNS: 协议适配器错误
SQL> quit
D:\oracle\product\10.2.0\db_2\BIN>
——重启服务器
D:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Productionon 星期六 3月 14 08:46:46 2015
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> connect sys as sysdba
输入口令:
已连接到空闲例程。
SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does notexist
#运行数据库预升级检查
SQL> startup upgrade
ORACLE 例程已经启动。
Total System Global Area 612368384 bytes
Fixed Size 1298160 bytes
Variable Size 100663568 bytes
Database Buffers 503316480 bytes
Redo Buffers 7090176 bytes
数据库装载完毕。
数据库已经打开。
#进行数据库字典信息升级
SQL> SPOOL patch.log //打印日志,方便如果发生错误的时候,查找问题
SQL>@?/rdbms/admin/catupgrd.sql
#漫长的等待后。。。
SQL> SPOOL off //关闭日志
#关掉数据库
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
#启动数据库
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 612368384 bytes
Fixed Size 1298160 bytes
Variable Size 171966736 bytes
Database Buffers 432013312 bytes
Redo Buffers 7090176 bytes
数据库装载完毕。
数据库已经打开。
#运行utlrp.sql脚本重新编译无效PL/SQL包
SQL> @?/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2015-03-14 09:25:33
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 statusIN (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(*) FROMUTL_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 FROMdba_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 FROMdba_scheduler_running_jobs
DOC> WHERE job_name like'UTL_RECOMP_SLAVE_%';
DOC>#
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2015-03-14 09:26:09
DOC> The following query reports thenumber of objects that have compiled
DOC> with errors (objects that compilewith errors have status set to 3 in
DOC> obj$). If the number is higher thanexpected, please examine the error
DOC> messages reported with each object(using SHOW ERRORS) to see if they
DOC> point to system misconfiguration orresource constraints that must be
DOC> fixed before attempting torecompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
2
DOC> The following query reports thenumber of errors caught during
DOC> recompilation. If this number isnon-zero, please query the error
DOC> messages in the tableUTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration orresource constraints that must be
DOC> fixed before objects can compilesuccessfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
SQL>
#检查Oracle的版本
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0- Production
NLSRTL Version 10.2.0.4.0 - Production
#运行命令检查所有组件是否升级成功
SQL> select comp_id,version,status fromdba_registry;
COMP_ID VERSION
------------------------------------------------------------
STATUS
----------------------
CATALOG 10.2.0.4.0 VALID
CATPROC 10.2.0.4.0 VALID
OWM 10.2.0.4.3 VALID
JAVAVM 10.2.0.4.0 VALID
XML 10.2.0.4.0 VALID
CATJAVA 10.2.0.4.0 VALID
EXF 10.2.0.4.0 VALID
ODM 10.2.0.4.0 VALID
CONTEXT 10.2.0.4.0 VALID
XDB 10.2.0.4.0 VALID
RUL 10.2.0.4.0 VALID
ORDIM 10.2.0.4.0 VALID
APS 10.2.0.4.0 VALID
XOQ 10.2.0.4.0 VALID
AMD 10.2.0.4.0 VALID
SDO 10.2.0.4.0 VALID
EM 10.2.0.4.0 VALID
SQL>
SQL> select * from dba_registry_history;
ACTION_TIME
---------------------------------------------------------------------------
ACTION NAMESPACE
------------------------------------------------------------
VERSION ID
------------------------------ ----------
COMMENTS
--------------------------------------------------------------------------------
14-3月 -15 09.22.47.421000 上午
UPGRADE SERVER
10.2.0.4.0
Upgraded from 10.2.0.1.0
SQL>
SQL> exit
从 OracleDatabase 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options 断开
——可惜找不到10.2.0.5.0的补丁了。不过算了,日常使用不会出现大的问题。
以后有时间可以测试一下12C版本。