查看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 bytesVariable Size 125833128 bytesDatabase Buffers 75497472 bytesRedo Buffers 5226496 bytesDatabase mounted.Database opened.SQL> select * from v$version;BANNER
--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionPL/SQL Release 11.2.0.1.0 - ProductionCORE 11.2.0.1.0 ProductionTNS for Linux: Version 11.2.0.1.0 - ProductionNLSRTL Version 11.2.0.1.0 - Production1.解压补丁包并合并
11.2.0.3的补丁包总共有七个,七个文件的不同作用参考如下链接
升级数据库软件只需要解压第一个和第二个文件即可,如下
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_HOMEd.运行dbua或者脚本升级实例e.检查升级后的版本信息和无效对象2.1 关闭与oracle相关的服务lsnrctl stopshutdown immediateemctl stop dbconsole2.2备份DB主要备份以下目录ORACLE_HOME/dbsORACLE_HOME/network/adminORACLE_HOME/hostname_dbnameORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_hostname_dbname2.3升级Oracle software[oracle@redhat6 ~]$ cd /u01/11204_patch_1/database/
[oracle@redhat6 database]$ lsdoc install readme.html response rpm runInstaller sshsetup stage welcome.html[oracle@redhat6 database]./runInstaller
安装结束的时候,用root用户执行一下两个脚本orainstRoot.sh和root.sh2.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_1export ORACLE_HOMEPATH=$ORACLE_HOME/bin:$PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libCLASSPATH=$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:Y2.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 ProductionWith 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 ProductionPL/SQL Release 11.2.0.3.0 - ProductionCORE 11.2.0.3.0 ProductionTNS for Linux: Version 11.2.0.3.0 - ProductionNLSRTL 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 bytesVariable Size 142607624 bytesDatabase Buffers 58720256 bytesRedo Buffers 5214208 bytesDatabase mounted.Database opened.SQL> select status from v$instance;STATUS
------------OPEN