Skip to content

Instantly share code, notes, and snippets.

View haballan's full-sized avatar

Mahmmoud ADEL haballan

View GitHub Profile
@haballan
haballan / dbdailychk_html.sh
Last active September 22, 2021 11:39
Shell Script To Perform Oracle Database Health Check (Performs multiple DB health checks and report them in one HTML report to the user via E-mail) More details: http://dba-tips.blogspot.ae/2017/11/oracle-database-health-check-report-in.html
# ##################################################################################################################################
# DATABASE DAILY HEALTH CHECK MONITORING SCRIPT
VER="[6.2]"
# ===================================================================================================
# CAUTION: THIS SCRIPT MAY CAUSE A SLIGHT OVEARHEAD, DO NOT RUN IT TOO FREQUENT, ONCE A DAY IS IDEAL.
# ===================================================================================================
# ***********
# How To Use:
# ***********
# 1- Set your Email by modifying this parameter below: EMAIL="[email protected]"
@haballan
haballan / goldengate_lag_mon.sh
Last active February 3, 2021 21:37
This shell script monitors goldegate lag based on predefined LAG threshold inside the script - More Details: http://dba-tips.blogspot.ae/2018/05/linux-shell-script-to-monitor-and.html
# ####################################################################################################################
# This Script Detects GOLDENGATE LAG If The LAG Hits the Pre-defined Threshold
# [Ver 1.0]
#
# To get this script work you need to Define the following variables:
# ORACLE_HOME # Must be set to the ORACLE_HOME path of the database where GoldenGate is running against.
# GG_HOME # Should be set to the Goldengate installation home directory path.
# LAG=xxxx # The number of minutes of lag, if reached an email alert will be sent [10 minutes is the default].
# EXL_PROC_NAME="DONOTREMOVE|REP11|REP12" In case you want to exclude specific processes e.g. REP11 & REP12
# LOG_DIR # The location of script logs [/tmp by default].
@haballan
haballan / gather_stats.sh
Last active November 8, 2021 17:01
Linux Shell Script to gather statistics of a whole schema or a table and its indexes in nohup mode
# #################################################################################################################
# V. 2.2
# Backup & Gather Statistics On SCHEMA|TABLE.
# To be run by ORACLE user
# # # #
# Author: Mahmmoud ADEL # # # # ###
# Created: 02-02-2014 # # # # #
# Modified: 02-05-2018 Re-coded the script to run the gather stats commands in the background [nohup mode].
# 14-01-2021 Checking the statistics LOCK status before gathering statistics.
# 31-05-2021 Added the option of gathering STALE statistics only instead of gathering all statistics.
@haballan
haballan / kill_long_running_queries.sh
Last active October 19, 2022 16:08
Shell Script To Kill long running queries that run from specific program e.g. SQL Developer | You have to specify ORACLE_SID, DURATION, MODULE_NAME inside the script. http://dba-tips.blogspot.com/2022/08/script-for-killing-long-running-queries.html
# ################################################################################################################
# Kill QUERIES/SESSIONS running for more than N minutes based on specific criteria.
# ################################################################################################################
VER="[2.5]"
# # # #
# Author: Mahmmoud ADEL # # # # ###
# Created: 11-01-18 # # # # #
#
# Modified: 17-08-22 Included the following filters:
# INCLUDE_USERS & EXCLUDE_USERS They are MUTUALLY EXCLUSIVE, only one to be set at a time.
@haballan
haballan / report_long_runing_queries.sh
Last active February 3, 2021 21:38
Shell Script To monitor long running queries (running for more than 1 hour [Default]) | For Oracle database on Linux. How to use: http://dba-tips.blogspot.ae/2018/04/report-long-running-queries-long-active.html
# ##################################################################################
# Checking long running queries run by specific user
# [Ver 1.2]
#
# # # #
# Author: Mahmmoud ADEL # # # # ###
# Created: 09-03-17 # # # # #
# Modified: 21-01-19 Enhanced the fetch for ORACLE_HOME.
# 19-02-19 Enabled the HTML report version.
# 06-07-20 New calculation method for 12c+ updated.
@haballan
haballan / check_standby_lag.sh
Last active April 21, 2021 14:04
Shell Script To check the lag / synchronization status between Primary and Standby Oracle DBs http://dba-tips.blogspot.ae/2017/11/shell-script-to-check-lag-sync-status.html
#!/bin/bash
# #########################################################################################
# This script MUST run from the Primary DB server.
# It checks the LAG between Primary & Standby database
# To be run by ORACLE user
# # # #
# Author: Mahmmoud ADEL # # # # ###
# Created: 29-10-2015 # # # # #
# Modified: 21-04-2021 allowed a DBA user to be used for SQLPLUS login instead of SYSDBA
# 21-04-2021 Simplified the Variables section for the end user.
# #################################################################################################
# [VER 1.4]
# This Script deletes Applied Archives older than Specified N hours on STANDBY DATABASE
# This script will run by default against ALL running STANDBY DATABASES.
# Please read the following instructions on how to use this script:
# - You can set MAIL_LIST variable to your E-mail to receive an email alert if archives
# are not applied.
# e.g. MAIL_LIST="[email protected]"
# - You can specify the candidate archives for deletion older than N hours by setting
# LAST_N_HOURS variable to the number of hours.
@haballan
haballan / RMAN_FULL_BACKUP
Last active May 10, 2023 01:41
Shell Script To Perform RMAN full backup in nohup mode http://dba-tips.blogspot.com/2017/03/rman-backup-script.html
#!/bin/bash
# #####################################################################################################
# This script takes an on-demand RMAN Backup.
# [Ver 5.2]
# # # #
# Author: Mahmmoud ADEL # # # # ###
# # # # # #
# Created: 24-09-11
# Modified: 31-12-13 Customized the script to run on various environments.
# 12-03-16 Run RMAN command in the background to avoid job fail when session terminate.
@haballan
haballan / configuration_baseline.sh
Last active October 19, 2022 16:11
This shell script collect the main configuration baseline data for Linux OS and Oracle databases http://dba-tips.blogspot.com/2016/12/configuration-baseline-script-for-linux.html
# #######################################################################################################################
# Ver [3.4]
# CONFIGURATION BASELINE COLLECTOR SCRIPT FOR ORACLE DATABASE & LINUX OS
# THIS SCRIPT WILL WRITE FOUR LOG FILES:
# - ONE FOR DATABASE CONFIGURATIONS [One log for EACH database].
# - ONE CONTAINS CREATION/GRANTED PRIVILEGES DDL STATEMENTS FOR ALL DB USERS [One log for EACH database].
# - ONE FOR CONTROLFILE BACKUP TO TRACE [One log for EACH database].
# - ONE FOR OS CONFIGURATIONS.
#
# FEATURES:
@haballan
haballan / dbdailychk.sh
Last active April 5, 2024 06:33
Shell Script To Perform Oracle Database Health Check (Performs multiple DB health checks and report them in one report to the user via E-mail) http://dba-tips.blogspot.com/2015/05/oracle-database-health-check-script.html
# ##################################################################################################################################
# DATABASE DAILY HEALTH CHECK MONITORING SCRIPT
VER="[6.2]"
# ===================================================================================================
# CAUTION: THIS SCRIPT MAY CAUSE A SLIGHT OVEARHEAD, DO NOT RUN IT TOO FREQUENT, ONCE A DAY IS IDEAL.
# ===================================================================================================
# ***********
# How To Use:
# ***********
# 1- Set your Email by modifying this parameter below: EMAIL="[email protected]"