(转)Oracle RAC日常管理命令

时间:2022-10-12 23:37:18

转自:http://www.xuebuyuan.com/1206937.html

一、查看RAC环境

RAC架构,2节点信息

节点1

SQL> show parameter instance

NAME TYPE VALUE

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

active_instance_count integer

cluster_database_instances integer 2

instance_groups string

instance_name string RACDB1

instance_number Integer 1

instance_type string RDBMS

open_links_per_instance integer 4

parallel_instance_group string

parallel_server_instances integer 2

节点2

SQL> show parameter instance、

NAME TYPE VALUE

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

active_instance_count integer

cluster_database_instances integer 2

instance_groups string

instance_name string RACDB2

instance_number integer 2

instance_type string RDBMS

open_links_per_instance integer 4

parallel_instance_group string

parallel_server_instances integer 2

数据库版本

SQL> select * from v$version;

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE 10.2.0.1.0 Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

操作系统信息

节点1

[oracle@rac1 ~]$ uname -a

Linux rac1 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT 2007 i686 i686 i386 GNU/Linux

节点2

[oracle@rac2 ~]$ uname -a

Linux rac2 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT 2007 i686 i686 i386 GNU/Linux

[oracle@leonarding1 admin]$ uname -a

Linux leonarding1.oracle.com 2.6.32-200.13.1.el5uek #1 SMP Wed Jul 27 21:02:33 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

RAC所有资源信息

[oracle@rac2 ~]$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application ONLINE ONLINE rac1

ora....B2.inst application ONLINE ONLINE rac2

ora....DB1.srv application ONLINE ONLINE rac2

ora.....TAF.cs application ONLINE ONLINE rac2

ora.RACDB.db 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

二启动和关闭crs主进程

(1)简单说说RAC日常管理都有哪些内容

1.节点管理:node日常管理

2.网络管理:例如网卡配置 VIP虚拟ip外部网络
内部网络

3.集群管理:CRS集群资源管理 OCR oracle集群注册表 srv服务管理
votedisk表决磁盘

4.应用管理:数据库、实例、监听器、虚拟ip、注册到RAC中的各种资源

(2)RAC集群守护进程

[oracle@rac1 init.d]$ pwd

/etc/init.d

[oracle@rac1 init.d]$ ll | grep init*

init.crsd:# init.crsd - Control script for the CRS daemon.

init.crsd:# only be invoked from init.crs or from inittab.

init.crsd:# No manual invocation of init.crsd is supported.

init.crsd:# or on an automatic startup, this file will exist. init.crsd run will

init.cssd:# directory. It should only be invoked from init.crs.

init.evmd:# be invoked from init.crs.

[oracle@rac1 init.d]$ ls init*

init.crs init.crsd init.cssd init.evmd

这些就是RAC集群守护进程,存放在Linux开机启动的脚本目录下,可以随操作系统的启动而启动。

./init.crs start启动集群进程

./init.crs stop停止集群进程

./init.crs enable随操作系统的启动而启动

./init.crs disable不随操作系统的启动而启动

注:init.crs脚本是init.crsd init.cssd init.evmd脚本的引导脚本

crs主要进程

(1)crsd
负责管理HA 高可靠性操作
管理crs资源,如linstener,vip,ons,gsn等
由root用户管理、启动
(2)ocssd
管理各节点的关系,用于节点间通信
由oracle用户运行管理
(3)oprocd
集群进程管理 —Process monitor for the cluster.集群监控进程
仅在没有使用vendor的集群软件状态下运行
(4)evmd
事件检测进程,由oracle用户运行管理
(5)主要log位置
$ORA_CRS_HOME/log/节点主机名(rac1 rac2)/racg 
节点日志
$ORA_CRS_HOME/log/节点主机名(rac1 rac2)/crsd集群软件日志
$ORA_CRS_HOME/crs/init
$ORA_CRS_HOME/css/log 节点间通信的日志
$ORA_CRS_HOME/css/init
$ORA_CRS_HOME/evm/log 事件监控日志
$ORA_CRS_HOME/evm/init
$ORA_CRS_HOME/srvm/log

演示

[oracle@rac1 init.d]$ su – root必须使用root用户执行RAC集群脚本

Password:

[root@rac1 ~]# cd /etc/init.d

[root@rac1 init.d]# ./init.crs disable

Automatic startup disabled for system boot.

[root@rac1 init.d]# ./init.crs enable

Automatic startup enabled for system boot.

[root@rac1 init.d]# ./init.crs stop停止CRS主进程

Shutting down Oracle Cluster Ready Services (CRS):

Stopping resources.

Successfully stopped CRS resources包含crsd

Stopping CSSD.

Shutting down CSS daemon.包含cssd

Shutdown request successfully issued.

Shutdown has begun. The daemons should exit soon.

[root@rac1 init.d]# ./init.crs start启动CRS主进程

Startup will be queued to init within 90 seconds.启动将会在90秒内完成

[root@rac1 init.d]# crs_stat -t

Name Type Target State Host

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

ora....B1.inst application ONLINE ONLINE rac1

ora....B2.inst application ONLINE ONLINE rac2

ora....DB1.srv application ONLINE ONLINE rac2

ora.....TAF.cs application ONLINE ONLINE rac2

ora.RACDB.db 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

等待一会并不一定是90秒,CRS集群资源全部启动了

(3)RAC集群命令集目录

$ORACLE_HOME/crs_1/bin

所有集群命令都放在这个目录下

(4)节点层命令

[oracle@rac1 init.d]$ olsnodes -n

rac1 1

rac2 2

[oracle@rac1 init.d]$ olsnodes -n -p

rac1 1 rac1-priv

rac2 2 rac2-priv

[oracle@rac1 init.d]$ olsnodes -n -p -i

rac1 1 rac1-priv rac1-vip

rac2 2 rac2-priv rac2-vip

这个命令用来显示集群节点的信息

参数解释:n打印节点号


打印私有网络名


打印虚拟ip

(2)网络层命令

[oracle@rac1 init.d]$ oifcfgOracle网卡配置工具

Name:

oifcfg - Oracle Interface Configuration Tool.

Usage: oifcfg iflist [-p [-n]]

oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...

oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]

oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]]

oifcfg [-help]

<nodename> - name of the host, as known to a communications network

<if_name> - name by which the interface is configured in the system

<subnet> - subnet address of the interface

<if_type> - type of the interface { cluster_interconnect | public | storage }

[oracle@rac1 init.d]$ oifcfg iflist查看网卡对应的网段,oracle网卡配置工具

eth0 192.168.1.0

eth1 192.168.2.0

eth2 192.168.61.0

$ oifcfg getif没有配置之前是什么内容也没有


oifcfg setif -global eth0/192.168.1.0:publicoracle网卡配置工具指定公有网卡


oifcfg setif -global eth1/192.168.2.0:cluster_interconnectoracle网卡配置工具指定私有网

[oracle@rac1 init.d]$ oifcfg getif获取配置结果

eth0 192.168.1.0 global publiceth0是全局公共网卡

eth1 192.168.2.0 global cluster_interconnecteth1是全局私有网卡

三查看OCR磁盘的信息,并打印出OCR磁盘的内容

OCR:称为Oracle集群注册表,一般RAC集群中至少有2个OCR磁盘互为镜像,OCR里面注册了集群中的所有资源信息(数据库实例
监听器 VIP OCR磁盘表决磁盘
服务节点应用
网卡等)

我们可以使用ocrcheck命令检查OCR磁盘状态

节点1

RACDB1@rac1 /home/oracle$ ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 2

Total space (kbytes) : 104344总空间

Used space (kbytes) : 4324使用空间

Available space (kbytes) : 100020剩余空间

ID : 1752469369

Device/File Name : /dev/raw/raw1磁盘路径

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

节点2

RACDB2@rac2 /home/oracle$ ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 2

Total space (kbytes) : 104344

Used space (kbytes) : 4324

Available space (kbytes) : 100020

ID : 1752469369

Device/File Name : /dev/raw/raw1

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

使用ocrdump命令查看OCR内容,但这个命令不能用于OCR的备份恢复只可以用于阅读

RACDB1@rac1 /home/oracle$ ocrdump -stdout | more

[SYSTEM.evm.acceptor]

UNDEF :

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : root, GROUP_NAME : root}

[SYSTEM.evm.acceptor.rac1]

ORATEXT : (ADDRESS=(PROTOCOL=ipc)(KEY=Arac1_crs_evm))

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : root, GROUP_NAME : root}

[SYSTEM.evm.acceptor.rac2]

ORATEXT : (ADDRESS=(PROTOCOL=ipc)(KEY=Arac2_crs_evm))

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : root, GROUP_NAME : root}

使用ocrconfig命令配置维护OCR磁盘,例如导出备份OCRDUMP文件再导入来恢复OCR

[oracle@rac1 init.d]$ su - root

Password:

[root@rac1 ~]# cd /home/oracle

[root@rac1 oracle]# ll

total 4

drwxr-xr-x 3 oracle oinstall 4096 Jul 5 2013 Desktop

[root@rac1 oracle]# ocrconfig -export ocr_bk.dmp导出OCR磁盘内容,一旦有问题可以导入恢复

[root@rac1 oracle]# ll

total 104

drwxr-xr-x 3 oracle oinstall 4096 Jul 5 2013 Desktop

-rw-r--r-- 1 root root 97517 Jul 4 17:57 ocr_bk.dmp

[root@rac1 oracle]# strings ocr_bk.dmp可以使用这个命令来查看dump文件内容

[root@rac1 oracle]# ocrconfig -import ocr_bk.dmp导入dump文件恢复OCR

[root@rac1 oracle]# ocrconfig –replace ocrmirror /dev/raw/raw2创建新的OCR磁盘镜像

四、查看voting disk磁盘信息

Voting Disk这个文件主要用于记录节点成员状态,在出现脑裂时,决定那个Partion获得控制权,其他的Partion必须从集群中剔除。Voting
disk使用的是一种“多数可用算法”,如果有多个Voting disk,,则必须一半以上的Votedisk同时存活,Clusterware才能正常使用。比如配置了4个Votedisk,坏一个Votedisk,集群可以正常工作,如果坏了2个,则不能满足半数以上,集群会立即宕掉,所有节点立即重启,所以如果添加Votedisk,尽量不要只添加一个,而应该添加2个,总共的数量保证为奇数。

(1)表决磁盘检查,必须为单数

RACDB2@rac2 /home/oracle$ crsctl query css votedisk

0. 0 /dev/raw/raw2

located 1 votedisk(s).定位1个表决磁盘

(2)备份votedisk盘

因为我们的表决磁盘使用的是裸设备,因此使用裸设备的dd命令来备份表决磁盘,使用root用户

[root@rac1 oracle]# dd if=/dev/raw/raw2 of=/home/oracle/voting_disk.bak

208864+0 records in表决磁盘中的记录数

208864+0 records out

106938368 bytes (107 MB) copied, 104.614 seconds, 1.0 MB/s

[root@rac1 oracle]# ll

total 104644

drwxr-xr-x 3 oracle oinstall 4096 Jul 5 2013 Desktop

-rw-r--r-- 1 root root 97517 Jul 4 17:57 ocr_bk.dmp

-rw-r--r-- 1 root root 106938368 Jul 4 18:37voting_disk.bak

[root@rac1 oracle]# du -sm voting_disk.bak备份文件103MB

103 voting_disk.bak

(3)恢复votedisk盘

[root@rac1 oracle]# dd if=/home/oracle/voting_disk.bak of=/dev/raw/raw2

使用上述命令即可恢复表决磁盘,由于我们的表决磁盘是正常状态,因此不做恢复演示

(4)通过strings命令查看votedisk内容

[root@rac1 oracle]# strings voting_disk.bak |sort -u

fSLC

ssLckcoT

SslcLlik

sSlcrEp0

}|{z

五、用srvctl分别启动ASM,数据库实例和数据库

srvctl是应用层命令,称作“服务管理工具”可以操作database;instance;listener;nodes;ASM;service;application

,其中application又包括“GSD ONS VIP”,这些资源都可以通过srvctl工具统一管理。

演示

(1)关闭节点1的RAC实例

RACDB1@rac1 /home/oracle$ srvctl stop instance -d racdb -i racdb1 -o immediate

RACDB1@rac1 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application OFFLINE OFFLINE

ora....B2.inst application ONLINE ONLINE rac2

ora....DB1.srv application ONLINE ONLINE rac2

ora.....TAF.cs application ONLINE ONLINE rac2

ora.RACDB.db 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

节点2还是可以正常登陆数据库

RACDB2@rac2 /home/oracle$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 4 19:39:02 2013

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL>

(2)关闭节点2的RAC实例,当srvctl监测到RAC集群的所有实例都关闭后会自动关闭数据库

RACDB2@rac2 /home/oracle$ srvctl stop instance -d racdb -i racdb2 -o immediate

RACDB2@rac2 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application OFFLINE OFFLINE

ora....B2.inst application OFFLINE OFFLINE

ora....DB1.srv application OFFLINE OFFLINE

ora.....TAF.cs application OFFLINE OFFLINE

ora.RACDB.db application OFFLINE 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

但ASM实例还在启动状态,监听lsnr也在启动状态,application进程也在启动状态

RACDB2@rac2 /home/oracle$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 4 19:45:15 2013

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

Connected to an idle instance.

SQL>

此时已经不能连接到数据库了

(3)当我们忘了命令语法的时候,直接srvctl就可以查看帮助信息了

RACDB1@rac1 /home/oracle$ srvctl stop asm

PRKO-2001 : Invalid command line syntax

RACDB1@rac1 /home/oracle$ srvctl

Usage: srvctl <command> <object> [<options>]

command: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config

objects: database|instance|service|nodeapps|asm|listener

For detailed help on each command and object and its options use:

srvctl <command> <object> -h

可以使用-h选项打开帮助信息

RACDB1@rac1 /home/oracle$ srvctl start asm -h

Usage: srvctl start asm -n <node_name> [-i <asm_inst_name>] [-o <start_options>] [-c <connect_str> | -q]

-n <node> Node name

-i <asm_inst_name> ASM instance name

-o <start_options> Options to startup command (e.g. open, mount, or nomount)

-c <connstr> Connect string (default: / as sysdba)

-q Query connect string from standard input

-h Print usage

先关闭节点2的ASM实例

RACDB2@rac2 /home/oracle$ srvctl stop asm -n rac2

RACDB2@rac2 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application OFFLINE OFFLINE

ora....B2.inst application OFFLINE OFFLINE

ora....DB1.srv application OFFLINE OFFLINE

ora.....TAF.cs application OFFLINE OFFLINE

ora.RACDB.db application OFFLINE OFFLINE

ora....SM1.asm application ONLINE ONLINE rac1节点1的ASM实例还在启动

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 OFFLINE OFFLINE节点2的ASM实例已经关闭

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

再关闭节点1的ASM实例

RACDB1@rac1 /home/oracle$ srvctl stop asm -n rac1

RACDB1@rac1 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application OFFLINE OFFLINE

ora....B2.inst application OFFLINE OFFLINE

ora....DB1.srv application OFFLINE OFFLINE

ora.....TAF.cs application OFFLINE OFFLINE

ora.RACDB.db application OFFLINE OFFLINE

ora....SM1.asm application OFFLINE OFFLINE

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 OFFLINE OFFLINE

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

我们在把ASM数据库
实例启动起来,操作的顺序是相反的

(4)先启动ASM

在节点1和节点2分别启动ASM

RACDB1@rac1 /home/oracle$ srvctl start asm -n rac1

RACDB2@rac2 /home/oracle$ srvctl start asm -n rac2

RACDB2@rac2 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application OFFLINE OFFLINE

ora....B2.inst application OFFLINE OFFLINE

ora....DB1.srv application OFFLINE OFFLINE

ora.....TAF.cs application OFFLINE OFFLINE

ora.RACDB.db application OFFLINE 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

(5)再启动数据库和实例

RACDB1@rac1 /home/oracle$ srvctl start database -d racdb

RACDB1@rac1 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application ONLINE ONLINE rac1

ora....B2.inst application ONLINE ONLINE rac2

ora....DB1.srv application OFFLINE OFFLINE注意这里service没有启动

ora.....TAF.cs application OFFLINE OFFLINE

ora.RACDB.db 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

(6)再启动服务service

RACDB1@rac1 /home/oracle$ srvctl start service -d racdb

RACDB1@rac1 /home/oracle$ crs_stat -t

Name Type Target State Host

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

ora....B1.inst application ONLINE ONLINE rac1

ora....B2.inst application ONLINE ONLINE rac2

ora....DB1.srv application ONLINE ONLINE rac1

ora.....TAF.cs application ONLINE ONLINE rac1

ora.RACDB.db 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

六、分别查看RAC的参数文件,REDO日志,UNDO表空间,TEMP表空间的信息,说明一下在RAC环境下每个实例是否拥有专属自己的上述对象

RAC环境下数据库参数文件的位置

(1)放在各自实例的本地

(2)放在共享存储上,建议使用这种

我们既可以让两个实例使用共享存储上的参数文件

SQL> show parameter spfile;

NAME TYPE VALUE

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

spfile string+DATA/racdb/spfileracdb.ora
共享ASM磁盘上的参数文件

也可以让两个实例使用各自本地的参数文件

[oracle@rac1 dbs]$ ll

total 52

-rw-rw---- 1 oracle oinstall 1506 Jul 8 12:37 ab_+ASM1.dat

-rw-rw---- 1 oracle oinstall 1544 Jan 1 2012 hc_+ASM1.dat

-rw-rw---- 1 oracle oinstall 1544 Jan 1 2012 hc_RACDB1.dat

lrwxrwxrwx 1 oracle oinstall 41 Jan 1 2012 init+ASM1.ora -> /u01/app/oracle/admin/+ASM/pfile/init.ora

-rw-r----- 1 oracle oinstall 12920 May 3 2001 initdw.ora

-rw-r----- 1 oracle oinstall 8385 Sep 11 1998 init.ora

-rw-r----- 1 oracle oinstall 37 Jan 1 2012 initRACDB1.ora各自本地的参数文件

如果想使用共享存储上的参数文件,需要在本地参数文件中指定其路径(添加一条spfile重定向),如果不想使用,则无需添加,只在本地参数文件中定义各自实例参数即可。

[oracle@rac1 dbs]$ cat initRACDB1.ora

SPFILE='+DATA/RACDB/spfileRACDB.ora'

SQL> select instance_name,host_name,status from gv$instance order by 1;

INSTANCE_NAME HOST_N STATUS

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

RACDB1 rac1 OPEN

RACDB2 rac2 OPEN

gv$instance:global动态性能视图,这是在RAC模式下特有的动态性能视图,可以显示所有实例的属性信息。

每个实例都有各自的undo表空间

RAC模式下防止2个实例争用undo回滚段的考虑,每个实例的事务都放在各自的undo表空间上。如果一个实例shutdown,另外的实例可以访问这个实例的undo回滚段。

SQL> select inst_id,name,value from gv$parameter where name='undo_tablespace' order by 1;

INST_ID NAME VALUE

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

1 undo_tablespace UNDOTBS1

2 undo_tablespace UNDOTBS2

两个节点的RAC每个节点都有自己的undo表空间

每个实例都有各自的redo日志

RAC模式下每个实例自己管理自己的redo日志,防止争用。如果有一个实例shutdown,另外的实例可以访问这个实例的redo日志用来实例恢复。

SQL> select thread#,group#,