Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2881060
  • 博文数量: 599
  • 博客积分: 16398
  • 博客等级: 上将
  • 技术积分: 6875
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-30 12:04
个人简介

WINDOWS下的程序员出身,偶尔也写一些linux平台下小程序, 后转行数据库行业,专注于ORACLE和DB2的运维和优化。 同时也是ios移动开发者。欢迎志同道合的朋友一起研究技术。 数据库技术交流群:58308065,23618606

文章分类

全部博文(599)

文章存档

2014年(12)

2013年(56)

2012年(199)

2011年(105)

2010年(128)

2009年(99)

分类: Oracle

2009-12-07 22:11:40

9. 探索 RAC 数据库环境

现在,您已经成功安装了虚拟双节点 RAC 数据库,下面我们来探究一下您刚刚配置的环境。

检查应用程序资源的状态。
rac1-> crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.devdb.db   application    ONLINE    ONLINE    rac1
ora....b1.inst application    ONLINE    ONLINE    rac1
ora....b2.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

rac1-> srvctl status nodeapps -n rac1
VIP is running on node: rac1
GSD is running on node: rac1
Listener is running on node: rac1
ONS daemon is running on node: rac1
	
rac1-> srvctl status nodeapps -n rac2
VIP is running on node: rac2
GSD is running on node: rac2
Listener is running on node: rac2
ONS daemon is running on node: rac2

rac1-> srvctl status asm -n rac1
ASM instance +ASM1 is running on node rac1.

rac1-> srvctl status asm -n rac2
ASM instance +ASM2 is running on node rac2.	

rac1-> srvctl status database -d devdb
Instance devdb1 is running on node rac1
Instance devdb2 is running on node rac2

rac1-> srvctl status service -d devdb
rac1->
检查 Oracle 集群件的状态。
rac1-> crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

rac2-> crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

在命令行执行 crsctl 以查看所有可用选项。

列出 RAC 实例。
SQL> select
  2  instance_name,
  3  host_name,
  4  archiver,
  5  thread#,
  6  status
  7  from gv$instance;

INSTANCE_NAME  HOST_NAME             ARCHIVE  THREAD# STATUS
-------------- --------------------- ------- -------- ------
devdb1         rac1.mycorpdomain.com STARTED        1 OPEN
devdb2         rac2.mycorpdomain.com STARTED        2 OPEN
检查连接。

验证您能够连接到每个节点上的实例和服务。

sqlplus system@devdb1
sqlplus system@devdb2
sqlplus system@devdb
检查数据库配置。
rac1-> export ORACLE_SID=devdb1
rac1-> sqlplus / as sysdba

SQL> show sga

Total System Global Area  209715200 bytes
Fixed Size                  1218556 bytes
Variable Size             104859652 bytes
Database Buffers          100663296 bytes
Redo Buffers                2973696 bytes


SQL> select file_name,bytes/1024/1024 from dba_data_files;

FILE_NAME                                   BYTES/1024/1024
------------------------------------------- ---------------
+DG1/devdb/datafile/users.259.606468449                   5
+DG1/devdb/datafile/sysaux.257.606468447                240
+DG1/devdb/datafile/undotbs1.258.606468449               30
+DG1/devdb/datafile/system.256.606468445                480
+DG1/devdb/datafile/undotbs2.264.606468677               25
	

	SQL> select
  	  2  group#,
  	  3  type,
  	  4  member,
  	  5  is_recovery_dest_file
  	  6  from v$logfile
  	  7  order by group#;

GROUP# TYPE    MEMBER                                              IS_
------ ------- --------------------------------------------------- ---
     1 ONLINE  +RECOVERYDEST/devdb/onlinelog/group_1.257.606468581 YES
     1 ONLINE  +DG1/devdb/onlinelog/group_1.261.606468575          NO
     2 ONLINE  +RECOVERYDEST/devdb/onlinelog/group_2.258.606468589 YES
     2 ONLINE  +DG1/devdb/onlinelog/group_2.262.606468583          NO
     3 ONLINE  +DG1/devdb/onlinelog/group_3.265.606468865          NO
     3 ONLINE  +RECOVERYDEST/devdb/onlinelog/group_3.259.606468875 YES
     4 ONLINE  +DG1/devdb/onlinelog/group_4.266.606468879          NO
     4 ONLINE  +RECOVERYDEST/devdb/onlinelog/group_4.260.606468887 YES


rac1-> export ORACLE_SID=+ASM1
rac1-> sqlplus / as sysdba

SQL> show sga

Total System Global Area   92274688 bytes
Fixed Size                  1217884 bytes
Variable Size              65890980 bytes
ASM Cache                  25165824 bytes


SQL> show parameter asm_disk

NAME                           TYPE        VALUE
------------------------------ ----------- ------------------------
asm_diskgroups                 string      DG1, RECOVERYDEST
asm_diskstring                 string


SQL> select
  2  group_number,
  3  name,
  4  allocation_unit_size alloc_unit_size,
  5  state,
  6  type,
  7  total_mb,
  8  usable_file_mb
  9  from v$asm_diskgroup;

                       ALLOC                        USABLE
 GROUP                  UNIT                 TOTAL    FILE
NUMBER NAME             SIZE STATE   TYPE       MB      MB
------ ------------ -------- ------- ------ ------ -------
     1 DG1           1048576 MOUNTED NORMAL   6134    1868
     2 RECOVERYDEST  1048576 MOUNTED EXTERN   2047    1713


SQL> select
  2  name,
  3  path,
  4  header_status,
  5  total_mb free_mb,
  6  trunc(bytes_read/1024/1024) read_mb,
  7  trunc(bytes_written/1024/1024) write_mb
  8  from v$asm_disk;

NAME  PATH       HEADER_STATU    FREE_MB    READ_MB   WRITE_MB
----- ---------- ------------ ---------- ---------- ----------
VOL1  ORCL:VOL1  MEMBER             3067        229       1242
VOL2  ORCL:VOL2  MEMBER             3067        164       1242
VOL3  ORCL:VOL3  MEMBER             2047         11        354
创建表空间。
SQL> connect system/oracle@devdb
Connected.
SQL> create tablespace test_d datafile '+DG1' size 10M;

Tablespace created.

SQL> select
  2  file_name,
  3  tablespace_name,
  4  bytes
  5  from dba_data_files
  6  where tablespace_name='TEST_D';

FILE_NAME                                TABLESPACE_NAME      BYTES
---------------------------------------- --------------- ----------
+DG1/devdb/datafile/test_d.269.606473423 TEST_D            10485760
创建在线重做日志文件组。
SQL> connect system/oracle@devdb
Connected.
SQL> alter database add logfile thread 1 group 5 size 50M;

Database altered.

SQL> alter database add logfile thread 2 group 6 size 50M;

Database altered.

SQL> select
  2  group#,
  3  thread#,
  4  bytes,
  5  members,
  6  status
  7  from v$log;

    GROUP#    THREAD#      BYTES    MEMBERS STATUS
---------- ---------- ---------- ---------- ----------------
         1          1   52428800          2 CURRENT
         2          1   52428800          2 INACTIVE
         3          2   52428800          2 ACTIVE
         4          2   52428800          2 CURRENT
         5          1   52428800          2 UNUSED
         6          2   52428800          2 UNUSED

SQL> select
  	  2  group#,
  	  3  type,
  	  4  member,
  	  5  is_recovery_dest_file
  	  6  from v$logfile
	  7  where group# in (5,6)
  	  8  order by group#;

GROUP# TYPE    MEMBER                                               IS_
------ ------- ---------------------------------------------------- ---
     5 ONLINE  +DG1/devdb/onlinelog/group_5.271.606473683           NO
     5 ONLINE  +RECOVERYDEST/devdb/onlinelog/group_5.261.606473691  YES
     6 ONLINE  +DG1/devdb/onlinelog/group_6.272.606473697           NO
     6 ONLINE  +RECOVERYDEST/devdb/onlinelog/group_6.262.606473703  YES
检查闪回恢复区空间使用率。
SQL> select * from v$recovery_file_dest;

NAME          SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
------------- ----------- ---------- ----------------- ---------------
+RECOVERYDEST  1572864000  331366400                 0               7


SQL> select * from v$flash_recovery_area_usage;

FILE_TYPE    PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE                 .97                         0               1
ONLINELOG                    20                         0               6
ARCHIVELOG                    0                         0               0
BACKUPPIECE                   0                         0               0
IMAGECOPY                     0                         0               0
FLASHBACKLOG                  0                         0               0
启动和停止应用程序资源。

遵循以下步骤启动和停止单独的应用程序资源。

srvctl start nodeapps -n  
srvctl start nodeapps -n  
srvctl start asm -n  
srvctl start asm -n  
srvctl start database -d  
srvctl start service -d  -s  
crs_stat -t

srvctl stop service -d  -s  
srvctl stop database -d  
srvctl stop asm -n  
srvctl stop asm -n  
srvctl stop nodeapps -n  
srvctl stop nodeapps -n  
crs_stat -t 
阅读(1393) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~