升級Oracle 11.2.0.1.0到11.2.0.3.0

來源:互聯網
上載者:User

升級Oracle 11.2.0.1.0到11.2.0.3.0

查看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








安裝結束的時候,用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

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.