转自:http://blog.itpub.net/20674423/viewspace-1352257/
探索Oracle之数据库升级二
11.2.0.3 升级到11.2.0.4 完整步骤
说明:
这篇文章主要是记录下单实例环境下Oracle 11.2.0.1 升级到11.2.0.3的过程,当然RAC的升级是会有所不同。但是他们每个版本之间升级步骤都是差不多的,先升级Database Software,再升级Oracle Instance。
Oracle 11.2.0.4 的Patchset No: 19852360下载需要有Oracle Support才可以。
Patchset 包含有7个文件,关于这七个文件的作用,详见如下链接:
我们升级Database,只需要其中的第一个和第二文件即可。将2个文件解压缩后就可以执行升级操作了。
升级前准备:
1、
1、查看数据库和操作系统相关信息:
2、备份数据库
3、停止数据库
3、 4、备份老的ORACLE_HOME和oraInventory
4、 5、上传并解压缩Oracle Database 11.2.0.4安装介质
6、开始安装
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 脚本
7、执行root脚本
6.12 执行完脚本之后继续运行,提示配置监听,选择Cancel,稍后复制即可
6.13 提示监听配置失败,点击ok即可
6.14 有报错不用管,我们直接Next即可
6.15 至此软件安装完成,点击Close关闭安装界面
至此软件安装完成,但是并不代表数据库就已经升级完成了。
8、至此11.2.0.4的软件就已经装完了,修改Oracle环境变量
9、拷贝监听配置文件
10、执行预升级脚本检查
[oracle@db01 dbs]$ sqlplus /as sysdba
SQL*Plus: Release 11.2.0.4.0Production on Sat Oct 4 02:26:01 2014
Copyright (c) 1982, 2013,Oracle. All rights reserved.
Connected to an idleinstance.
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area2037673984 bytes
Fixed Size 2254704 bytes
Variable Size 1811941520 bytes
Database Buffers 218103808 bytes
Redo Buffers 5373952 bytes
Database mounted.
Database opened.
SQL>@?/rdbms/admin/utlu112i.sql ---执行升级前检查
Oracle Database 11.2Pre-Upgrade Information Tool 10-04-2014 02:27:38
Script Version: 11.2.0.4.0Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name: WOO
--> version: 11.2.0.3.0
--> compatible: 11.2.0.0.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V14
.
**********************************************************************
Tablespaces: [makeadjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace isadequate for the upgrade.
.... minimum required size:917 MB
--> SYSAUX tablespace isadequate for the upgrade.
.... minimum required size:646 MB
--> UNDOTBS1 tablespaceis adequate for the upgrade.
.... minimum required size:400 MB
--> TEMP tablespace isadequate for the upgrade.
.... minimum required size:60 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [UpdateOracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool wasrun on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is32-Bit, refer here for Update Parameters:
WARNING: -->"shared_pool_size" needs to be increased to at least 236 MB
.
--> If Target Oracle is64-Bit, refer here for Update Parameters:
WARNING: -->"shared_pool_size" needs to be increased to at least 472 MB
.
**********************************************************************
Renamed Parameters: [UpdateOracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parametersfound. No changes are required.
.
**********************************************************************
Obsolete/DeprecatedParameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No obsolete parametersfound. No changes are required
.
**********************************************************************
Components: [The followingdatabase components will be upgraded or installed]
**********************************************************************
--> Oracle CatalogViews [upgrade] VALID
--> Oracle Packages andTypes [upgrade] VALID
--> JServer JAVA VirtualMachine [upgrade] VALID
--> Oracle XDK forJava [upgrade] VALID
--> Oracle WorkspaceManager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XMLDatabase [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> OracleinterMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> ExpressionFilter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle ApplicationExpress [upgrade] VALID
... APEX will only beupgraded if the version of APEX in
... the target Oracle homeis higher than the current one.
--> Oracle OLAP API [upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Your recyclebin is turned on and currently contains no objects.
.... Because it is REQUIREDthat the recycle bin be empty prior to upgrading
.... and your recycle bin isturned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing yourupgrade to confirm the recycle bin is empty.
WARNING: --> Databasecontains schemas with objects dependent on DBMS_LDAP package.
.... Refer to the 11gUpgrade Guide for instructions to configure Network ACLs.
.... USER APEX_030200 hasdependent objects.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gatheringdictionary statistics prior to
upgrading the database.
To gather dictionarystatistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
**********************************************************************
Oracle recommends removingall hidden parameters prior to upgrading.
To view existing hiddenparameters execute the following command
while connected AS SYSDBA:
SELECT name,description fromSYS.V$PARAMETER WHERE name
LIKE '\_%' ESCAPE '\'
Changes will need to be madein the init.ora or spfile.
**********************************************************************
Oracle recommends reviewingany defined events prior to upgrading.
To view existing non-defaultevents execute the following commands
while connected AS SYSDBA:
Events:
SELECT (translate(value,chr(13)||chr(10),'')) FROM sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),'')) from sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' ANDisdefault='FALSE'
Changes will need to be madein the init.ora or spfile.
11、修改不满足项
12、执行升级操作
以上catupgrd.sql脚本运行了50分钟左右,执行完之后会shutdown immediate数据库,这个时候我们将要重启数据库运行utlrp.sql脚本编译失效对象:
13、运行utlrp.sql编译失效对象
[oracle@db01 dbs]$ sqlplus /as sysdba
SQL*Plus: Release 11.2.0.4.0Production on Sat Oct 4 04:11:22 2014
Copyright (c) 1982, 2013,Oracle. All rights reserved.
Connected to an idleinstance.
SQL> startup
ORACLE instance started.
Total System Global Area 2872786944bytes
Fixed Size 2256712 bytes
Variable Size 2634023096 bytes
Database Buffers 218103808 bytes
Redo Buffers 18403328 bytes
Database mounted.
Database opened.
SQL> @?/rdbms/admin/utlrp
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMPUTLRP_BGN 2014-10-04 04:14:57
DOC> The following PL/SQL block invokesUTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation timeis proportional to the
DOC> number of invalid objects in the database,so this command may take
DOC> a long time to execute on a database with alarge number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to trackrecompilation progress:
DOC>
DOC> 1. Query returning the number of invalidobjects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE statusIN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objectscompiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROMUTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial orparallel recompilation
DOC> based on the number of CPUs available(parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameterparallel_threads_per_cpu).
DOC> On RAC, this number is added across all RACnodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to createjobs for parallel
DOC> recompilation. Jobs are created withoutinstance affinity so that they
DOC> can migrate across RAC nodes. Use thefollowing queries to verify
DOC> whether UTL_RECOMP jobs are being createdand run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that arerunning
DOC> SELECT job_name FROMdba_scheduler_running_jobs
DOC> WHERE job_name like'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL proceduresuccessfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMPUTLRP_END 2014-10-04 04:15:34
DOC> The following queryreports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number ishigher than expected, please examine the error
DOC> messages reportedwith each object (using SHOW ERRORS) to see if they
DOC> point to systemmisconfiguration or resource constraints that must be
DOC> fixed beforeattempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
0
DOC> The following queryreports the number of errors caught during
DOC> recompilation. Ifthis number is non-zero, please query the error
DOC> messages in thetable UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due tomisconfiguration or resource constraints that must be
DOC> fixed before objectscan compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL proceduresuccessfully completed.
Function dropped.
PL/SQL proceduresuccessfully completed.
SQL>
该脚本耗时约为3分钟左右。
14、至此数据库已经升级完成,查看各组件版本号:
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.
15、检查无效对象:
16、升级成功后删除原来的目录,通过EMCA重建EM
17、至此,数据库已经升级完成。