合 本地使用dbua和手工脚本的方式升级Oracle 11.2.0.1到11.2.0.3环境
Tags: Oracle升级DBUA11.2.0.111.2.0.3
数据库情况
- 单实例非ASM存储
- ORACLE_SID : orcl
- ORACLE_HOME: /u01/app/oracle/product/11.2.0/dbhome_1
数据库原始状态
[oracle@rhel6 tmp]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 26 16:44:37 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table test as select * from user_objects;
Table created.
SQL> select count(1) from test;
COUNT(1)
----------
30804
SQL>set linesize 150
SQL>set pagesize 9999
SQL> col comp_name format a40
SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
COMP_NAME VERSION STATUS
---------------------------------------- ------------------------------ -----------
OWB 11.2.0.1.0 VALID
Oracle Application Express 3.2.1.00.10 VALID
Oracle Enterprise Manager 11.2.0.1.0 VALID
OLAP Catalog 11.2.0.1.0 VALID
Spatial 11.2.0.1.0 VALID
Oracle Multimedia 11.2.0.1.0 VALID
Oracle XML Database 11.2.0.1.0 VALID
Oracle Text 11.2.0.1.0 VALID
Oracle Expression Filter 11.2.0.1.0 VALID
Oracle Rules Manager 11.2.0.1.0 VALID
Oracle Workspace Manager 11.2.0.1.0 VALID
Oracle Database Catalog Views 11.2.0.1.0 VALID
Oracle Database Packages and Types 11.2.0.1.0 VALID
JServer JAVA Virtual Machine 11.2.0.1.0 VALID
Oracle XDK 11.2.0.1.0 VALID
Oracle Database Java Packages 11.2.0.1.0 VALID
OLAP Analytic Workspace 11.2.0.1.0 VALID
Oracle OLAP API 11.2.0.1.0 VALID
18 rows selected.
数据库保持运行状态:
解压命令:
unzip p10404530_112030_Linux-x86-64_1of7.zip -d /tmp && unzip p10404530_112030_Linux-x86-64_2of7.zip -d /tmp
升级Oracle database 软件
开始安装:
执行到76%的时候弹出如下窗口:
[root@rhel6 ~]# /u01/app/oracle/product/11.2.0.4/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0.4/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
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 by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@rhel6 ~]#
升级Instance
升级Instance 有两种方法,第一种是使用dbua工具,第二种是手工执行脚本。
使用DBUA工具
操作界面:
该步骤可以在告警日志中查看相关信息:
Sun Sep 28 16:16:31 2014
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch
Autotune of undo retention is turned on.
IMODE=BR
ILAT =167
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1
System name: Linux
Node name: rhel6.5
Release: 2.6.32-431.el6.x86_64
Version: #1 SMP Sun Nov 10 22:19:54 EST 2013
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in server-side spfile /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfileorcl.ora
System parameters with non-default values:
processes = 1000
shared_pool_size = 252M
java_pool_size = 252M
memory_target = 1G
control_files = "/u01/app/oracle/oradata/orcl/control01.ctl"
control_files = "/u01/app/oracle/oradata/orcl/control02.ctl"
db_block_size = 8192
compatible = "11.2.0.0.0"
undo_tablespace = "UNDOTBS1"
recyclebin = "OFF"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"
local_listener = "LISTENER_ORCL"
audit_file_dest = "/u01/app/oracle/admin/orcl/adump"
audit_trail = "DB"
db_name = "orcl"
open_cursors = 300
diagnostic_dest = "/u01/app/oracle"
Sun Sep 28 16:16:38 2014
PMON started with pid=2, OS id=26426
Sun Sep 28 16:16:38 2014
PSP0 started with pid=3, OS id=26428
Sun Sep 28 16:16:39 2014
VKTM started with pid=4, OS id=26430 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Sun Sep 28 16:16:39 2014
GEN0 started with pid=5, OS id=26434
Sun Sep 28 16:16:39 2014
DIAG started with pid=6, OS id=26436
Sun Sep 28 16:16:39 2014
DBRM started with pid=7, OS id=26438
Sun Sep 28 16:16:39 2014
DIA0 started with pid=8, OS id=26440
Sun Sep 28 16:16:39 2014
MMAN started with pid=9, OS id=26442
Sun Sep 28 16:16:39 2014
DBW0 started with pid=10, OS id=26444
Sun Sep 28 16:16:39 2014
LGWR started with pid=11, OS id=26446
Sun Sep 28 16:16:39 2014
CKPT started with pid=12, OS id=26448
Sun Sep 28 16:16:39 2014
SMON started with pid=13, OS id=26450
Sun Sep 28 16:16:39 2014
RECO started with pid=14, OS id=26452
Sun Sep 28 16:16:39 2014
MMON started with pid=15, OS id=26454
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Sun Sep 28 16:16:39 2014
MMNL started with pid=16, OS id=26456
starting up 1 shared server(s) ...
ORACLE_BASE from environment = /u01/app/oracle
Sun Sep 28 16:16:58 2014
ALTER DATABASE MOUNT
Sun Sep 28 16:17:03 2014
Successful mount of redo thread 1, with mount id 1387228411
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Sun Sep 28 16:17:06 2014
Shutting down instance (immediate)
Shutting down instance: further logons disabled
Stopping background process MMNL
Stopping background process MMON
License high water mark = 1
All dispatchers and shared servers shutdown
ALTER DATABASE CLOSE NORMAL
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
ALTER DATABASE DISMOUNT
Shutting down archive processes
Archiving is disabled
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Sun Sep 28 16:17:10 2014
Stopping background process VKTM
Sun Sep 28 16:17:12 2014
Instance shutdown complete
Sun Sep 28 16:17:14 2014
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch
Autotune of undo retention is turned on.
IMODE=BR
ILAT =167
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1
System name: Linux
Node name: rhel6.5
Release: 2.6.32-431.el6.x86_64
Version: #1 SMP Sun Nov 10 22:19:54 EST 2013
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in server-side spfile /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfileorcl.ora
System parameters with non-default values:
processes = 1000
shared_pool_size = 252M
java_pool_size = 252M
memory_target = 1G
control_files = "/u01/app/oracle/oradata/orcl/control01.ctl"
control_files = "/u01/app/oracle/oradata/orcl/control02.ctl"
db_block_size = 8192
compatible = "11.2.0.0.0"
undo_tablespace = "UNDOTBS1"
recyclebin = "OFF"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"
local_listener = "LISTENER_ORCL"
audit_file_dest = "/u01/app/oracle/admin/orcl/adump"
audit_trail = "DB"
db_name = "orcl"
open_cursors = 300
diagnostic_dest = "/u01/app/oracle"
Sun Sep 28 16:17:17 2014
PMON started with pid=2, OS id=26627
Sun Sep 28 16:17:17 2014
PSP0 started with pid=3, OS id=26629
Sun Sep 28 16:17:18 2014
VKTM started with pid=4, OS id=26631 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Sun Sep 28 16:17:18 2014
GEN0 started with pid=5, OS id=26635
Sun Sep 28 16:17:18 2014
DIAG started with pid=6, OS id=26637
Sun Sep 28 16:17:18 2014
DBRM started with pid=7, OS id=26639
Sun Sep 28 16:17:18 2014
DIA0 started with pid=8, OS id=26641
Sun Sep 28 16:17:18 2014
MMAN started with pid=9, OS id=26643
Sun Sep 28 16:17:18 2014
DBW0 started with pid=10, OS id=26645
Sun Sep 28 16:17:18 2014
LGWR started with pid=11, OS id=26647
Sun Sep 28 16:17:18 2014
CKPT started with pid=12, OS id=26649
Sun Sep 28 16:17:18 2014
SMON started with pid=13, OS id=26651
Sun Sep 28 16:17:18 2014
RECO started with pid=14, OS id=26653
Sun Sep 28 16:17:18 2014
MMON started with pid=15, OS id=26655
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Sun Sep 28 16:17:18 2014
MMNL started with pid=16, OS id=26657
starting up 1 shared server(s) ...
ORACLE_BASE from environment = /u01/app/oracle
Sun Sep 28 16:17:25 2014
ALTER DATABASE MOUNT
Sun Sep 28 16:17:29 2014
Successful mount of redo thread 1, with mount id 1387239701
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Sun Sep 28 16:17:30 2014
ALTER DATABASE OPEN MIGRATE
Thread 1 opened at log sequence 3
Current log# 3 seq# 3 mem# 0: /u01/app/oracle/oradata/orcl/redo03.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Sun Sep 28 16:17:31 2014
SMON: enabling cache recovery
[26688] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:38185014 end:38186274 diff:1260 (12 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is WE8MSWIN1252
Updating 11.2.0.1.0 NLS parameters in sys.props$
-- adding 11.2.0.3.0 NLS parameters.
Stopping background process MMNL
Stopping background process MMON
Starting background process MMON
Starting background process MMNL
Sun Sep 28 16:17:40 2014
MMON started with pid=15, OS id=26690
ALTER SYSTEM enable restricted session;
Sun Sep 28 16:17:40 2014
MMNL started with pid=16, OS id=26692
ALTER SYSTEM SET _system_trig_enabled=FALSE SCOPE=MEMORY;
Autotune of undo retention is turned off.
ALTER SYSTEM SET _undo_autotune=FALSE SCOPE=MEMORY;
ALTER SYSTEM SET undo_retention=900 SCOPE=MEMORY;
ALTER SYSTEM SET aq_tm_processes=0 SCOPE=MEMORY;
ALTER SYSTEM SET enable_ddl_logging=FALSE SCOPE=MEMORY;
Resource Manager disabled during database migration: plan '' not set
ALTER SYSTEM SET resource_manager_plan='' SCOPE=MEMORY;
ALTER SYSTEM SET recyclebin='OFF' DEFERRED SCOPE=MEMORY;
Resource Manager disabled during database migration
Sun Sep 28 16:17:41 2014
replication_dependency_tracking turned off (no async multimaster replication found)
Completed: ALTER DATABASE OPEN MIGRATE
Sun Sep 28 16:17:44 2014
Starting background process CJQ0
Sun Sep 28 16:17:45 2014
CJQ0 started with pid=20, OS id=26694
点击YES,后
后边有报告,完成即可。
同样,如果升级过程中出现问题,我们可以关闭数据库后,重新运行dbua 来重新升级上次失败的组件,如下图:
手动升级
第一步 utlu112i.sql
安装最新的 11.2 RDBMS 软件之后,用以前的 ORACLE_HOME 中启动 11.2.0.1实例,对正在运行的以前的实例执行 11.2.0.4 的$ORACLE_HOME/rdbms/admin/utlu112i.sql 脚本,并将输出 spool 至一个文件。
[oracle@rhel6 database]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 26 17:27:46 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> spool /home/oracle/utlu112i_log.log
SQL> @/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 09-26-2014 17:28:37
Script Version: 11.2.0.3.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name: ORCL
--> version: 11.2.0.1.0
--> compatible: 11.2.0.0.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V11
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 683 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 438 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
WARNING: --> "sga_target" needs to be increased to at least 412 MB
.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
WARNING: --> "sga_target" needs to be increased to at least 596 MB
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle Application Express [upgrade] VALID
... APEX will only be upgraded if the version of APEX in
... the target Oracle home is higher than the current one.
--> Oracle OLAP API [upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database is using a timezone file older than version 14.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 11.2.0.1.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> Database contains schemas with objects dependent on DBMS_LDAP package.
.... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
.... USER APEX_030200 has dependent objects.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
**********************************************************************
Oracle recommends reviewing any defined events prior to upgrading.
To view existing non-default events 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' AND isdefault='FALSE'
Changes will need to be made in the init.ora or spfile.
**********************************************************************
SQL> spool off
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rhel6 database]$
第二步 DBUPGDIAG.SQL
[oracle@rhel6 share-D]$ cd /tmp/
[oracle@rhel6 tmp]$ ll dbupgdiag.sql
-rwxr-xr-x. 1 oracle oinstall 23931 Sep 26 17:43 dbupgdiag.sql
[oracle@rhel6 tmp]$ pwd
/tmp
[oracle@rhel6 tmp]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 26 17:44:31 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @/tmp/dbupgdiag.sql
Enter location for Spooled output:
Enter value for 1: /home/oracle
26_Sep_2014_0544 .log
orcl_
*** Start of LogFile ***
Oracle Database Upgrade Diagnostic Utility 09-26-2014 17:44:54
===============
Hostname
===============
rhel6.5
===============
Database Name
===============
ORCL
===============
Database Uptime
===============
16:01 26-SEP-14
=================
Database Wordsize
=================
This is a 64-bit database
================
Software Version
================
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
=============
Compatibility
=============
Compatibility is set as 11.2.0.0.0
================
Archive Log Mode
================
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch