天堂1111 发表于 2018-9-10 07:36:55

oracle 11.2.0.1升级11.2.0.3-pry的博客

  查看DB版本
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2009, Oracle.All rights reserved.

  Connected to an>  SQL> startup
  ORACLE instance started.
  Total System Global Area208769024 bytes

  Fixed>
  Variable>  Database Buffers         75497472 bytes
  Redo Buffers                5226496 bytes
  Database mounted.
  Database opened.
  SQL> select * from v$version;
  BANNER
  --------------------------------------------------------------------------------

  Oracle Database 11g Enterprise Edition>
  PL/SQL>  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
  $ unzip /opt/oracle11gR2/p10404530_112030_Linux-x86-64_1of7.zip
  $ unzip /opt/oracle11gR2/p10404530_112030_Linux-x86-64_2of7.zip
  将第二个解压后的文件拷贝到第一个解压后的相应目录底下
  $
  /u01/11204_patch/database/stage/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
  $ cd /u01/11204_patch_1/database/
  $ ls
  docinstallreadme.htmlresponserpmrunInstallersshsetupstagewelcome.html
  ./runInstaller
http://blog.itpub.net/attachment/201403/13/9881395_13947024511T1s.jpg
http://blog.itpub.net/attachment/201403/13/9881395_1394702451J0gm.jpg
http://blog.itpub.net/attachment/201403/13/9881395_1394702452zIt9.jpg
  安装结束的时候,用root用户执行一下两个脚本orainstRoot.sh和root.sh
  2.4将11.2.0.1下ORACLE_HOME下的文件拷贝新的ORACLE_HOME下,操作如下
  $ pwd
  /u01/app/oracle/product/11.2.0/db_1/dbs
  $ cp * /u01/app/oracle/product/11.2.0.3/db_1/dbs/
  $ pwd
  /u01/app/oracle/product/11.2.0/db_1/network/admin
  $ cp -R * /u01/app/oracle/product/11.2.0.3/db_1/network/admin/
  2.5修改oracle配置文件
  $ 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
  $ 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>  # 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
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2011, Oracle.All rights reserved.
  Connected to:

  Oracle Database 11g Enterprise Edition>  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  SQL> select * from v$version;
  BANNER
  --------------------------------------------------------------------------------

  Oracle Database 11g Enterprise Edition>
  PL/SQL>  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,而且执行时间比较长
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2011, Oracle.All rights reserved.

  Connected to an>  SQL> startup
  ORACLE instance started.
  Total System Global Area208769024 bytes

  Fixed>
  Variable>  Database Buffers         58720256 bytes
  Redo Buffers                5214208 bytes
  Database mounted.
  Database opened.
  SQL> select status from v$instance;
  STATUS
  ------------
  OPEN

页: [1]
查看完整版本: oracle 11.2.0.1升级11.2.0.3-pry的博客