Posts

Report mail alert

#!/bin/bash # Define database credentials DB_USER="your_user" DB_PASS="your_password" DB_SID="your_db" # Email Configuration EMAIL_TO="recipient@example.com" EMAIL_SUBJECT="OEM Target Report - $(date +%Y-%m-%d)" REPORT_FILE="oem_target_report_$(date +%Y%m%d).txt" # Function to execute SQL query and format output run_query() {     SECTION_TITLE="$1"     QUERY="$2"     echo "=============================================" >> "$REPORT_FILE"     echo "SECTION: $SECTION_TITLE" >> "$REPORT_FILE"     echo "=============================================" >> "$REPORT_FILE"     sqlplus -s "$DB_USER/$DB_PASS@$DB_SID" <<EOF >> "$REPORT_FILE" SET PAGESIZE 500 SET LINESIZE 200 SET HEADING ON SET FEEDBACK OFF SET TRIMSPOOL ON COLUMN "TARGET NAME" FORMAT A30 COLUMN "TARGET TYPE" FORMAT A20 COLUMN ...

New

 https://oracle.zoom.us/j/94121597140?pwd=xIhA57bR4LWdF159ty6F2GU33knKwP.1

Database mode check

 Standard Operating Procedure (SOP) for Database Read-Only Mode Validation Automation --- 1. Purpose This SOP outlines the automated process for validating the OPEN_MODE of multiple Oracle databases using a predefined list. The script identifies databases that are not in READ ONLY mode and sends an email notification for further review. --- 2. Scope Applies to Oracle databases running across multiple hosts. Uses a common tnsnames.ora file for connectivity. Executes SQL queries to check the database mode and uptime in that mode. Notifies the DBA team if any database is not in READ ONLY mode. --- 3. Prerequisites Ensure the Oracle environment variables are set correctly: export TNS_ADMIN=/auto/your/tns/location export ORACLE_HOME=/auto/your/oracle/home export PATH=$ORACLE_HOME/bin:$PATH A valid tnsnames.ora file containing the TNS entries for all databases. A list of target databases stored in a file (db_list.txt). A static username and password for database authentication. --- 4. Sc...

Apex

 #!/bin/bash # Check if SID is passed as an argument if [ -z "$1" ]; then   echo "Usage: $0 <ORACLE_SID>"   exit 1 fi # Set the Oracle SID dynamically export ORACLE_SID=$1 # Source Oracle environment variables using oraenv . /usr/local/bin/oraenv <<< "$ORACLE_SID" # Output file for the results OUTPUT_FILE="${ORACLE_SID}_db_info.log" # Function to log the output to a file log_output() {   echo "$1" >> "$OUTPUT_FILE" } # Start logging process log_output "-------------------------------------" log_output "DB Information for $ORACLE_SID" log_output "-------------------------------------" # 1. DB Growth (Tablespace Size Information) log_output "-------------------------------------" log_output "DB Growth (Tablespace Size Information for $ORACLE_SID)" log_output "-------------------------------------" sqlplus -S / as sysdba <<EOF >> "$O...

Db running on nodes

#!/bin/bash # Check if ASM SID is passed as an argument if [ -z "$1" ]; then   echo "Usage: $0 <ASM_SID>"   exit 1 fi # Set the Oracle SID (ASM) and source environment using oraenv export ORACLE_SID=$1 export ORAENV_ASK=NO source oraenv > /dev/null # Define log file LOG_FILE="exadata_db_config.log" > "$LOG_FILE" # Clear previous log content # Print header echo -e "Database Unique Name | Database Instances | Configured Nodes" | tee -a "$LOG_FILE" echo "--------------------------------------------------------------" | tee -a "$LOG_FILE" # Get list of all databases managed by Grid Infrastructure DB_LIST=$(srvctl config database | sort -u) # Loop through each database and fetch required details for DB in $DB_LIST; do     DB_NAME=$(srvctl config database -d "$DB" | grep -i "Database unique name" | awk -F": " '{print $2}')     INSTANCES=$(srvctl config database -...

Sop

 Standard Operating Procedure (SOP) for Oracle 19c TDE Wallet Validation and Backup Automation Document Version Version: 1.4 Date: YYYY-MM-DD Author: <Your Name> Reviewed By: <Reviewer Name> Last Updated: YYYY-MM-DD --- 1. Objective This SOP provides a structured approach to automate Transparent Data Encryption (TDE) wallet validation and backup for all running Oracle databases (both 12c and 19c) on a given host. Key Features of the Automation: Detects all running Oracle databases except ASM and APX. Determines the database version dynamically (12c or 19c) and executes version-specific queries. Automatically sources ORACLE_SID using oraenv. Retrieves wallet passwords securely from Cloakware (if configured). Validates the TDE wallet status and its location. Ensures the wallet location contains the corresponding database name. Performs structured backups of the wallet if it exists. Checks for encrypted tablespaces and validates wallet password correctness. Logs outputs sy...

Log handle

 # Define constants DEFAULT_LOCATION="ncryption/TDE" LOG_LOCATION="$DEFAULT_LOCATION/log" RUN_DATE=$(date '+%Y%m%d') # Create necessary directories if they do not exist mkdir -p "$DEFAULT_LOCATION" "$LOG_LOCATION" # Define log and report files LOG_FILE="${LOG_LOCATION}/wallet_validate_${RUN_DATE}.log" REPORT_FILE="${LOG_LOCATION}/wallet_report_${RUN_DATE}.log" # Check if log and report files can be created if touch "$LOG_FILE" && touch "$REPORT_FILE"; then     echo "Log and report files initialized successfully." else     echo "Error: Cannot create log or report files. Check directory permissions."     exit 1 fi