Lowercase on the fly transform
This piece of code transforms the variable as its printed to lowercase print $ORACLE_SID|tr ‘[A-Z]’ ‘[a-z]’
.kshrc and .bashrc for persistent settings
In order to get set -o vi This should be set at the .kshrc or .bashrc level [code language=”sql”] # M Culp # .kshrc # Source global definitions if [ -f /etc/kshrc ]; then . /etc/kshrc fi # use emacs editing mode by default # set -o emacs set -o vi # User specific aliases […]
longops.sql
[code language=”sql”] — ———————————————————————————– — File Name : https://oracle-base.com/dba/monitoring/longops.sql — Author : Tim Hall — Description : Displays information on all long operations. — Requirements : Access to the V$ views. — Call Syntax : @longops — Last Modified: 03/07/2003 — ———————————————————————————– COLUMN sid FORMAT 999 COLUMN serial# FORMAT 9999999 COLUMN machine FORMAT A30 COLUMN […]
TOP5.ksh
Top 5 [code language=”sql”] #!/bin/ksh ############################################################################ # Script Name..: top5.ksh # Description..: # Author…….: Michael Culp # Date………: / /2012 # Version……: # Modified By..: # Date Modified: # Comments…..: # Schema owner.: # alter session set current # Login User…: # Run Order….: # Dependent on.: # Script type..: # ############################################################################ sqlplus -s "/ […]
Automating Startup / Shutdown in Linux
As root user create new file “oracle” (init script for startup and shutdown the database) in /etc/init.d/ directory with following content: [code language=”sql”] #!/bin/bash # # oracle Init file for starting and stopping # Oracle Database. Script valid for 10g and 11g. # # chkconfig: 35 80 30 # description: Oracle Database startup script# Source […]
db_switch function
[code language=”SQL”] function db_switch { ############################################################################### # function switches the database environments for any databases on the cluster # ############################################################################### #cd /var/opt/oracle/admin/scripts #. ./env_generic # export NEW_ORACLE_SID=ASM1+; . ~/.profile > /dev/null echo echo "Check database(s) in OCR" echo ————————————— echo gen_db_lst #srvctl config > dblst #echo #echo "Databases listed in clusterware" #cat dblst #echo export […]
Alert log errors
This is located in a common library [code language=”sql”] #!/usr/bin/ksh # Purpose: Search the alert log of $ORACLE_SID for error # messages. # If any error messages are found, send notification # (see Notes below). # # Prereqs: $ORACLE_SID environment variable must be set or # passed as a positional parameter. Also, $ORATAB # […]