当前位置导航:炫浪网>>网络学院>>编程开发>>Oracle教程

Oracle rac failover test

oracle@orac-b:~> sqlplus system/holeinone@rac

SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 12 20:08:00 2009

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select instance_name from gv$instance;

INSTANCE_NAME
----------------
rac1
rac2

SQL> @checkracstat.sql;

INSTANCE_NAME HOST_NAME FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
------------- --------- ------------- --------------- -----------
rac1          orac-a
                        NONE          NONE            NO

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
oracle@orac-b:~> srvctl status database -d rac
Instance rac1 is running on node orac-a
Instance rac2 is running on node orac-b
oracle@orac-b:~> srvctl stop instance -d rac -i rac1 -o abort
oracle@orac-b:~> srvctl status database -d rac
Instance rac1 is not running on node orac-a
Instance rac2 is running on node orac-b
oracle@orac-b:~> sqlplus system/holeinone@rac

SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 12 20:10:16 2009

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select instance_name from gv$instance;

SQL> @checkracstat.sql;

INSTANCE_NAME HOST_NAME FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
------------- --------- ------------- --------------- -----------
rac2          orac-b
                        NONE          NONE            NO

SQL>



checkracstat.sql


# more checkracstat.sql
COL instance_name FORMAT a13;
COL host_name FORMAT a9;
COL failover_method FORMAT a15;
COL failed_over FORMAT a11;
SELECT instance_name,host_name,
NULL AS failover_type,NULL AS failover_method,
NULL AS failed_over
FROM v$instance
UNION
SELECT NULL,NULL,failover_type,failover_method,failed_over
FROM v$session
WHERE username = 'SYSTEM';
相关内容
赞助商链接