查看DB版本

[oracle@redhat6 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 6 21:12:32 2013

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 208769024 bytes
Fixed Size                 2211928 bytes
Variable Size            125833128 bytes
Database Buffers          75497472 bytes
Redo Buffers               5226496 bytes
Database mounted.
Database opened.
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE   11.2.0.1.0     Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

1.解压补丁包并合并

11.2.0.3的补丁包总共有七个,七个文件的不同作用参考如下链接

http://blog.csdn.net/tianlesoftware/article/details/6818770

升级数据库软件只需要解压第一个和第二个文件即可,如下

p10404530_112030_Linux-x86-64_1of7.zip

p10404530_112030_Linux-x86-64_2of7.zip

[oracle@redhat6 11204_patch_1]$ unzip /opt/oracle11gR2/p10404530_112030_Linux-x86-64_1of7.zip
[oracle@redhat6 11204_patch]$ unzip /opt/oracle11gR2/p10404530_112030_Linux-x86-64_2of7.zip

将第二个解压后的文件拷贝到第一个解压后的相应目录底下

[oracle@redhat6 Components]$

/u01/11204_patch/database/stage/Components

[oracle@redhat6 Components]$ cp -R * /u01/11204_patch_1/database/stage/Components/

2.升级的主要步骤
a.备份数据库(以便升级失败,可以进行恢复)
b.运行patchset,升级oracle软件
c.准备新的ORACLE_HOME
d.运行dbua或者脚本升级实例
e.检查升级后的版本信息和无效对象
2.1 关闭与oracle相关的服务
lsnrctl stop
shutdown immediate
emctl stop dbconsole
2.2备份DB主要备份以下目录
ORACLE_HOME/dbs
ORACLE_HOME/network/admin
ORACLE_HOME/hostname_dbname
ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_hostname_dbname
2.3升级Oracle software

[oracle@redhat6 ~]$ cd /u01/11204_patch_1/database/
[oracle@redhat6 database]$ ls
doc install readme.html response rpm runInstaller sshsetup stage welcome.html

[oracle@redhat6 database]./runInstaller

升级oracle 11.2.0.1.0到11.2.0.3.0_第1张图片



升级oracle 11.2.0.1.0到11.2.0.3.0_第2张图片

升级oracle 11.2.0.1.0到11.2.0.3.0_第3张图片
安装结束的时候,用root用户执行一下两个脚本orainstRoot.sh和root.sh

2.4将11.2.0.1下ORACLE_HOME下的文件拷贝新的ORACLE_HOME下,操作如下

[oracle@redhat6 dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@redhat6 dbs]$ cp * /u01/app/oracle/product/11.2.0.3/db_1/dbs/
[oracle@redhat6 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/network/admin
[oracle@redhat6 admin]$ cp -R * /u01/app/oracle/product/11.2.0.3/db_1/network/admin/

2.5修改oracle配置文件

[oracle@redhat6 ~]$ cat .bash_profile |grep ORACLE_HOME
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3/db_1
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[oracle@redhat6 ~]$ cat /etc/oratab
#

 

# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#  $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
hjj:/u01/app/oracle/product/11.2.0.3/db_1:Y
2.6在新ORACLE_HOME下启动sqlplus并以AS SYSDBA权限登陆

SQL>SPOOL upgrade_info.log

SQL>@/u01/app/oracle/product/11.2.0.3/db_1/rdbms/admin/utlu112i.sql

SQL>SPOOL OFF


2.7关闭数据库数据库重启一下

SQL>shutdown immediate

SQL>starup upgrade --必须upgrade

[oracle@redhat6 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 8 03:16:38 2013

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, OLAP, Data Mining and Real Application Testing options

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE   11.2.0.3.0     Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

SQL> select status from v$instance;

STATUS
------------
OPEN MIGRATE

--编译无效对象

SQL> @/u01/app/oracle/product/11.2.0.3/db_1/rdbms/admin/utlrp.sql

--执行升级脚本

SQL> @/u01/app/oracle/product/11.2.0.3/db_1/rdbms/admin/catupgrd.sql

执行完后会自动 shutdown immediate,而且执行时间比较长

[oracle@redhat6 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 8 04:13:52 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 208769024 bytes
Fixed Size                 2226936 bytes
Variable Size            142607624 bytes
Database Buffers          58720256 bytes
Redo Buffers               5214208 bytes
Database mounted.
Database opened.
SQL> select status from v$instance;

STATUS
------------
OPEN