<!-- $Id: P405DG_gen.xml,v 1.7 2007/11/14 16:05:25 mschenke Exp $ -->
<!-- ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/hcve/P405DG_gen.xml,v 1.7 2007/11/14 16:05:25 mschenke Exp $ -->
<hcve name="Data Guard PostInstall (Generic)" type="P" product="DataGuard" platform="generic">
<rule id="1" mode="RECORD" name="sysdate" repeat="1" command_type="OS">
<command><![CDATA[date]]></command>
<description><![CDATA[This rule records sysdate gathered from the Operating System (OS).]]></description>
</rule>
<rule id="2" mode="RECORD" name="db_type_check" repeat="1" command_type="SQL">
<command><![CDATA[select database_role from v$database;]]></command>
<description><![CDATA[This rule obtains the database type.]]></description>
</rule>
<rule condition="==" id="3" minimum="ARCHIVELOG" mode="VERIFY" name="archive_log_check" repeat="1" command_type="SQL">
<command><![CDATA[select log_mode from v$database;]]></command>
<description><![CDATA[This rule verifies that the primary database is in the archive log mode.]]></description>
<action type="negative"><![CDATA[The primary database is not in archive log mode. When you use Data Guard, the primary database must be in archive log mode. For information about enabling archive log mode, see Oracle MetaLink Note: 69739.1.]]></action>
<action type="positive"><![CDATA[The primary database is in archive log mode.]]></action>
</rule>
<rule condition="==" id="4" minimum="TRUE" mode="VERIFY" name="auto_archive_check" repeat="1" command_type="SQL">
<command><![CDATA[select value from v$parameter where name='log_archive_start';]]></command>
<description><![CDATA[This rule verifies that automatic archiving is turned on.]]></description>
<action type="negative"><![CDATA[The primary database is in archive log mode but is not set up to archive automatically. When you use Data Guard, the primary database must have auto archiving enabled. For information about enabling automatic archiving, see Oracle MetaLink Note: 69739.1.]]></action>
<action type="positive"><![CDATA[The primary database is in archive log mode and is set up to archive automatically.]]></action>
</rule>
<rule id="5" mode="RECORD" name="prmy_local_dest" repeat="1" command_type="SQL">
<command><![CDATA[select destination from v$archive_dest where schedule='ACTIVE' and target='PRIMARY';]]></command>
<description><![CDATA[This rule gets the primary local destination.]]></description>
</rule>
<rule condition="&gt;" id="6" minimum="10000" mode="VERIFY" name="prmy_local_space" repeat="1" command_type="OS">
<command><![CDATA[df -k %5% | tail -1 |awk '{print $4}']]></command>
<description><![CDATA[The rule verifies if there is space to archive locally on the primary database.]]></description>
<action type="negative"><![CDATA[The primary local archive destination has reached or is close to reaching a disk full condition. Free additional space to avoid local archiving issues.]]></action>
<action type="positive"><![CDATA[Sufficient disk space exists to archive locally on the primary database.]]></action>
</rule>
<rule condition="&gt;" id="7" minimum="0" mode="VERIFY" name="verify_remote_dests" repeat="1" command_type="SQL">
<command><![CDATA[select count(*) from v$archive_dest
where target='STANDBY';]]></command>
<description><![CDATA[This rule ensures that we have at least one destination set for standby.]]></description>
<action type="negative"><![CDATA[This primary database is not configured to remotely archive to a standby database. For information about configuring remote archiving, see Oracle MetaLink Note: 150330.1.]]></action>
<action type="positive"><![CDATA[Remote archiving to a standby database is set up on this primary database.]]></action>
</rule>
<rule id="8" mode="RECORD" name="get_dest_id" repeat="1" command_type="SQL">
<command><![CDATA[select dest_id from v$archive_dest
where target='STANDBY';]]></command>
<description><![CDATA[This rule gets the dest_id for the remote destination.]]></description>
</rule>
<rule id="9" mode="RECORD" name="service_name" repeat="1" command_type="SQL">
<command><![CDATA[select destination from v$archive_dest_status
where dest_id='%8%';]]></command>
<description><![CDATA[This rule gets the service name used for the remote destination.]]></description>
</rule>
<rule condition="==" id="10" minimum="OK" mode="VERIFY" name="tnsping_service" repeat="1" command_type="OS">
<command><![CDATA[tnsping %9% |tail -1 |awk '{print $1}']]></command>
<description><![CDATA[The rule verifies the TNSPING remote alias.]]></description>
<action type="negative"><![CDATA[The TNSPING utility did not complete correctly using the service identified in the remote archive destination. For additional information, see the error listed in the value section for the rule.]]></action>
<action type="positive"><![CDATA[The TNSPING utility completed correctly using the service identified in the remote archive destination.]]></action>
</rule>
<rule condition="==" id="11" minimum="NONE" mode="VERIFY" name="remote_dest_error" repeat="1" command_type="SQL">
<command><![CDATA[set serveroutput on
declare
	error_num	varchar2(256);
	c_status	varchar2(9);
	return_value	varchar2(256);
begin
	select status,error
	into c_status, error_num from v$archive_dest where dest_id = '%8%';
	if c_status='VALID' then return_value := 'NONE';
	else return_value := error_num;
	end if;
       dbms_output.put_line(return_value);
exception
   when OTHERS then
       dbms_output.put_line('No Standby Dest');
end;
/]]></command>
<description><![CDATA[This rule checks if the last switch generated an error for the remote destination.]]></description>
<action type="negative"><![CDATA[An error occured during the last remote archive operation. For additional information, refer to the rules results section above.]]></action>
<action type="positive"><![CDATA[The last archive was sent to the remote destination without an error.]]></action>
</rule>
<rule id="12" mode="RECORD" name="archive_process" repeat="1" command_type="SQL">
<command><![CDATA[select archiver from v$archive_dest
where dest_id='%8%';]]></command>
<description><![CDATA[The rule checks which process is performing the remote archive.]]></description>
</rule>
