Saturday, February 4, 2023

Invalid

 #!/bin/bash


# Connect to the database and retrieve the list of invalid objects

invalid_objects=$(sqlplus -S user/password@database <<EOF

SET HEADING OFF

SET FEEDBACK OFF

SET PAGESIZE 0

SELECT object_name, object_type, status FROM dba_objects WHERE status = 'INVALID';

EXIT;

EOF

)


# Create the HTML file

cat > invalid_objects.html <<EOF

<html>

<head>

<title>List of Invalid Objects in Oracle Database</title>

</head>

<body>

<h1>List of Invalid Objects in Oracle Database</h1>

<table border="1">

<tr>

<th>Object Name</th>

<th>Object Type</th>

<th>Status</th>

</tr>

$(echo "$invalid_objects" | while read line; do

    object_name=$(echo $line | awk '{print $1}')

    object_type=$(echo $line | awk '{print $2}')

    status=$(echo $line | awk '{print $3}')

    echo "<tr><td>$object_name</td><td>$object_type</td><td>$status</td></tr>"

done)

</table>

</body>

</html>

EOF


No comments:

Post a Comment