Oracle RAC系列之:日常监控与管理

RAC日常监控 1. 检查RAC运行状况

Crs_stat –t
[grid@erp1oel ~]$ crs_stat -t

Name Type Target State Host

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

ora.DATA.dg ora....up.type ONLINE ONLINE erp1oel

ora.FRA.dg ora....up.type ONLINE ONLINE erp1oel

ora....ER.lsnr ora....er.type ONLINE ONLINE erp1oel

ora....N1.lsnr ora....er.type ONLINE ONLINE erp1oel

ora.OCR.dg ora....up.type ONLINE ONLINE erp1oel

ora.asm ora.asm.type ONLINE ONLINE erp1oel

ora.center.db ora....se.type ONLINE ONLINE erp1oel

ora.cvu ora.cvu.type ONLINE ONLINE erp1oel

ora....SM1.asm application ONLINE ONLINE erp1oel

ora....EL.lsnr application ONLINE ONLINE erp1oel

ora....oel.gsd application OFFLINE OFFLINE

ora....oel.ons application ONLINE ONLINE erp1oel

ora....oel.vip ora....t1.type ONLINE ONLINE erp1oel

ora....SM2.asm application ONLINE ONLINE erp2oel

ora....EL.lsnr application ONLINE ONLINE erp2oel

ora....oel.gsd application OFFLINE OFFLINE

ora....oel.ons application ONLINE ONLINE erp2oel

ora....oel.vip ora....t1.type ONLINE ONLINE erp2oel

ora.gsd ora.gsd.type OFFLINE OFFLINE

ora....network ora....rk.type ONLINE ONLINE erp1oel

ora.oc4j ora.oc4j.type ONLINE ONLINE erp1oel

ora.ons ora.ons.type ONLINE ONLINE erp1oel

ora....ry.acfs ora....fs.type ONLINE ONLINE erp1oel

ora.scan1.vip ora....ip.type ONLINE ONLINE erp1oel

2. 检查cluster运行情况

[grid@erp1oel ~]$ crsctl check cluster

CRS-4537: Cluster Ready Services is online

CRS-4529: Cluster Synchronization Services is online

CRS-4533: Event Manager is online

3. 检查DB运行情况

srvctl status database -d center
[grid@erp1oel ~]$ srvctl status database -d center

Instance center1 is running on node erp1oel

Instance center2 is running on node erp2oel
[grid@erp1oel ~]$ srvctl config database -d center -a

Database unique name: center

Database name: center

Oracle home: /u01/app/oracle/product/11.2.0/db_1

Oracle user: oracle

Spfile: +DATA/center/spfilecenter.ora

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Server pools: center

Database instances: center1,center2

Disk Groups: DATA,FRA

Mount point paths:

Services:

Type: RAC

Database is enabled

Database is administrator managed

4. 检查节点应用状态及配置

[grid@erp1oel ~]$ srvctl status nodeapps

VIP erp1-vip is enabled

VIP erp1-vip is running on node: erp1oel

VIP erp2-vip is enabled

VIP erp2-vip is running on node: erp1oel

Network is enabled

Network is running on node: erp1oel

Network is running on node: erp2oel

GSD is disabled

GSD is not running on node: erp1oel

GSD is not running on node: erp2oel

ONS is enabled

ONS daemon is running on node: erp1oel

ONS daemon is running on node: erp2oel
[grid@erp1oel ~]$ srvctl config nodeapps -a -g -s -l

Warning:-l option has been deprecated and will be ignored.

Network exists: 1/192.168.9.0/255.255.255.0/eth0, type static

VIP exists: /erp1-vip/192.168.9.237/192.168.9.0/255.255.255.0/eth0, hosting node erp1oel

VIP exists: /erp2-vip/192.168.9.238/192.168.9.0/255.255.255.0/eth0, hosting node erp2oel

GSD exists

ONS exists: Local port 6100, remote port 6200, EM port 2016

Name: LISTENER

Network: 1, Owner: grid

Home: <CRS home>

/u01/app/11.2.0/grid on node(s) erp2oel,erp1oel

End points: TCP:1521

5. 查看ASM状态

[grid@erp1oel ~]$ srvctl status asm

ASM is running on erp1oel,erp2oel

[grid@erp1oel ~]$ srvctl config asm -a

ASM home: /u01/app/11.2.0/grid

ASM listener: LISTENER

ASM is enabled.

6. 检查TNS状态(切换oracle用户)

[oracle@erp1oel ~]$ srvctl status listener

Listener LISTENER is enabled

Listener LISTENER is running on node(s): erp1oel

7. 检查scan的状态

[oracle@erp1oel ~]$ srvctl status scan

SCAN VIP scan1 is enabled

SCAN VIP scan1 is running on node erp2oel
[oracle@erp1oel ~]$ srvctl config scan

SCAN name: erp-scan, Network: 1/192.168.9.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /erp-scan/192.168.9.239

8. RAC的启动和关闭

切换到root用户下

关闭:

crsctl stop cluster 停止本节点集群服务

crsctl stop cluster –all 停止所有节点服务

开启:

crsctl start cluster 开启本节点集群服务

crsctl start cluster –all 开启所有节点服务

RAC环境下表空间与数据文件测试

1. 查询表空间与对应数据文件位置

SQL&gt; select file_name,tablespace_name,bytes/1024/1024 m from dba_data_files;

FILE_NAME TABLESPACE_NAME M

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

+DATA/center/datafile/users.25 USERS 5

9.787122435

+DATA/center/datafile/undotbs1 UNDOTBS1 60

.258.787122433

+DATA/center/datafile/sysaux.2 SYSAUX 580

57.787122433

+DATA/center/datafile/system.2 SYSTEM 720

56.787122431

FILE_NAME TABLESPACE_NAME M

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

+DATA/center/datafile/example. EXAMPLE 345.625

264.787122665

+DATA/center/datafile/undotbs2 UNDOTBS2 25

.265.787123201

+DATA/center/datafile/center.2 CENTER 100

69.787188065

7 rows selected.

可以看到数据文件默认都在指定目录(+DATA/center/datafile)下

2. 创建表空间

create tablespace branch datafile '+DATA/center/datafile/branch.dbf' size 10m ;
或直接
create tablespace branch
SQL&gt; create tablespace branch;

Tablespace created.

在rac环境中可使用create tablespace tablespacename方式直接创建表空间与相应数据文件,与单实例环境中使用OMF方式类似,如在创建表空间时,未指定数据文件与其大小,默认创建数据文件大小为100m。

3. 添加数据文件

SQL&gt; alter tablespace branch add datafile;

Tablespace altered.
SQL&gt; alter tablespace branch add datafile '+DATA/center/datafile/branch.dbf1' size 10m;

Tablespace altered.

4. 删除数据文件

SQL&gt; alter tablespace branch drop datafile '+DATA/center/datafile/branch.dbf1';

Tablespace altered.

5. 删除表空间

SQL&gt; drop tablespace branch including contents and datafiles;

Tablespace dropped.

SQL&gt; drop tablespace center;

Tablespace dropped.

可以看到在单实例环境中如使用drop tablespace tablespacename 不会删除对应数据文件,但在rac环境中会自动将对应数据文件清除.

你可能感兴趣的:(RAC)