Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5725951
  • 博文数量: 745
  • 博客积分: 10075
  • 博客等级: 上将
  • 技术积分: 7716
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-29 12:09
文章分类

全部博文(745)

文章存档

2019年(1)

2016年(1)

2010年(31)

2009年(88)

2008年(129)

2007年(155)

2006年(197)

2005年(143)

分类: Oracle

2009-08-19 17:34:25

在升级clusterware以及database补丁之前,需要将crs以及database主目录进行备份,通过操作系统命令cp将“/home/db/oracle/crs”以及“/home/db/oracle/10g”目录拷贝到其他分区。备份crs以及database主目录的目的在于,一旦升级失败,可以通过将备份的目录强制覆盖过去让操作停留在升级前的状态。
 
而在升级数据库之前,我们需要在保证数据库停止的状态下通过rman对数据库进行一个冷备操作,具体过程不赘述,下面进行数据库升级操作:
 
1,停掉副节点crs进程:
[storm02@/home/db/oracle/crs/bin]#./crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
 
2,将主节点数据库启动到nomount状态:
SQL> startup nomount
ORACLE instance started.
Total System Global Area 2.7263E+10 bytes
Fixed Size                  2203928 bytes
Variable Size            2761776872 bytes
Database Buffers         2.4495E+10 bytes
Redo Buffers                4259840 bytes
3,更改cluster_database参数,并关闭数据库:
SQL> alter system set cluster_database=false scope=spfile;
System altered.
SQL> shutdown immediate;
ORA-01507: database not mounted

ORACLE instance shut down.
4,启动数据库到upgrade状态下:
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area 2.7263E+10 bytes
Fixed Size                  2203928 bytes
Variable Size            2761776872 bytes
Database Buffers         2.4495E+10 bytes
Redo Buffers                4259840 bytes
Database mounted.
Database opened.
 
5,运行脚本“/home/db/oracle/10g/rdbms/admin/catupgrd.sql”对数据库进行10.2.0.3到10.2.0.4的升级;
 
6,大约51分钟后升级完毕,请看下图:
 
7,再次的关闭并打开数据库,运行“/home/db/oracle/10g/rdbms/admin/utlrp.sql“脚本进行升级后的检查:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2.7263E+10 bytes
Fixed Size                  2203928 bytes
Variable Size            2812108520 bytes
Database Buffers         2.4444E+10 bytes
Redo Buffers                4259840 bytes
Database mounted.
Database opened.
 
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for HPUX: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
可见此时数据库已经成功升级为10.2.0.4版本。
 
SQL> @/home/db/oracle/10g/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2009-08-18 01:18:01
DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is 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 a large number of invalid
DOC>   objects.
……………………
……………………
……………………
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2009-08-18 01:18:22
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
                  0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
                          0
检查完毕,在升级过程中并没有产生任何错误,说明升级是成功的。
 
8,重新修改参数并启动数据库进行参数效验:
SQL> alter system set cluster_database=true scope=spfile;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup;
ORACLE instance started.
Total System Global Area 2.7263E+10 bytes
Fixed Size                  2203928 bytes
Variable Size            2812108520 bytes
Database Buffers         2.4444E+10 bytes
Redo Buffers                4259840 bytes
Database mounted.
Database opened.
SQL> show parameter cluster_database;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     TRUE
cluster_database_instances           integer     2
 
9,停掉主节点上的数据库以及crs进程,准备副节点上数据库的升级工作:
[OFSADB01@/home/db/oracle/crs/bin]#./crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
 
下面进入到意外发生现场。
 
阅读(2198) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~