Skip to main content

Posts

Showing posts from May, 2024

Shell Script to check Weblogic Admin and Managed Servers

Shell Script to check Weblogic Admin and Managed Servers In this post I am sharing a script to check the Weblogic and Managed Server status Using Shell script and WLST script. Assumptions: Understanding for Shell script UnderStand Fusion MiddbleWare Script: This script is tested in EBS 12.2 Environment. You can change values as per your environment. #!/bin/bash #set -x . /u01/install/APPS/EBSapps.env run # Set WebLogic Environment Variables export MW_HOME=/u01/install/APPS/fs1/FMW_Home export WL_HOME=$MW_HOME/wlserver_10.3 export DOMAIN_HOME=$MW_HOME/user_projects/domains/EBS_domain export PATH=$PATH:$WL_HOME/common/bin # WebLogic Admin Server credentials ADMIN_URL="t3://apps.example.com:7001" USERNAME="weblogic" PASSWORD="welcome1" # Temporary file to store WLST script WLST_SCRIPT="/tmp/check_wls_status.py" # Temporary file to store WLST script WLST_SCRIPT="/tmp/check_wls_status.py" # Colors for output RED='\033[0;31m' NC='...

Creating a Gold Image of Oracle Database Home and using it for Cloning Oracle Home

Creating a Gold Image of Oracle Database Home and using it for Cloning Oracle Home What is a Gold Image? A gold image is a master copy of an Oracle Database installation that includes all necessary configurations, patches, and updates. It can be replicated and deployed across various servers, ensuring identical installations. This method is especially beneficial in large enterprises where consistent configurations across multiple environments are crucial. Benefits of Using a Gold Image Consistency: Ensures uniformity across all database installations. Efficiency: Reduces the time required for installation and configuration. Error Reduction: Minimizes human errors during the installation process. Compliance: Ensures all installations comply with organizational standards and policies. Simplified Maintenance: Easier to manage and maintain patches and updates. Applicable in 19c and onwards. Cloning an Oracle Database Home Using an Gold Image File Create an image file from the source O...

Shell Script to Perform a Database Health Check

Shell Script to Perform a Database Health Check In this post I am sharing a shell script to do a full database health check and create a html report. Assumption: You should be aware of shell scripts. You need to make changes before running in any of your environment. You should be understanding Oracle Database. Script is built for non-CDB environment and tested in same. Note: Script will be helping in saving tie, but use it wisely by understanding what is being done. Blindly using script will not make you a good DBA. Report Sample Screenshot(Only one Portion) Script: #!/bin/bash # Oracle environment variables (adjust as necessary) #export ORACLE_SID=your_sid #export ORACLE_HOME=/path/to/oracle_home #export PATH=$ORACLE_HOME/bin:$PATH . ~/.bash_profile   export ORAENV_ASK=NO export ORACLE_SID=FOA12 export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 . oraenv   # Paths to alert log and timestamp file ALERT_LOG="/u01/db/TRAIN/12.1.0/admin/TRAIN_ebstraining/diag/rdbms/train...

Shell Script to Read Oracle Database Alert Log and Report ORA Errors

Shell Script to Read Oracle Database Alert Log and Report ORA Errors In this post, I will share shell script to check and read my alert log file based in timestamp and provide me ORA  errors from last check timestamp. The script will capture data after last checked timestamp. Assumption: You need to know your alertlog file path Script: #!/bin/bash #set -x # Oracle environment variables (adjust as necessary) #export ORACLE_SID=your_sid #export ORACLE_HOME=/path/to/oracle_home #export PATH=$ORACLE_HOME/bin:$PATH . ~/.bash_profile # Paths to alert log and timestamp file ALERT_LOG="/u01/db/TRAIN/12.1.0/admin/TRAIN_ebstraining/diag/rdbms/train/TRAIN/trace/alert_TRAIN.log" TIMESTAMP_FILE="/tmp/last_checked_timestamp.txt" REPORT_FILE="health_check_report.html" # Function to validate the database alert log and identify ORA error codes check_alert_log_for_errors() {   echo "<h3>Database Alert Log Errors</h3>" >> $REPORT_FILE   echo ...

Use WLST to Validate and check Status of the Weblogic and Managed Server

Use WLST to Validate and check Status of the Weblogic and Managed Server In this post, I am going to share how can we use WLST(Weblogic Scripting Tool) to validate and check status of admin and managed servers. Location of Script: FMW_HOME/weblogic_dir/common/bin /u01/apps/TRAIN/fs1/FMW_Home/wlserver_10.3/common/bin [applmgr@ebstraining bin]$ ls -ltr wlst.sh -rwxr-x---. 1 applmgr oinstall 787 May  9 03:25 wlst.sh Connecting to WLST When we kick off the script it will connect in offline mode. We will need to connect to the Weblogic server. [applmgr@ebstraining bin]$ ./wlst.sh Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline> Connecting to Online Weblogic server connect('Username','Password','Admin console Url') wls:/offline> connect ('weblogic','oracle123','t3://ebstraining.lab:7011') Connecting to t3://ebstraining.lab:701...

Menu based Shell Script to take Oracle Database Backup and Restore on other server

Menu based Shell Script to take Oracle Database Backup and Restore on other server I am going to share the a script which is menu based and can perform full database backup and restore on a new server. This script can be used for regular clones and refreshes. The script is written based on few scenarios. There might be various scenarios and options that can built in the script. I am using duplicate command. If you need to get paid consultation and development, then feel free to reach out ot me. Example: Source DB: TRAIN Version: 12.1.0.2 Target DB : DEV Version: 12.1.0.2 I am going to perform clone for DEV using the backup from source db. Script Menu: Script: #!/bin/bash #set -x # Function to perform full RMAN backup perform_backup() {     # Create directory with today's date     TODAY_DIR="$(date +'%Y-%m-%d')"     BACKUP_DIR="$BACKUP_ROOT_DIR/$TODAY_DIR"     export ORACLE_SID="$SOURCE_DB_SID"     export PATH=$ORACLE_HOME/bin:$PATH ...