基本测试与使用
检查 RAC 状态
$ srvctl config database -d rac
Database unique name: rac
Database name: rac
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: /u01/oradata/rac/spfilerac.ora
Domain: localdomain
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: rac
Database instances: rac1,rac2
Disk Groups:
Services:
Database is administrator managed
$
$ srvctl status database -d rac
Instance rac1 is running on node rac1
Instance rac2 is running on node rac2
$
V$ACTIVE_INSTANCES视图还可以显示当前状态的实例。
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Sep 26 19:04:19 2009
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> SELECT inst_name FROM v$active_instances;
INST_NAME
--------------------------------------------------------------------------------
rac1.localdomain:rac1
rac2.localdomain:rac2
SQL>
检查创建的数据库
srvctl 工具可以显示当前的 RAC 数据库配置和状态。
显示 AKA 群集数据库的配置信息:
oracle@RAC1> srvctl config database -d AKA
所有实例和服务的状态:
oracle@RAC1> srvctl status database -d AKA
某个特定节点上应用程序状态:
oracle@RAC1> srvctl status nodeapps -n gentic
显示节点应用程序配置信息(VIP,GSD,ONS,监听器)
oracle@RAC1> srvctl config nodeapps -n gentic -a -g -s -l
VIP exists.: /gentic-vip/192.168.138.130/255.255.255.0/eth0
GSD exists.
ONS daemon exists.
Listener exists.
群集中运行的所有实例:
sqlplus system/manager@AKA1
SELECT inst_id,
instance_number,
instance_name,
parallel,
status,
database_status,
active_state,
host_name host
FROM gv$instance
ORDER BY inst_id;
视图 V$ACTIVE_INSTANCES 也可以显示当前实例的状态:
SELECT * FROM v$active_instances;
最后,GV$ 允许你显示整个 RAC 的全局信息:
SELECT inst_id, username, sid, serial#
FROM gv$session
WHERE username IS NOT NULL;
启动企业管理器控制台
企业管理控制台是整个群集共享的,在我们的例子中它在 https://rac1:1158/em
上监听。