转自:http://blog.csdn.net/wuweilong/article/details/41627189node
说明:python
这篇文章主要是记录下单实例环境下Oracle 11.2.0.1升级到11.2.0.3的过程,固然RAC的升级是会有所不一样。可是他们每一个版本之间升级步骤都是差很少的,先升级Database Software,再升级Oracle Instance。sql
Oracle 11.2.0.4的Patchset No:19852360下载须要有Oracle Support才能够。数据库
Patchset包含有7个文件,关于这七个文件的做用,详见以下连接:bash
咱们升级Database,只须要其中的第一个和第二文件便可。将2个文件解压缩后就能够执行升级操做了。session
升级前准备:oracle
一、查看数据库和操做系统相关信息:app
- [root@db01 ~]# uname -a
- Linux db01 2.6.18-308.el5 #1SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
-
- [root@db01 ~]# lsb_release-a
- LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
- Distributor ID:RedHatEnterpriseServer
- Description: Red Hat Enterprise Linux Server release 5.8(Tikanga)
- Release: 5.8
- Codename: Tikanga
-
- [root@db01 ~]# su - oracle-c "sqlplus / as sysdba";
- SQL*Plus: Release 11.2.0.3.0Production on Fri Oct 3 21:32:02 2014
- Copyright (c) 1982, 2011,Oracle. All rights reserved.
-
- Connected to:
- Oracle Database 11gEnterprise Edition Release 11.2.0.3.0 - 64bit Production
- With the Partitioning, OLAP,Data Mining and Real Application Testing options
-
- SQL> select name fromv$database;
-
-
- NAME
-
- WOO
-
- SQL>
二、备份数据库jsp
- [oracle@db01 ~]$ rman target/
-
-
- Recovery Manager: Release11.2.0.3.0 - Production on Fri Oct 3 21:43:04 2014
- Copyright (c) 1982, 2011,Oracle and/or its affiliates. All rightsreserved.
- connected to targetdatabase: WOO (DBID=4199461782)
-
- RMAN> backup databaseplus archivelog delete input format '/DBBackup/Phycal/full_%U.bak';
-
-
- Starting backup at 03-OCT-14
- current log archived
- using target databasecontrol file instead of recovery catalog
- allocated channel:ORA_DISK_1
- channel ORA_DISK_1: SID=149device type=DISK
- channel ORA_DISK_1: startingarchived log backup set
- channel ORA_DISK_1:specifying archived log(s) in backup set
- input archived log thread=1sequence=15 RECID=1 STAMP=860017183
- input archived log thread=1sequence=16 RECID=2 STAMP=860017184
- input archived log thread=1sequence=17 RECID=3 STAMP=860017186
- input archived log thread=1sequence=18 RECID=4 STAMP=860017186
- input archived log thread=1sequence=19 RECID=5 STAMP=860017188
- input archived log thread=1sequence=20 RECID=6 STAMP=860017387
- channel ORA_DISK_1: startingpiece 1 at 03-OCT-14
- channel ORA_DISK_1: finishedpiece 1 at 03-OCT-14
- piecehandle=/DBBackup/Phycal/full_01pk5knb_1_1.bak tag=TAG20141003T214307comment=NONE
- channel ORA_DISK_1: backupset complete, elapsed time: 00:00:02
- channel ORA_DISK_1: deletingarchived log(s)
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_15_b2x9rz0z_.arcRECID=1 STAMP=860017183
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_16_b2x9s05l_.arcRECID=2 STAMP=860017184
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_17_b2x9s2nx_.arcRECID=3 STAMP=860017186
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_18_b2x9s2od_.arcRECID=4 STAMP=860017186
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_19_b2x9s4dr_.arcRECID=5 STAMP=860017188
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_20_b2x9zbz2_.arcRECID=6 STAMP=860017387
- Finished backup at 03-OCT-14
-
- Starting backup at 03-OCT-14
- using channel ORA_DISK_1
- channel ORA_DISK_1: startingfull datafile backup set
- channel ORA_DISK_1:specifying datafile(s) in backup set
- input datafile filenumber=00001 name=/DBData/woo/system01.dbf
- input datafile filenumber=00002 name=/DBData/woo/sysaux01.dbf
- input datafile filenumber=00005 name=/DBData/woo/example01.dbf
- input datafile filenumber=00003 name=/DBData/woo/undotbs01.dbf
- input datafile filenumber=00004 name=/DBData/woo/users01.dbf
- channel ORA_DISK_1: startingpiece 1 at 03-OCT-14
- channel ORA_DISK_1: finishedpiece 1 at 03-OCT-14
- piecehandle=/DBSoft/fast_recovery_area/WOO/backupset/2014_10_03/o1_mf_nnndf_TAG20141003T214309_b2x9zfm5_.bkptag=TAG20141003T214309 comment=NONE
- channel ORA_DISK_1: backupset complete, elapsed time: 00:01:45
- channel ORA_DISK_1: startingfull datafile backup set
- channel ORA_DISK_1:specifying datafile(s) in backup set
- including current controlfile in backup set
- including current SPFILE inbackup set
- channel ORA_DISK_1: startingpiece 1 at 03-OCT-14
- channel ORA_DISK_1: finishedpiece 1 at 03-OCT-14
- piecehandle=/DBSoft/fast_recovery_area/WOO/backupset/2014_10_03/o1_mf_ncsnf_TAG20141003T214309_b2xb2qlm_.bkptag=TAG20141003T214309 comment=NONE
- channel ORA_DISK_1: backupset complete, elapsed time: 00:00:01
- Finished backup at 03-OCT-14
-
-
- Starting backup at 03-OCT-14
- current log archived
- using channel ORA_DISK_1
- channel ORA_DISK_1: startingarchived log backup set
- channel ORA_DISK_1:specifying archived log(s) in backup set
- input archived log thread=1sequence=21 RECID=7 STAMP=860017496
- channel ORA_DISK_1: startingpiece 1 at 03-OCT-14
- channel ORA_DISK_1: finishedpiece 1 at 03-OCT-14
- piecehandle=/DBBackup/Phycal/full_04pk5kqo_1_1.bak tag=TAG20141003T214456comment=NONE
- channel ORA_DISK_1: backupset complete, elapsed time: 00:00:01
- channel ORA_DISK_1: deletingarchived log(s)
- archived log filename=/DBSoft/fast_recovery_area/WOO/archivelog/2014_10_03/o1_mf_1_21_b2xb2rsf_.arcRECID=7 STAMP=860017496
- Finished backup at 03-OCT-14
-
-
- RMAN>
3、中止数据库ide
-
-
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
-
-
-
- SQL> host lsnrctl stop
-
-
- LSNRCTL for Linux: Version11.2.0.3.0 - Production on 04-OCT-2014 01:39:26
-
-
- Copyright (c) 1991, 2011,Oracle. All rights reserved.
- Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
- The command completedsuccessfully
-
-
-
- SQL> host emctl stopdbconsole
-
- Oracle Enterprise Manager11g Database Control Release 11.2.0.3.0
- Copyright (c) 1996, 2011Oracle Corporation. All rights reserved.
- <a target=_blank href="https://db01:1158/em/console/aboutApplication">https://db01:1158/em/console/aboutApplication</a>
- Stopping Oracle EnterpriseManager 11g Database Control ...
-
-
-
- [root@db01 ~]
- root 4971 4944 0 01:46 pts/0 00:00:00 grep ora
四、备份老的ORACLE_HOME和oraInventory
- [root@db01 ~]
- [root@db01 ~]
五、上传并解压缩Oracle Database 11.2.0.4安装介质
- [oracle@db01 ~]$ ll
-
- total 2489644
- drwxr-xr-x 2 oracle oinstall 4096 Oct 3 04:06 Desktop
- -rw-r--r-- 1 oracle oinstall1395582860 Oct 3 06:55p13390677_112040_Linux-x86-64_1of7.zip
- -rw-r--r-- 1 oracle oinstall1151304589 Oct 3 06:54p13390677_112040_Linux-x86-64_2of7.zip
-
- [oracle@db01 ~]$ unzipp13390677_112040_Linux-x86-64_1of7.zip
- [oracle@db01 ~]$ unzipp13390677_112040_Linux-x86-64_2of7.zip
六、 开始安装
6.1 将文件解压缩后进入安装目录执行./runInstall
6.2 取消Oracle支持选项,点击Next
6.3 选择最后一个选项"skip software update" 点击Next
6.4 选择最后一个选项"Upgrade an existing database" 后执行Next
6.5 选择全部语言,后点击Next
6.6 选择要升级的数据库版本,后点击Next
6.7 选择新版本的数据库软件安装目录,后点击Next
6.8 选择数据库所属用户组,后点击Next
6.9 察看数据库配置信息后,点击Install开始进行新版本软件安装
6.10 安装进度,这个过程将会持续15分钟左右
6.11 弹出对话框要求执行/DBSoft/Product/11.2.4/db_1/root.sh 脚本
七、 执行root.sh脚本
- [root@db01 ~]
-
- Performing root useroperation for Oracle 11g
-
-
- The following environmentvariables are set as:
- ORACLE_OWNER= oracle
- ORACLE_HOME= /DBSoft/Product/11.2.4/db_1
-
-
- Enter the full pathname ofthe local bin directory: [/usr/local/bin]:
- The contents of"dbhome" have not changed. No need to overwrite.
- The contents of"oraenv" have not changed. No need to overwrite.
- The contents of"coraenv" have not changed. No need to overwrite.
-
-
- Entries will be added to the/etc/oratab file as needed by
- Database ConfigurationAssistant when a database is created
- Finished running genericpart of root script.
- Now product-specific rootactions will be performed.
- Finished product-specificroot actions.
-
- [root@db01 ~]
6.12 执行完脚本以后继续运行,提示配置监听,选择Cancel,稍后复制便可
6.13 提示监听配置失败,点击ok便可
6.14 有报错不用管,咱们直接Next便可
6.15 至此软件安装完成,点击Close关闭安装界面
至此软件安装完成,可是并不表明数据库就已经升级完成了。
八、至此11.2.0.4的软件就已经装完了,修改Oracle环境变量
- [root@db01 ~]
- [oracle@db01 ~]$ vi.bash_profile -------修改以下行,将11.2.3改为11.2.4便可
- export ORACLE_HOME=$ORACLE_BASE/Product/11.2.4/db_1
-
- [oracle@db01 ~]$ vi /etc/oratab -------修改以下行11.2.3为11.2.4
- woo:/DBSoft/Product/11.2.4/db_1:N
-
- [oracle@db01 admin]$ cp/DBSoft/Product/11.2.3/db_1/dbs/* /DBSoft/Product/11.2.4/db_1/dbs/
九、 拷贝监听配置文件
- [oracle@db01 admin]$ source~/.bash_profile
- [oracle@db01 admin]$ pwd
- /DBSoft/Product/11.2.3/db_1/network/admin
-
- [oracle@db01 admin]$ cd$ORACLE_HOME/network/admin
- [oracle@db01 admin]$ ls
-
- samples shrept.lst
-
- [oracle@db01 admin]$ cp -r/DBSoft/Product/11.2.3/db_1/network/admin/* $ORACLE_HOME/network/admin
- [oracle@db01 admin]$ ls
- listener.ora samples shrept.lst sqlnet.ora tnsnames.ora
十、执行预升级脚本检查
十一、 修改不知足项
十二、执行升级操做
以上catupgrd.sql脚本运行了50分钟左右,执行完以后会shutdown immediate数据库。这个时候咱们将要重启数据库运行utlrp.sql脚本编译失效对象:
1三、运行utlrp.sql编译失效对象
该脚本耗时约为3分钟左右。
1四、至此数据库已经升级完成,查看各组件版本号:
- SQL> select comp_name,status,version fromdba_server_registry
-
-
- COMP_NAME STATUS VERSION
-
-
- OWB VALID 11.2.0.3.0
- Oracle ApplicationExpress VALID 3.2.1.00.12
- Oracle EnterpriseManager VALID 11.2.0.4.0
- OLAP Catalog VALID 11.2.0.4.0
- Spatial VALID 11.2.0.4.0
- Oracle Multimedia VALID 11.2.0.4.0
- Oracle XML Database VALID 11.2.0.4.0
- Oracle Text VALID 11.2.0.4.0
- Oracle ExpressionFilter VALID 11.2.0.4.0
- Oracle Rules Manager VALID 11.2.0.4.0
- Oracle WorkspaceManager VALID 11.2.0.4.0
- Oracle Database CatalogViews VALID 11.2.0.4.0
- Oracle Database Packages andTypes VALID 11.2.0.4.0
- JServer JAVA VirtualMachine VALID 11.2.0.4.0
- Oracle XDK VALID 11.2.0.4.0
- Oracle Database JavaPackages VALID 11.2.0.4.0
- OLAP Analytic Workspace VALID 11.2.0.4.0
- Oracle OLAP API VALID 11.2.0.4.0
-
-
- 18 rows selected.
1五、检查无效对象:
- SQL> select * fromdba_objects where status !='VALID';
-
-
- no rows selected
1六、升级成功后删除原来的目录,经过EMCA重建EM
- [oracle@db01 /]$ rm -rf/DBSoft/Product/11.2.3/
-
- 手工建立EM资料库:
-
-
-
- [oracle@db01 /]$ emca -reposdrop
-
- STARTED EMCA at Oct 4, 20146:11:41 AM
- EM Configuration Assistant,Version 11.2.0.3.0 Production
-
- Copyright (c) 2003, 2011,Oracle. All rights reserved.
-
-
- Enter the followinginformation:
- Database SID: woo
- Listener port number: 1521
- Password for SYS user:
- Password for SYSMANuser:
-
-
- ----------------------------------------------------------------------
- WARNING : While repositoryis dropped the database will be put in quiesce mode.
- ----------------------------------------------------------------------
-
- Do you wish to continue?[yes(Y)/no(N)]: y
- Oct 4, 2014 6:11:53 AMoracle.sysman.emcp.EMConfig perform
- INFO: This operation isbeing logged at /DBSoft/cfgtoollogs/emca/woo/emca_2014_10_04_06_11_41.log.
- Oct 4, 2014 6:11:53 AMoracle.sysman.emcp.EMReposConfig invoke
- INFO: Dropping the EMrepository (this may take a while) ...
- Oct 4, 2014 6:13:37 AMoracle.sysman.emcp.EMReposConfig invoke
- INFO: Repositorysuccessfully dropped
- Enterprise Managerconfiguration completed successfully
- FINISHED EMCA at Oct 4, 20146:13:37 AM
-
-
-
-
- [oracle@db01 /]$ emca -reposcreate
-
-
- STARTED EMCA at Oct 4, 20146:14:07 AM
- EM Configuration Assistant,Version 11.2.0.3.0 Production
- Copyright (c) 2003, 2011,Oracle. All rights reserved.
-
- Enter the followinginformation:
- Database SID: woo
- Listener port number: 1521
- Password for SYS user:
- Password for SYSMANuser:
-
- Do you wish to continue?[yes(Y)/no(N)]: y
- Oct 4, 2014 6:14:20 AM oracle.sysman.emcp.EMConfigperform
- INFO: This operation isbeing logged at /DBSoft/cfgtoollogs/emca/woo/emca_2014_10_04_06_14_07.log.
- Oct 4, 2014 6:14:21 AMoracle.sysman.emcp.EMReposConfig createRepository
- INFO: Creating the EMrepository (this may take a while) ...
- Oct 4, 2014 6:17:57 AMoracle.sysman.emcp.EMReposConfig invoke
- INFO: Repositorysuccessfully created
- Enterprise Managerconfiguration completed successfully
- FINISHED EMCA at Oct 4, 20146:17:57 AM
-
-
-
-
- [oracle@db01 /]$ emca-config dbcontrol db
-
-
- STARTED EMCA at Oct 4, 20146:24:04 AM
- EM Configuration Assistant,Version 11.2.0.3.0 Production
- Copyright (c) 2003, 2011,Oracle. All rights reserved.
-
-
- Enter the followinginformation:
- Database SID: woo
- Database Control is alreadyconfigured for the database woo
- You have chosen to configureDatabase Control for managing the database woo
- This will remove theexisting configuration and the default settings and perform a freshconfiguration
- Do you wish to continue?[yes(Y)/no(N)]: y
- Listener ORACLE_HOME [/DBSoft/Product/11.2.4/db_1 ]:
- Password for SYS user:
- Password for DBSNMPuser:
- Password for SYSMANuser:
- Email address fornotifications (optional):
- Outgoing Mail (SMTP) serverfor notifications (optional):
- -----------------------------------------------------------------
-
-
- You have specified thefollowing settings
-
- Database ORACLE_HOME................ /DBSoft/Product/11.2.4/db_1
- Local hostname................ db01
- Listener ORACLE_HOME................ /DBSoft/Product/11.2.4/db_1
- Listener port number................ 1521
- Database SID................ woo
- Email address fornotifications ...............
- Outgoing Mail (SMTP) serverfor notifications ...............
- -----------------------------------------------------------------
-
- Do you wish to continue?[yes(Y)/no(N)]: y
- Oct 4, 2014 6:24:49 AMoracle.sysman.emcp.EMConfig perform
- INFO: This operation isbeing logged at /DBSoft/cfgtoollogs/emca/woo/emca_2014_10_04_06_24_04.log.
- Oct 4, 2014 6:24:50 AMoracle.sysman.emcp.util.DBControlUtil stopOMS
- INFO: Stopping DatabaseControl (this may take a while) ...
- Oct 4, 2014 6:24:54 AMoracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
- INFO: Uploadingconfiguration data to EM repository (this may take a while) ...
- Oct 4, 2014 6:25:53 AMoracle.sysman.emcp.EMReposConfig invoke
- INFO: Uploaded configurationdata successfully
- Oct 4, 2014 6:25:57 AMoracle.sysman.emcp.util.DBControlUtil secureDBConsole
- INFO: Securing DatabaseControl (this may take a while) ...
- Oct 4, 2014 6:26:03 AMoracle.sysman.emcp.util.DBControlUtil secureDBConsole
- INFO: Database Controlsecured successfully.
- Oct 4, 2014 6:26:03 AMoracle.sysman.emcp.util.DBControlUtil startOMS
- INFO: Starting DatabaseControl (this may take a while) ...
- Oct 4, 2014 6:26:23 AMoracle.sysman.emcp.EMDBPostConfig performConfiguration
- INFO: Database Controlstarted successfully
- Oct 4, 2014 6:26:23 AMoracle.sysman.emcp.EMDBPostConfig performConfiguration
- INFO:>>>>>>>>>>> The Database Control URL ishttps://db01:5500/em <<<<<<<<<<<
- Oct 4, 2014 6:26:25 AMoracle.sysman.emcp.EMDBPostConfig invoke
- WARNING:
-
- ************************ WARNING ************************
-
- Management Repository hasbeen placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in thefile: /DBSoft/Product/11.2.4/db_1/db01_woo/sysman/config/emkey.ora. Ensure thisfile is backed up as the encrypted data will become unusable if this file islost.
-
-
- ***********************************************************
-
- Enterprise Managerconfiguration completed successfully
- FINISHED EMCA at Oct 4, 20146:26:25 AM
-
- [oracle@db01 /]$
1七、至此,升级已经所有完成。