#Here's a shell script that performs a basic clone sanity check for an Oracle database and outputs the result in an HTML file#
#!/bin/bash
# Define the target database details
target_db_name="TARGET_DB"
target_db_user="TARGET_USER"
target_db_pass="TARGET_PASS"
# Define the HTML file name and header
html_file="clone_sanity_check.html"
html_header="<html><head><title>Clone Sanity Check Report</title></head><body>"
html_footer="</body></html>"
# Initialize the HTML file
echo "$html_header" > "$html_file"
# Perform the database clone sanity check
# Check the target database connection
target_conn_check=$(sqlplus -s "$target_db_user/$target_db_pass@$target_db_name" <<EOF
set heading off;
set feedback off;
set verify off;
select 'Success' from dual;
exit;
EOF
)
# Write the target connection check result to the HTML file
echo "<h2>Target Database Connection Check</h2>" >> "$html_file"
if [ "$target_conn_check" == "Success" ]; then
echo "<p style='color: green;'>Successful</p>" >> "$html_file"
else
echo "<p style='color: red;'>Failed</p>" >> "$html_file"
fi
# Add the HTML file footer
echo "$html_footer" >> "$html_file"
No comments:
Post a Comment