#!/usr/bin/bash
ORACLE_BASE=/u02/app/oracle
ORACLE_HOME=/u02/app/oracle/product/19.0.0.0/dbhome_1
LOGNAME=runon_all_localdb_$$.log
for v_inst in `ps -ef| grep pmon | awk '{print $8}' | grep -iv asm | grep -iv apx | awk -F"_" '{print $3}'`
do
echo "Instance name = $v_inst"
export ORACLE_SID=$v_inst
$ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF >> ${LOGNAME}
show user
set echo off
set numwidth 9
set linesize 132
set pagesize 300
set feedback off
set verify off
set time off
set timing off
--select * from v\$instance;
@/u02/scripts/paresh/find_pdbs.sql
--select PROPERTY_VALUE from database_properties where PROPERTY_NAME='DEFAULT_TEMP_TABLESPACE';
EOF
done
cat ${LOGNAME}
rm ${LOGNAME}
Category: shell
prepfiles.sh for step by step generating pending statistics files
This script, prepfiles.sh, is a powerful utility for Oracle Database Administrators designed to automate the generation of a comprehensive SQL toolkit for managing and testing database statistics. By reading a list of tables from mtx_tablelist.lst, the script creates a sequenced set of SQL files that handle the entire lifecycle of Pending Statistics. This allows DBAs to gather and validate new…
Read More “prepfiles.sh for step by step generating pending statistics files” »
Transfer SQL Profiles from One database to other database.
In this guide, I’ll walk you through moving SQL profiles using a staging table. SQL profiles help databases optimize query execution plans. Step#1 Create the Staging Table First, create a staging table to hold SQL profiles that need to be transferred. SQL> exec DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF(table_name => ‘SQL_STG_TAB’, schema_name => ‘SYS’); This will create a table SQL_STG_TAB…
Read More “Transfer SQL Profiles from One database to other database.” »
Oracle GoldenGate lag monitoring shell script
Following script will be useful for tracking Oracle GoldenGate replicat process and related lag. This script will generate output on standard screen. You can redirect it using file redirection to logfile or other locations. while true do <goldengate home directory>/ggsci <<EOF > test.out info all exit EOF lag=`cat test.out | grep TESTREPLICAT | awk ‘{print…
How to collect CPU usage on Linux using Shell script
Following script will help to collect CPU based on on every SAMPLE_TIME. This will help to collect IDLE CPU our from “vmstat” and store them in a file. #Setup SAMPLE_TIME for cpu data collection interval SAMPLE_TIME=5 while true do x=`vmstat | grep -v procs | grep -v swpd | awk ‘{print $15}’` echo `date +”%m-%d-%y…
Read More “How to collect CPU usage on Linux using Shell script” »
CPU speed on Linux
less /proc/cpuinfo
CPU speed on solaris
To get cpu speed, use psrinfo -v psrinfo -v Status of virtual processor 0 as of: 12/10/2010 11:33:07 on-line since 08/01/2010 15:55:44. The sparcv9 processor operates at 1800 MHz, and has a sparcv9 floating point processor. Status of virtual processor 1 as of: 12/10/2010 11:33:07 on-line since 08/01/2010 15:55:50. The sparcv9 processor operates at 1800…
grep multuple patterns
cat test1 | egrep ‘TNS-|Client address’ | sed -e ‘s/^.*HOST/HOST/’
fuser to check who is using diretory
fuser -cu /directory_name
Unix command for system configuration
Seeing kernel version (32/64 Bit) on Unix flavors. -isainfo -kv on Solaris -lsconf on AIX -uname -a on Linux to See configuration -prtdiag on Solaris -lsconf on AIX -dmidecode on Linux Other useful Unix commands: Disk usage. # df -al Memory information. # free Network information. # ifconfig -a Installed Modules information. #lsmod Currently mounted…
