2008-02-12

Database Cluster information

Script to get the database cluster information:

SET SERVEROUTPUT ON

BEGIN
IF DBMS_UTILITY.is_cluster_database
THEN
DBMS_OUTPUT.put_line ('Clustered');
DBMS_OUTPUT.put_line ( 'Connect to instance:'
|| DBMS_UTILITY.current_instance
);

<<instances>>
DECLARE
ltab_instance_table DBMS_UTILITY.instance_table;
li_instance_count PLS_INTEGER;
BEGIN
DBMS_UTILITY.active_instances
(instance_table => ltab_instance_table
,instance_count => li_instance_count
);

FOR i IN 1 .. li_instance_count
LOOP
DBMS_OUTPUT.put_line ( ltab_instance_table (i).inst_number
|| ' = '
|| ltab_instance_table (i).inst_name
);
END LOOP;
END INSTANCES;
ELSE
DBMS_OUTPUT.put_line ('Not Clustered');
END IF;
END;


Output example:

Clustered
Connect to instance:1
1 = orainst1:ORA1
2 = orainst2:ORA2
3 = orainst3:ORA3

No comments:

Post a Comment

Os comentários são moderados.
The comments are moderated.