<sdp_diaglet product="DataGuard" set="P405DG_gen" title="Data Guard PostInstall (Generic)" type="P">
<sdp_meta id="$Id: P405DG_gen.xml,v 1.9 2009/01/07 10:06:35 mschenke Exp $" type="version"/>
<sdp_meta author="SDP" change="Initial diaglet conversion" type="history"/>
<sdp_content set="P405DG_gen" title="Data Guard PostInstall (Generic)" type="check">
<sdp_group>
<sdp_rule id="P00001" mode="RECORD" name="sysdate">
<sdp_command type="OS"><![CDATA[date]]></sdp_command>
<sdp_description><![CDATA[This rule records sysdate gathered from the Operating System (OS).]]></sdp_description>
</sdp_rule>
<sdp_rule id="P00002" mode="RECORD" name="db_type_check">
<sdp_command type="SQL"><![CDATA[select database_role from v$database;]]></sdp_command>
<sdp_description><![CDATA[This rule obtains the database type.]]></sdp_description>
</sdp_rule>
<sdp_rule id="P00003" mode="VERIFY" name="archive_log_check">
<sdp_command type="SQL"><![CDATA[select log_mode from v$database;]]></sdp_command>
<sdp_description><![CDATA[This rule verifies that the primary database is in the archive log mode.]]></sdp_description>
<sdp_actions>
<sdp_action condition="==" minimum="ARCHIVELOG" result="PASSED"><![CDATA[The primary database is in archive log mode.]]></sdp_action>
<sdp_action result="FAILED"><![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 Knowledge Article: 69739.1.]]></sdp_action>
</sdp_actions>
</sdp_rule>
<sdp_rule id="P00004" mode="VERIFY" name="auto_archive_check">
<sdp_command type="SQL"><![CDATA[select value from v$parameter where name='log_archive_start';]]></sdp_command>
<sdp_description><![CDATA[This rule verifies that automatic archiving is turned on.]]></sdp_description>
<sdp_actions>
<sdp_action condition="==" minimum="TRUE" result="PASSED"><![CDATA[The primary database is in archive log mode and is set up to archive automatically.]]></sdp_action>
<sdp_action result="FAILED"><![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 Knowledge Article: 69739.1.]]></sdp_action>
</sdp_actions>
</sdp_rule>
<sdp_rule id="P00005" mode="RECORD" name="prmy_local_dest">
<sdp_command type="SQL"><![CDATA[select destination from v$archive_dest where schedule='ACTIVE' and target='PRIMARY';]]></sdp_command>
<sdp_description><![CDATA[This rule gets the primary local destination.]]></sdp_description>
</sdp_rule>
<sdp_rule id="P00006" mode="VERIFY" name="prmy_local_space">
<sdp_dependencies>
<sdp_dependency condition="IS" id="P00005" minimum="PASSED|RECORD" result="FAILED"><![CDATA[Requires rule 5.]]></sdp_dependency>
</sdp_dependencies>
<sdp_command type="OS"><![CDATA[df -k %P00005% | tail -1 |awk '{print $4}']]></sdp_command>
<sdp_description><![CDATA[The rule verifies if there is space to archive locally on the primary database.]]></sdp_description>
<sdp_actions>
<sdp_action condition=">" minimum="10000" result="PASSED"><![CDATA[Sufficient disk space exists to archive locally on the primary database.]]></sdp_action>
<sdp_action result="FAILED"><![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.]]></sdp_action>
</sdp_actions>
</sdp_rule>
<sdp_rule id="P00007" mode="VERIFY" name="verify_remote_dests">
<sdp_command type="SQL"><![CDATA[select count(*) from v$archive_dest
where target='STANDBY';]]></sdp_command>
<sdp_description><![CDATA[This rule ensures that we have at least one destination set for standby.]]></sdp_description>
<sdp_actions>
<sdp_action condition=">" minimum="0" result="PASSED"><![CDATA[Remote archiving to a standby database is set up on this primary database.]]></sdp_action>
<sdp_action result="FAILED"><![CDATA[This primary database is not configured to remotely archive to a standby database. For information about configuring remote archiving, see Knowledge Article: 150330.1.]]></sdp_action>
</sdp_actions>
</sdp_rule>
<sdp_rule id="P00008" mode="RECORD" name="get_dest_id">
<sdp_command type="SQL"><![CDATA[select dest_id from v$archive_dest
where target='STANDBY';]]></sdp_command>
<sdp_description><![CDATA[This rule gets the dest_id for the remote destination.]]></sdp_description>
</sdp_rule>
<sdp_rule id="P00009" mode="RECORD" name="service_name">
<sdp_dependencies>
<sdp_dependency condition="IS" id="P00008" minimum="PASSED|RECORD" result="FAILED"><![CDATA[Requires rule 8.]]></sdp_dependency>
</sdp_dependencies>
<sdp_command type="SQL"><![CDATA[select destination from v$archive_dest_status
where dest_id='%P00008%';]]></sdp_command>
<sdp_description><![CDATA[This rule gets the service name used for the remote destination.]]></sdp_description>
</sdp_rule>
<sdp_rule id="P00010" mode="VERIFY" name="tnsping_service">
<sdp_dependencies>
<sdp_dependency condition="IS" id="P00009" minimum="PASSED|RECORD" result="FAILED"><![CDATA[Requires rule 9.]]></sdp_dependency>
</sdp_dependencies>
<sdp_command type="OS"><![CDATA[tnsping %P00009% |tail -1 |awk '{print $1}']]></sdp_command>
<sdp_description><![CDATA[The rule verifies the TNSPING remote alias.]]></sdp_description>
<sdp_actions>
<sdp_action condition="==" minimum="OK" result="PASSED"><![CDATA[The TNSPING utility completed correctly using the service identified in the remote archive destination.]]></sdp_action>
<sdp_action result="FAILED"><![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.]]></sdp_action>
</sdp_actions>
</sdp_rule>
<sdp_rule id="P00011" mode="VERIFY" name="remote_dest_error">
<sdp_dependencies>
<sdp_dependency condition="IS" id="P00008" minimum="PASSED|RECORD" result="FAILED"><![CDATA[Requires rule 8.]]></sdp_dependency>
</sdp_dependencies>
<sdp_command type="SQL"><![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 = '%P00008%';
	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;
/]]></sdp_command>
<sdp_description><![CDATA[This rule checks if the last switch generated an error for the remote destination.]]></sdp_description>
<sdp_actions>
<sdp_action condition="==" minimum="NONE" result="PASSED"><![CDATA[The last archive was sent to the remote destination without an error.]]></sdp_action>
<sdp_action result="FAILED"><![CDATA[An error occured during the last remote archive operation. For additional information, refer to the rules results section above.]]></sdp_action>
</sdp_actions>
</sdp_rule>
<sdp_rule id="P00012" mode="RECORD" name="archive_process">
<sdp_dependencies>
<sdp_dependency condition="IS" id="P00008" minimum="PASSED|RECORD" result="FAILED"><![CDATA[Requires rule 8.]]></sdp_dependency>
</sdp_dependencies>
<sdp_command type="SQL"><![CDATA[select archiver from v$archive_dest
where dest_id='%P00008%';]]></sdp_command>
<sdp_description><![CDATA[The rule checks which process is performing the remote archive.]]></sdp_description>
</sdp_rule>
</sdp_group>
</sdp_content>
</sdp_diaglet>
