oracle的小版本升级:从10.2.0.1升级到10.2.0.4需要准备的升级包:p6810189_10204_Linux-x861、当前版本SQL> conn /as sysdbaConnected.SQL> select * from v$version;BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProdPL/SQL Release 10.2.0.1.0 - ProductionCORE 10.2.0.1.0 ProductionTNS for Linux: Version 10.2.0.1.0 - ProductionNLSRTL Version 10.2.0.1.0 - Production2、将升级包上传到oracle server的OS上3、将server上的所有的和oracle有关的服务全部停止:OEM、isqlplus、数据库、监听[oracle@oracle3 ~]$ emctl stop dbconsole --停止OEMTZ set to PRCOracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.http://oracle3:1158/em/console/aboutApplicationStopping Oracle Enterprise Manager 10g Database Control ... ... Stopped. [oracle@oracle3 ~]$ isqlplusctl stop ---停止isqlplusiSQL*Plus 10.2.0.1.0Copyright (c) 2003, 2005, Oracle. All rights reserved.getnameinfo failedgetnameinfo failediSQL*Plus instance on port 5560 is not running ...[oracle@oracle3 ~]$ sqlplus /nologSQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 6 09:13:10 2014Copyright (c) 1982, 2005, Oracle. All rights reserved.SQL> conn /as sysdbaConnected.SQL> shutdown immediate --停止数据库服务Database closed.Database dismounted.ORACLE instance shut down.SQL> exitDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options[oracle@oracle3 ~]$ lsnrctl stop --停止监听服务LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-JUN-2014 09:13:28Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))The command completed successfully4、升级oracle软件A 将升级包解压缩[root@oracle3 u01]# unzip p6810189_10204_Linux-x86.zip B 升级DBMS[root@oracle3 ~]# xhost +access control disabled, clients can connect from any host[root@oracle3 ~]# su - oracle[oracle@oracle3 ~]$ export DISPLAY="10.1.1.250:0.0"[oracle@oracle3 ~]$ export LANG=en_US[oracle@oracle3 ~]$ cd /u01/Disk1/[oracle@oracle3 Disk1]$ ./runInstaller 不用做任何设置,都是点击“Next”,最后一步要在root下执行root.sh脚本[root@oracle3 ~]# cd /u01/oracle/product/10.2.0/db_1/[root@oracle3 db_1]# ./root.shRunning Oracle10 root.sh script...The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/oracle/product/10.2.0/db_1Enter the full pathname of the local bin directory: [/usr/local/bin]: The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.点击“OK”,“Exit”5、升级数据库实例(升级RDBMS)注意,由于实例创建的时候是10.2.0.1下创建的,所以这个实例ORCL需要升级,如果是升级到10.2.0.4之后创建的数据库实例RDBMS,版本就是10.2.0.4.A 将数据库启动到升级状态[oracle@oracle3 ~]$ sqlplus /nologSQL*Plus: Release 10.2.0.4.0 - Production on Fri Jun 6 09:37:57 2014Copyright (c) 1982, 2007, Oracle. All Rights Reserved.SQL> conn /as sysdba Connected to an idle instance.SQL> startup upgradeORACLE instance started.Total System Global Area 608174080 bytesFixed Size 1268920 bytesVariable Size 188744520 bytesDatabase Buffers 415236096 bytesRedo Buffers 2924544 bytesDatabase mounted.Database opened.B 升级Oracle实例的组件需要执行一个SQL脚本,这个脚本在第四步升级DBMS的时候copy到了磁盘上。SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sqlC 创建组件的目录SQL> @$ORACLE_HOME/rdbms/admin/catalog.sqlD 关闭数据库再正常启动SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startupORACLE instance started.Total System Global Area 608174080 bytesFixed Size 1268920 bytesVariable Size 226493256 bytesDatabase Buffers 377487360 bytesRedo Buffers 2924544 bytesDatabase mounted.Database opened.E 创建包和存储过程SQL> @$ORACLE_HOME/rdbms/admin/catproc.sqlF 编译无效的对象SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sqlSQL> SET VERIFY OFF;SQL> SQL> SELECT dbms_registry_sys.time_stamp('utlrp_bgn') as timestamp from dual;TIMESTAMP--------------------------------------------------------------------------------COMP_TIMESTAMP UTLRP_BGN 2014-06-06 11:16:291 row selected.SQL> DECLARE 2 threads pls_integer := &&1; 3 BEGIN 4 utl_recomp.recomp_parallel(threads); 5 END; 6 /6、验证SQL> col comp_name format a30 SQL> select comp_name,version,status from dba_registry;COMP_NAME VERSION STATUS------------------------------ ------------------------------ ----------------------Oracle Enterprise Manager 10.2.0.4.0 VALIDSpatial 10.2.0.4.0 VALIDOracle interMedia 10.2.0.4.0 VALIDOLAP Catalog 10.2.0.4.0 VALIDOracle XML Database 10.2.0.4.0 VALIDOracle Text 10.2.0.4.0 VALIDOracle Expression Filter 10.2.0.4.0 VALIDOracle Rule Manager 10.2.0.4.0 VALIDOracle Workspace Manager 10.2.0.4.3 VALIDOracle Data Mining 10.2.0.4.0 VALIDOracle Database Catalog Views 10.2.0.4.0 VALIDOracle Database Packages and T 10.2.0.4.0 VALIDypesJServer JAVA Virtual Machine 10.2.0.4.0 VALIDOracle XDK 10.2.0.4.0 VALIDOracle Database Java Packages 10.2.0.4.0 VALIDOLAP Analytic Workspace 10.2.0.4.0 VALIDOracle OLAP API 10.2.0.4.0 VALID17 rows selected. --升级成功检查OEM是否升级成功:[oracle@oracle3 ~]$ emctl start dbconsoleTZ set to PRCOracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.http://oracle3:1158/em/console/aboutApplicationStarting Oracle Enterprise Manager 10g Database Control .............................. started. ------------------------------------------------------------------Logs are generated in directory /u01/oracle/product/10.2.0/db_1/oracle3_ORCL/sysman/log