ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RAC10g升级与回退方案

RAC10g升级与回退方案

原创 Linux操作系统 作者:yingyifeng306 时间:2011-10-21 17:21:06 0 删除 编辑

数据库升级。由原本的10.2.0.1升级至10.2.0.5 包括CRS和RDBMS 主要为了测试升级步骤和升级的回退方案是否成功。

升级前准备 

1、检查hosts文件配置 

确保双节点检查/etc/hosts文件配置正确 

[root@rac1 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1       localhost

192.168.72.70   rac1

192.168.72.80   rac2

192.168.72.71   rac1-vip

192.168.72.72   rac2-vip

10.10.10.70     rac1-priv

10.10.10.80     rac2-priv

[root@rac1 ~]# 

2、检查crs运行状况 

一节点:

[root@rac1 oracle]# crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

[root@rac2 oracle]# crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

二节点:

oracle.orcl2@racdb02:/home/oracle$crsctl check crs 

CSS appears healthy 

CRS appears healthy 

EVM appears healthy 

3、检查ocr,voting盘权限 

确保ocr,voting权限正常。 

4、检查listener  

一节点:

[root@rac1 oracle]# lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-OCT-2011 12:05:56

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_RAC1

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                21-OCT-2011 10:40:46

Uptime                    0 days 1 hr. 25 min. 9 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/app/product/db_1/network/admin/listener.ora

Listener Log File         /oracle/app/product/db_1/network/log/listener_rac1.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.72.71)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.72.70)(PORT=1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...

Service "+ASM_XPT" has 1 instance(s).

  Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl" has 2 instance(s).

  Instance "orcl1", status READY, has 2 handler(s) for this service...

  Instance "orcl2", status READY, has 1 handler(s) for this service...

Service "orclXDB" has 2 instance(s).

  Instance "orcl1", status READY, has 1 handler(s) for this service...

  Instance "orcl2", status READY, has 1 handler(s) for this service...

Service "orcl_XPT" has 2 instance(s).

  Instance "orcl1", status READY, has 2 handler(s) for this service...

  Instance "orcl2", status READY, has 1 handler(s) for this service...

The command completed successfully

二节点:

[root@rac2 oracle]# lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-OCT-2011 12:05:08

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_RAC2

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                21-OCT-2011 11:18:12

Uptime                    0 days 0 hr. 46 min. 55 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/app/product/db_1/network/admin/listener.ora

Listener Log File         /oracle/app/product/db_1/network/log/listener_rac2.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.72.72)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.72.80)(PORT=1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...

Service "+ASM_XPT" has 1 instance(s).

  Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl" has 2 instance(s).

  Instance "orcl1", status READY, has 1 handler(s) for this service...

  Instance "orcl2", status READY, has 2 handler(s) for this service...

Service "orclXDB" has 2 instance(s).

  Instance "orcl1", status READY, has 1 handler(s) for this service...

  Instance "orcl2", status READY, has 1 handler(s) for this service...

Service "orcl_XPT" has 2 instance(s).

  Instance "orcl1", status READY, has 1 handler(s) for this service...

  Instance "orcl2", status READY, has 2 handler(s) for this service...

The command completed successfully

5、确定Oracle Time Zone 

由于Oracle升级会带来Time Zone变化,需要事先检查其状况 

SQL> select version from v$timezone_file; 

   VERSION

----------

         2

SQL> select c.owner || '.' || c.table_name || '(' || c.column_name || ') -' || c.data_type || ' ' col

  2  from dba_tab_cols c, dba_objects o

  3  where c.data_type like '%TIME ZONE'

  4  and c.owner=o.owner

  5  and c.table_name = o.object_name

  6  and o.object_type = 'TABLE'

  7  order by col

  8  ;


COL

--------------------------------------------------------------------------------

SYS.ALERT_QT(SYS_NC00029$) -TIMESTAMP(0) WITH TIME ZONE

SYS.FGR$_FILE_GROUPS(CREATION_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.FGR$_FILE_GROUP_FILES(CREATION_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.FGR$_FILE_GROUP_VERSIONS(CREATION_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.OPTSTAT_HIST_CONTROL$(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

SYS.OPTSTAT_HIST_CONTROL$(SVAL2) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_EVENT_LOG(LOG_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_EVENT_QTAB(SYS_NC00032$) -TIMESTAMP(0) WITH TIME ZONE

SYS.SCHEDULER$_EVENT_QTAB(SYS_NC00044$) -TIMESTAMP(0) WITH TIME ZONE

SYS.SCHEDULER$_EVENT_QTAB(SYS_NC00045$) -TIMESTAMP(0) WITH TIME ZONE

SYS.SCHEDULER$_GLOBAL_ATTRIBUTE(ATTR_TSTAMP) -TIMESTAMP(6) WITH TIME ZONE


COL

--------------------------------------------------------------------------------

SYS.SCHEDULER$_JOB(END_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB(LAST_ENABLED_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB(LAST_END_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB(LAST_START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB(NEXT_RUN_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB(START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB_RUN_DETAILS(LOG_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB_RUN_DETAILS(REQ_START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_JOB_RUN_DETAILS(START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_SCHEDULE(END_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_SCHEDULE(REFERENCE_DATE) -TIMESTAMP(6) WITH TIME ZONE

COL

--------------------------------------------------------------------------------

SYS.SCHEDULER$_STEP_STATE(END_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_STEP_STATE(START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW(ACTUAL_START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW(END_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW(LAST_START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW(MANUAL_OPEN_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW(NEXT_START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW(START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW_DETAILS(LOG_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW_DETAILS(REQ_START_DATE) -TIMESTAMP(6) WITH TIME ZONE

SYS.SCHEDULER$_WINDOW_DETAILS(START_DATE) -TIMESTAMP(6) WITH TIME ZONE

COL

--------------------------------------------------------------------------------

SYS.TSM_DST$(DST_END_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.TSM_DST$(DST_INST_START_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.TSM_DST$(DST_START_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.TSM_SRC$(SRC_END_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.TSM_SRC$(SRC_INST_START_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.TSM_SRC$(SRC_START_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_ALERT_HISTORY(CREATION_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_ALERT_HISTORY(TIME_SUGGESTED) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_ALERT_OUTSTANDING(CREATION_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_ALERT_OUTSTANDING(TIME_SUGGESTED) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_AUX_HISTORY(SAVTIME) -TIMESTAMP(6) WITH TIME ZONE

COL

--------------------------------------------------------------------------------

SYS.WRI$_OPTSTAT_AUX_HISTORY(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_HISTGRM_HISTORY(SAVTIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_HISTGRM_HISTORY(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_HISTHEAD_HISTORY(SAVTIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_HISTHEAD_HISTORY(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_IND_HISTORY(SAVTIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_IND_HISTORY(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_OPR(END_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_OPR(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_OPR(START_TIME) -TIMESTAMP(6) WITH TIME ZONE

SYS.WRI$_OPTSTAT_TAB_HISTORY(SAVTIME) -TIMESTAMP(6) WITH TIME ZONE

COL

--------------------------------------------------------------------------------

SYS.WRI$_OPTSTAT_TAB_HISTORY(SPARE6) -TIMESTAMP(6) WITH TIME ZONE

WMSYS.WM$VERSIONED_TABLES(SYS_NC00020$) -TIMESTAMP(0) WITH TIME ZONE

WMSYS.WM$VERSIONED_TABLES(SYS_NC00021$) -TIMESTAMP(0) WITH TIME ZONE

58 rows selected.

SQL>  SELECT object_name FROM dba_objects WHERE object_id IN (SELECT obj# FROM scheduler$_window);


OBJECT_NAME 

-------------------------------------------------------------------------------- 

WEEKNIGHT_WINDOW 

WEEKEND_WINDOW 

SQL> SELECT object_name FROM dba_objects WHERE object_id IN (SELECT obj# FROM scheduler$_job); 

OBJECT_NAME

--------------------------------------------------------------------------------

PURGE_LOG

FGR$AUTOPURGE_JOB

GATHER_STATS_JOB

AUTO_SPACE_ADVISOR_JOB

RLM$EVTCLEANUP

RLM$SCHDNEGACTION

6 rows selected.

6、重启crs 

重启双节点crs和rdbms,确保crs和rdbms运行正常。 

在一个节点对所有CRS资源进行启停 

[root@rac1 oracle]# srvctl stop service -d orcl

[root@rac1 oracle]# srvctl stop database -d orcl

[root@rac1 oracle]# srvctl stop asm -n rac1

[root@rac1 oracle]# srvctl stop asm -n rac2

[root@rac1 oracle]# srvctl stop nodeapps -n rac1

[root@rac1 oracle]# srvctl stop nodeapps -n rac2

暂停crs

一节点关闭:

[root@rac1 oracle]# crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

[root@rac1 oracle]# crsctl stop crs

Stopping resources.

Successfully stopped CRS resources 

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

 二节点关闭:          

[root@rac2 oracle]# crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

[root@rac2 oracle]# crsctl stop crs

Stopping resources.

Successfully stopped CRS resources 

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

一节点重启:

[root@rac1 oracle]# crsctl start crs

Attempting to start CRS stack 

The CRS stack will be started shortly


二节点重启:

[root@rac2 oracle]# crsctl start crs

Attempting to start CRS stack 

The CRS stack will be started shortly

重启完毕,资源被自动带起

[root@rac1 oracle]# crs_stat -t

Name           Type           Target    State     Host        

------------------------------------------------------------

ora.orcl.db    application    ONLINE    ONLINE    rac1        

ora....l1.inst application    ONLINE    ONLINE    rac1        

ora....l2.inst application    ONLINE    ONLINE    rac2        

ora....SM1.asm application    ONLINE    ONLINE    rac1        

ora....C1.lsnr application    ONLINE    ONLINE    rac1        

ora.rac1.gsd   application    ONLINE    ONLINE    rac1        

ora.rac1.ons   application    ONLINE    ONLINE    rac1        

ora.rac1.vip   application    ONLINE    ONLINE    rac1        

ora....SM2.asm application    ONLINE    ONLINE    rac2        

ora....C2.lsnr application    ONLINE    ONLINE    rac2        

ora.rac2.gsd   application    ONLINE    ONLINE    rac2        

ora.rac2.ons   application    ONLINE    ONLINE    rac2        

ora.rac2.vip   application    ONLINE    ONLINE    rac2    

7.确认归档开启:

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            +DATA1/orcl/

Oldest online log sequence     8

Next log sequence to archive   9

Current log sequence           9

8.基础环境检查完毕,进行升级的回退保障。

备份数据库(由于是本机测试环境,没有做过任何备份,因此须全被数据库,生产环境中进行增量备份。)

RMAN> backup database format '/oracle/bak/df_t%t_s%s_p%p';

Starting backup at 21-OCT-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=135 instance=orcl1 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00001 name=+DATA1/orcl/datafile/system.256.765044015

input datafile fno=00003 name=+DATA1/orcl/datafile/sysaux.257.765044017

input datafile fno=00002 name=+DATA1/orcl/datafile/undotbs1.258.765044019

input datafile fno=00005 name=+DATA1/orcl/datafile/undotbs2.267.765044353

input datafile fno=00004 name=+DATA1/orcl/datafile/users.259.765044019

channel ORA_DISK_1: starting piece 1 at 21-OCT-11

channel ORA_DISK_1: finished piece 1 at 21-OCT-11

piece handle=/oracle/bak/df_t765116367_s1_p1 tag=TAG20111021T121927 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:02:29

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current control file in backupset

including current SPFILE in backupset

channel ORA_DISK_1: starting piece 1 at 21-OCT-11

channel ORA_DISK_1: finished piece 1 at 21-OCT-11

piece handle=/oracle/bak/df_t765116517_s2_p1 tag=TAG20111021T121927 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:06

Finished backup at 21-OCT-11

备份归档:

RMAN> backup archivelog all format '/oracle/bak/al_t%t_s%s_p%p';


Starting backup at 21-OCT-11

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=2 recid=2 stamp=765059889

input archive log thread=1 sequence=3 recid=4 stamp=765061331

input archive log thread=1 sequence=4 recid=6 stamp=765068146

input archive log thread=1 sequence=5 recid=9 stamp=765069649

input archive log thread=1 sequence=6 recid=10 stamp=765103495

input archive log thread=1 sequence=7 recid=12 stamp=765110425

input archive log thread=1 sequence=8 recid=14 stamp=765112414

input archive log thread=1 sequence=9 recid=16 stamp=765116677

input archive log thread=1 sequence=10 recid=18 stamp=765116687

input archive log thread=1 sequence=11 recid=19 stamp=765116693

input archive log thread=1 sequence=12 recid=21 stamp=765116712

input archive log thread=1 sequence=13 recid=25 stamp=765116745

input archive log thread=2 sequence=1 recid=1 stamp=765059790

input archive log thread=2 sequence=2 recid=3 stamp=765061253

input archive log thread=2 sequence=3 recid=5 stamp=765061535

input archive log thread=2 sequence=4 recid=7 stamp=765068768

input archive log thread=2 sequence=5 recid=8 stamp=765069593

input archive log thread=2 sequence=6 recid=11 stamp=765103540

input archive log thread=2 sequence=7 recid=13 stamp=765110607

input archive log thread=2 sequence=8 recid=15 stamp=765112666

input archive log thread=2 sequence=9 recid=17 stamp=765116654

input archive log thread=2 sequence=10 recid=20 stamp=765116669

input archive log thread=2 sequence=11 recid=22 stamp=765116678

input archive log thread=2 sequence=12 recid=23 stamp=765116685

input archive log thread=2 sequence=13 recid=24 stamp=765116802

channel ORA_DISK_1: starting piece 1 at 21-OCT-11

channel ORA_DISK_1: finished piece 1 at 21-OCT-11

piece handle=/oracle/bak/al_t765116750_s3_p1 tag=TAG20111021T122548 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:09

Finished backup at 21-OCT-11

9.确认闪回配置:

SQL> show parameter recover   

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest                string      +DATA1

db_recovery_file_dest_size           big integer 2G

recovery_parallelism                 integer     0


10、检查互信机制

由于在升级过程节点之间需要拷贝软件,必须确保双节点oracle用户互通。

[oracle@rac1 ~]$ ssh rac1 date

Fri Oct 21 12:22:17 CST 2011

[oracle@rac1 ~]$ ssh rac2 date

Fri Oct 21 12:23:16 CST 2011

[oracle@rac1 ~]$ ssh rac1-priv date

Fri Oct 21 12:22:23 CST 2011

[oracle@rac1 ~]$ ssh rac2-priv date

Fri Oct 21 12:23:24 CST 2011


11.备份ocr和voting盘 

停止crs,rdbms各种服务和进程 

备份ocr盘 

oracle.orcl1@racdb01:/home/oracle$ocrconfig -showbackup 

没有备份信息,可能和系统刚装上有关。

[root@rac1 oracle]# more /etc/oracle/ocr.loc 

ocrconfig_loc=/dev/raw/raw1

ocrmirrorconfig_loc=/dev/raw/raw2

local_only=FALSE

对ocr做export:

[root@rac1 OPatch]# ocrconfig -export /oracle/bak/ocr_export.bak

备份voting盘 

[root@rac1 OPatch]# ocrconfig -export /oracle/bak/ocr_export.bak

[root@rac1 OPatch]# crsctl query css votedisk;

 0.     0    /dev/raw/raw3

 1.     0    /dev/raw/raw4

 2.     0    /dev/raw/raw5

located 3 votedisk(s). 

[root@rac1 oracle]# dd if=/dev/raw/raw3 f=/oracle/bak/vote_dd.bak

208864+0 records in

208864+0 records out

同样根据上面的信息,为求保险,我们可以对ocr盘也做dd操作:

[root@rac1 oracle]# dd if=/dev/raw/raw1 f=/oracle/bak/ocr_dd.bak

208864+0 records in

208864+0 records out

 

12.备份crs和rdbms软件 

双节点备份crs和rdbms软件 

[root@rac2 oracle]#tar -cvf products.tar products 

[root@rac2 oracle]#tar -cvf oraInventory.tar oraInventory 

[root@rac2 oracle]#tar -cvf products.tar products 

[root@rac2 oracle]#tar -cvf oraInventory.tar oraInventory 

创建还原点:

将数据库启动到mount状态,创建还原点:

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.


Total System Global Area  184549376 bytes

Fixed Size                  1218412 bytes

Variable Size              92276884 bytes

Database Buffers           88080384 bytes

Redo Buffers                2973696 bytes

Database mounted.

SQL> create restore point before_up guarantee flashback database;

Restore point created.

SQL> select name from v$restore_point;

NAME

--------------------------------------------------------------------------------

BEFORE_UP


CRS升级 

1.升级crs 

根据图形界面操作:(截图省略)

选择升级CRS,点击next

执行结果:

一节点执行:

[root@rac1 Disk1]# /oracle/app/product/10.2.0/crs/bin/crsctl stop crs

Stopping resources.

Successfully stopped CRS resources 

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

[root@rac1 Disk1]# /oracle/app/product/10.2.0/crs/install/root102.sh

Creating pre-patch directory for saving pre-patch clusterware files

Completed patching clusterware files to /oracle/app/product/10.2.0/crs

Relinking some shared libraries.

Relinking of patched files is complete.

WARNING: directory '/oracle/app/product/10.2.0' is not owned by root

WARNING: directory '/oracle/app/product' is not owned by root

WARNING: directory '/oracle/app' is not owned by root

WARNING: directory '/oracle' is not owned by root

Preparing to recopy patched init and RC scripts.

Recopying init and RC scripts.

Startup will be queued to init within 30 seconds.

Starting up the CRS daemons.

Waiting for the patched CRS daemons to start.

  This may take a while on some systems.

10205 patch successfully applied.

clscfg: EXISTING configuration version 3 detected.

clscfg: version 3 is 10G Release 2.

Successfully deleted 1 values from OCR.

Successfully deleted 1 keys from OCR.

Successfully accumulated necessary OCR keys.

Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.

node :

node 1: rac1 rac1-priv rac1

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

clscfg -upgrade completed successfully

Creating '/oracle/app/product/10.2.0/crs/install/paramfile.crs' with data used for CRS configuration

Setting CRS configuration values in /oracle/app/product/10.2.0/crs/install/paramfile.crs

2.升级数据库:(截图略)

一节点执行结果:

[root@rac1 Disk1]# /oracle/app/product/db_1/root.sh

Running Oracle 10g root.sh script...

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/product/db_1


Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying coraenv to /usr/local/bin ...


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.sh script.

Now product-specific root actions will be performed.

二节点执行结果:

[root@rac2 app]# /oracle/app/product/db_1/root.sh

Running Oracle 10g root.sh script...

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/product/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying coraenv to /usr/local/bin ...

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.sh script.

Now product-specific root actions will be performed.

3.刷新数据字典 

刷数据字典时以upgrade打开时报错:

ORA-39701: database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADE

Error 39701 happened during db open, shutting down database

USER: terminating instance due to error 39701

Instance terminated by USER, pid = 3015

ORA-1092 signalled during: ALTER DATABASE OPEN MIGRATE...

查阅metalink,忘记设置参数RAC刷数据字典的参数了CLUSTER_DATABASE=FALSE;

SQL> startup nomount

ORACLE instance started.

Total System Global Area  184549376 bytes

Fixed Size                  1272696 bytes

Variable Size             104858760 bytes

Database Buffers           75497472 bytes

Redo Buffers                2920448 bytes

SQL> alter system set cluster_database=false scope=spfile sid='*';

System altered.

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup upgrade

ORACLE instance started.

Total System Global Area  184549376 bytes

Fixed Size                  1272696 bytes

Variable Size             104858760 bytes

Database Buffers           75497472 bytes

Redo Buffers                2920448 bytes

Database mounted.

Database opened.

SQL> select count(*) from dba_objects where status='INVALID';

  COUNT(*)

----------

       133

SQL> SPOOL patch.log 

SQL> @?/rdbms/admin/catupgrd.sql 

SQL> SPOOL OFF 

假设升级失败,测试我们刚才所有的回退是否有效:由于没有对CRS的/etc/目录下内容进行备份。所以本次操作只回退数据库

首先将现有的数据库软件和CRS软件做备份(双节点执行)

[root@rac1 app]# mv product product.new

并将之前tar包得软件解压出来,将product.new 中的CRS软件替换回来。

重启系统,查看CRS是否有问题:

两个节点CRS均自动带起:

[root@rac1 oracle]# crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

[root@rac1 oracle]# crs_stat -t

Name           Type           Target    State     Host        

------------------------------------------------------------

ora.orcl.db    application    OFFLINE   OFFLINE               

ora....l1.inst application    ONLINE    OFFLINE               

ora....l2.inst application    ONLINE    OFFLINE               

ora....SM1.asm application    ONLINE    ONLINE    rac1        

ora....C1.lsnr application    ONLINE    ONLINE    rac1        

ora.rac1.gsd   application    ONLINE    ONLINE    rac1        

ora.rac1.ons   application    ONLINE    ONLINE    rac1        

ora.rac1.vip   application    ONLINE    ONLINE    rac1        

ora....SM2.asm application    ONLINE    ONLINE    rac2        

ora....C2.lsnr application    ONLINE    ONLINE    rac2        

ora.rac2.gsd   application    ONLINE    ONLINE    rac2        

ora.rac2.ons   application    ONLINE    ONLINE    rac2        

ora.rac2.vip   application    ONLINE    ONLINE    rac2 

恢复数据库:

将数据库启动到mount状态:

[oracle@rac1 app]$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Oct 21 16:17:10 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;

ORACLE instance started.

Total System Global Area  184549376 bytes

Fixed Size                  1218412 bytes

Variable Size             130025620 bytes

Database Buffers           50331648 bytes

Redo Buffers                2973696 bytes

Database mounted.

查找还原点:

SQL> select name from v$restore_point;

NAME

--------------------------------------------------------------------------------

BEFORE_UP

尝试flashback database

SQL> flashback database to restore point BEFORE_UP;

Flashback complete.

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

Database altered.

数据库级成功回退。

重启数据库,看是否正常:

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

[root@rac2 oracle]# crs_stat -t

Name           Type           Target    State     Host        

------------------------------------------------------------

ora.orcl.db    application    ONLINE    ONLINE    rac1        

ora....l1.inst application    ONLINE    OFFLINE               

ora....l2.inst application    ONLINE    ONLINE    rac2        

ora....SM1.asm application    ONLINE    ONLINE    rac1        

ora....C1.lsnr application    ONLINE    ONLINE    rac1        

ora.rac1.gsd   application    ONLINE    ONLINE    rac1        

ora.rac1.ons   application    ONLINE    ONLINE    rac1        

ora.rac1.vip   application    ONLINE    ONLINE    rac1        

ora....SM2.asm application    ONLINE    ONLINE    rac2        

ora....C2.lsnr application    ONLINE    ONLINE    rac2        

ora.rac2.gsd   application    ONLINE    ONLINE    rac2        

ora.rac2.ons   application    ONLINE    ONLINE    rac2        

ora.rac2.vip   application    ONLINE    ONLINE    rac2   

一节点没起来,查看告警文件:

Fri Oct 21 16:35:14 2011

Error: can not register my instance state - -1

Fri Oct 21 16:35:14 2011

ALTER DATABASE   MOUNT

Fri Oct 21 16:35:25 2011

ORA-1102 signalled during: ALTER DATABASE   MOUNT...

Fri Oct 21 16:35:29 2011

Shutting down instance (abort)

License high water mark = 1

Instance terminated by USER, pid = 14685

实例一直无法注册,原来是集群参数没有改回来:

SQL> show parameter cluster

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

cluster_database                     boolean     FALSE

cluster_database_instances           integer     1

cluster_interconnects                string

SQL> alter system set cluster_database=TRUE scope=spfile sid='*'; 

System altered.

[root@rac2 app]# srvctl stop database -d orcl

[root@rac2 app]# srvctl start database -d orcl

[root@rac2 app]# crs_stat -t

Name           Type           Target    State     Host        

------------------------------------------------------------

ora.orcl.db    application    ONLINE    ONLINE    rac2        

ora....l1.inst application    ONLINE    ONLINE    rac1        

ora....l2.inst application    ONLINE    ONLINE    rac2        

ora....SM1.asm application    ONLINE    ONLINE    rac1        

ora....C1.lsnr application    ONLINE    ONLINE    rac1        

ora.rac1.gsd   application    ONLINE    ONLINE    rac1        

ora.rac1.ons   application    ONLINE    ONLINE    rac1        

ora.rac1.vip   application    ONLINE    ONLINE    rac1        

ora....SM2.asm application    ONLINE    ONLINE    rac2        

ora....C2.lsnr application    ONLINE    ONLINE    rac2        

ora.rac2.gsd   application    ONLINE    ONLINE    rac2        

ora.rac2.ons   application    ONLINE    ONLINE    rac2        

ora.rac2.vip   application    ONLINE    ONLINE    rac2        

数据库正常启动.因为没有对/etc/下面的CRS配置信息进行备份,所以如果要还原CRS版本,则需要重新配置root.sh




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23732248/viewspace-709491/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 关于myBase Desktop
请登录后发表评论 登录
全部评论
ITpub论坛高可用版主,擅长研究Oracle 内部原理、新特性、高可用和性能调优等,多年来一直保持着对新事务旺盛的求知欲。热切关注 Oracle 和其它相关技术

注册时间:2011-10-12

  • 博文量
    291
  • 访问量
    1592996