数据库升级中 DBUA的使用介绍
(2014-09-05 11:35:30)分类: 补丁,升级 |
升级数据库的要点:
1.停应用,监听,实例(集群停crs) 就是停数据库的所有资源,以免影响数据库的升级,我们同事有一次由于没有停掉所有资源,导致升级失败。
2.备份oracle home 集群还要备份 crs home
3.1安装软件
3.2运行相应的脚本
3.3 升级Instance
3.3.1 使用DBUA 工具
3.5.1.1 DBUA 工具在升级instance前会检查如下选项:
(1)
(2)
(3)
(4)
(5)
(6)
(7)
3.5.1.2
(1)Important:
(2)DBUA can be used to upgrade from earlierOracle Database
11g
(3)You must run the Oracle NetConfiguration Assistant before
running DBUA. See
If you are upgradingan existing Oracle Enterprise Manager Database
Control or if you areconfiguring a new Oracle Enterprise Manager
Database Control for the new OracleDatabase
11g
(4)If you upgrade a cluster databaseusing DBUA, then you must make
surethe
(5)If the database instance is notrunning, then DBUA tries to start the instance with the default initializationparameter file. If that fails, then DBUA prompts you to provide the name of thecorrect initialization parameter file or to start the instance. If the instanceis up and running, then DBUA connects to it.
(6)If you terminate the upgrade, butdo not restore the database,
then you cannot restart DBUA until you start upthe existing
database in
For Oracle RAC,you cannot re-run DBUA once you terminate the upgrade. If you need to re-runthe upgrade, then you must run DBUA from the restored backup of the databaseyou are upgrading.
(7)If you restore your databasemanually (not using DBUA), then
remove
the
DBUA 工具比较简单,直接下一步的操作。这里就不多少了。
3.3.2 手工使用命令升级实例
1.Shut down the instance:
SQL> SHUTDOWNIMMEDIATE
2.If your operatingsystem is Windows, then complete the following steps:
(1)Stopthe
C:\> NET STOPOracleServiceORCL
(2)Delete the Oracle service at a command prompt
using
If
your
C:\> ORADIM-DELETE -SID ORCL
(3)Create the Oracle Database11g
C:\> ORADIM-NEW -SID SID -SYSPWD PASSWORD -MAXUSERS USERS
This syntax includes thefollowing variables:
Variable |
Description |
SID |
The same SID name as the SID of the database you are upgrading. |
PASSWORD |
The password for the new Oracle Database
11g If the default Oracle Database
11g |
USERS |
The maximum number of users who can be
granted |
ORACLE_HOME |
The Oracle Database 11g |
For example,
ifyour
C:\> ORADIM-NEW -SID ORCL -SYSPWD TWxy5791 -MAXUSERS 10
-STARTMODE AUTO-PFILE C:\ORACLE\PRODUCT\11.2.0\DB\DATABASE\INITORCL.ORA
ORADIM
3. If your operatingsystem is Linux or UNIX, then perform the following checks:
(1)Your
(2)The
(3)The following environment variablespoint to the Oracle Database
11g
ORACLE_HOME
PATH
(4)Any scripts that clients use to
setthe
4. Log in to the system as the owner of
theOracle Database 11g
5.At a system prompt, change
tothe
6. Start SQL*Plus.
7.Connect to the database instance as
auser
with
8.Start the instanceby issuing the following command:
SQL> STARTUPUPGRADE
Upgrade 关键字的作用:
The
You might berequired to use
the
Once thedatabase is started in upgrade mode, only queries on fixed
views executewithout errors until after
the
The followingare common errors that might occur when attempting to
start the new OracleDatabase 11g
ORA-00401: thevalue for parameter compatible is not supported by this release
The
ORA-39701:database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADE
The
ORA-39700:database must be opened with UPGRADE option
The
ORA-00336: logfile size xxxx blocks is less than minimum 8192 blocks
A redo log file size is less than 4 MB:
If errors appearlisting obsolete initialization parameters, then make a note of the obsoleteinitialization parameters and continue with the upgrade. Remove the obsoleteinitialization parameters the next time you shut down the database.
9. Perform this step onlyif you are
upgrading from Oracle9i
Createa
The
(1)
(2)
(3)
(4)
(5)
The Pre-UpgradeInformation Tool provides an estimate of the minimum
required size
forthe
Table 3-4 Guidelines for Sizing the SYSAUXTablespace
Factor |
Small |
Medium |
Large |
Number of CPUs |
2 |
8 |
32 |
Number of concurrently active sessions |
5 |
20 |
100 |
Number of user objects (tables and indexes) |
500 |
5,000 |
50,000 |
Estimated SYSAUX size at steady state with default configuration |
500 MB |
2 GB |
5 GB |
The followingSQL statement would create a 500
MB
SQL> CREATE TABLESPACE sysaux DATAFILE'sysaux01.dbf'
10. Set the system to spool results to alog file for later verification of success:
SQL> SPOOL upgrade.log
11.Run the Pre-Upgrade Information Tool
byexecuting
the
SQL> @?/rdbms/admin/utlu112i.sql
12. Run
the
SQL> @?/rdbms/admin/catupgrd.sql
这个脚本才是真正的升级脚本,前面搞了那么多,就为了执行这个脚本。
还有一点要注意,就是执行这个脚本会产生大量的归档文件, 平均3分钟产生40M的归档。
该脚本运行了80分钟。 而在Oracle10g下,运行该脚本在40分钟左右。时间增加了一倍。增加了升级系统的宕机时间。
Note:
If you did not run the Pre-Upgrade Information
Tool,the
ORA-00942: tableor view does not exist
ORA-00904:"TZ_VERSION": invalid identifier
ORA-01722:invalid number
If you receiveany of these errors, issue
the
The
The upgrade script creates and alters
certain data dictionary tables. It also upgrades orinstalls the
following database components in the new Oracle
Database11g
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
(18)
(19)
(20)
(21)
(22)
13. Restart the instance to reinitializethe system parameters for normal operation.
SQL> STARTUP
This restart, following the database shutdown performed as part
ofthe
Catupgrd.sql 脚本里会执行shutdown命令。
14.Run
Run
SQL> @?/rdbms/admin/utlu112s.sql
If thePost-Upgrade Status Tool returns errors or shows components
that arenot
示例:
SQL>@?/rdbms/admin/utlu112s.sql
.Oracle Database11.2 Post-Upgrade Status
Tool
.Component
Name
.Oracle
Server
JServer JAVAVirtual Machine
VALID
Oracle WorkspaceManager
OLAP AnalyticWorkspace
OLAP
Catalog
Oracle OLAP
API
OracleEnterprise
Manager
Oracle
XDK
Oracle
Text
Oracle
XMLDatabase
Oracle DatabaseJava
Packages
OracleMultimedia
Spatial
OracleExpression
Filter
Oracle
RulesManager
OracleApplication
Express
GatheringStatistics
Total UpgradeTime: 01:25:42
PL/SQL proceduresuccessfully completed.
该脚本会显示升级各个组件所花的时间,这里显示我们升级组件花了85分钟。
15. Run
SQL> @?/rdbms/admin/catuppst.sql
This may generate thefollowing informational messages:
Generating apply and rollback scripts…
Check the following file for errors:
Apply script: .*
Rollback script: .*
Executing script file…
Updating registry…
Check the following log file for errors:
Generating apply and rollback scripts…
Check the following file for errors:
…/cfgtoollogs/catbundle/catbundle_PSU_*.log
Apply script:
…/rdbms/admin/catbundle_PSU_*_APPLY.sql
Rollback script:
…/rdbms/admin/catbundle_PSU_*_ROLLBACK.sql
Executing script file…
Updating registry…
Check the following log file for errors:
…/cfgtoollogs/catbundle/catbundle_PSU_*.log
16.
Run
SQL> @?/rdbms/admin/utlrp.sql
Verify that all expectedpackages and classes are valid:
SQL> SELECTcount(*) FROM dba_invalid_objects;
SQL> SELECTdistinct object_name FROM dba_invalid_objects;
Note:
If thepre-upgrade information tool
detected
17. Exit SQL*Plus.
18.If you are upgrading a cluster databasefrom releases 10.2, 11.1, or 11.2.0.1, then upgrade the database configurationin Oracle Clusterware using the following command:
$ srvctl upgradedatabase -d db-unique-name -o oraclehome
where
19. 最后调用一下dbca 重建一下OEM。
ORACLE_HOME/hostname_dbname
ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_hostname_dbname
至此,通过命令升级操作结束。
如果在升级过程中遇到问题,可以重新执行升级脚本,步骤如下:
1.Shut down the database as follows:
2.Restart the
databasein
3.Set the system to spool results to a logfile for later verification of success:
4.Rerun
Note:
You can
rerunthe
5.Rerun
最后验证一下各个组件的版本和状态:
SQL> SELECT COMP_NAME, VERSION, STATUSFROM SYS.DBA_REGISTRY;
COMP_NAME
———————————————————————- ———————-
OWB
Oracle Application
Express
Oracle Enterprise
Manager
OLAP
Catalog
Spatial
Oracle
Multimedia
Oracle XML
Database
Oracle
Text
Oracle Expression
Filter
Oracle Rules
Manager
Oracle Workspace
Manager
COMP_NAME
———————————————————————- ———————-
Oracle Database Catalog
Views
Oracle Database Packages and
Types
JServer JAVA Virtual
Machine
Oracle
XDK
Oracle Database Java
Packages
OLAP Analytic
Workspace
Oracle OLAP
API
18 rows selected.
小结:
SQL> show parameter memory
NAME
———————————————– ——————————
hi_shared_memory_address
memory_max_target
memory_target
shared_memory_address
SQL> show parameter java
NAME
———————————————– ——————————
java_jit_enabled
java_max_sessionspace_size
java_pool_size
java_soft_sessionspace_limit
SQL> select * from v$sgainfo;
NAME
——————————– ————-
Fixed SGA
Size
Redo
Buffers
Buffer Cache
Size
Shared Pool
Size
Large Pool
Size
Java Pool
Size
Streams Pool
Size
Shared IO Pool
Size
Granule
Size
Maximum SGA
Size
Startup overhead in Shared
Pool
NAME
——————————– ————-
Free SGA Memory
Available
在这种配置下:catupgrd.sql 跑了85分钟,utlrp.sql 跑了30分钟。然后加上备份的时间,即使采用out-of-place upgrade的方式来升级,安装Oracle database 的时间可以省掉,但总的升级时间还是较10g有增加。
脚本120分钟,备份1个小时,然后冗余1-2小时,申请停机的时间至少需要4个小时,系统耗不起啊。
不过朋友说增加Java_Pool 可以减少运行脚本的时间,这块还没有测试,有朋友测试的话可以试试这种方法。