egrep 'ORA-|EXP-' /fiscdv/tdbs/prod/exports/DBNAME/u01/data_pump_DBNAME/
expdp_schema.log |sort -u | mailx -s "Body of this mail will contain details if Errors in Export - servername DBNAME" Harsha@email.com
cat /fiscdv/tdbs/prod/exports/DBNAME/u01/data_pump_DBNAME/expdp_schema.log | mailx -s "USERNAME Oracle Export - servername DBNAME - Completed Successfully" Harsha@email.com
grep 'Word' filename
grep 'word' *
Tuesday, May 31, 2011
using grep and egrep
egrep 'ORA-|EXP-' /fiscdv/tdbs/prod/exports/DBNAME/u01/data_pump_DBNAME/
expdp_schema.log |sort -u | mailx -s "Body of this mail will contain details if Errors in Export - servername DBNAME" Harsha@email.com
cat /fiscdv/tdbs/prod/exports/DBNAME/u01/data_pump_DBNAME/expdp_schema.log | mailx -s "USERNAME Oracle Export - servername DBNAME - Completed Successfully" Harsha@email.com
grep 'Word' filename
grep 'word' *
expdp_schema.log |sort -u | mailx -s "Body of this mail will contain details if Errors in Export - servername DBNAME" Harsha@email.com
cat /fiscdv/tdbs/prod/exports/DBNAME/u01/data_pump_DBNAME/expdp_schema.log | mailx -s "USERNAME Oracle Export - servername DBNAME - Completed Successfully" Harsha@email.com
grep 'Word' filename
grep 'word' *
Purging files using adric utility
#!/bin/ksh
echo 'SIZE BEFORE DBNAME TRACE PURGE' > /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trc >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trc >> /fisc/oracle/purge/purgetrace.log
df -h /vah/oracle >> /fisc/oracle/purge/purgetrace.log
echo 'NUMBER OF FILES BEFORE DBNAME TRACE PURGE' >> /fisc/oracle/purge/purgetrace.log
ls -1R /vah/oracle/admin/DBNAME/udump | wc -l >> /fisc/oracle/purge/purgetrace.log
export ORACLE_HOME=/vah/oracle/product/11.2.0.2
export ORACLE_SID=DBNAME
echo $ORACLE_HOME
echo $ORACLE_SID
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trm
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trc
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trm
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trc
/vah/oracle/product/11.2.0.2/bin/adrci >> /fisc/oracle/purge/purgetrace.log << EOF set homepath diag/rdbms/DBNAME/DBNAME purge -age 1440 -type TRACE exit EOF echo 'SIZE AFTER DBNAME TRACE PURGE' >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trc >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trc >> /fisc/oracle/purge/purgetrace.log
df -h /vah/oracle >> /fisc/oracle/purge/purgetrace.log
echo 'NUMBER OF FILES AFTER DBNAME TRACE PURGE' >> /fisc/oracle/purge/purgetrace.log
ls -1R /vah/oracle/admin/DBNAME/udump | wc -l >> /fisc/oracle/purge/purgetrace.log
cat /fisc/oracle/purge/purgetrace.log | mailx -s "DBNAME Trace Purge Job output" Harsha@email.com
echo 'SIZE BEFORE DBNAME TRACE PURGE' > /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trc >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trc >> /fisc/oracle/purge/purgetrace.log
df -h /vah/oracle >> /fisc/oracle/purge/purgetrace.log
echo 'NUMBER OF FILES BEFORE DBNAME TRACE PURGE' >> /fisc/oracle/purge/purgetrace.log
ls -1R /vah/oracle/admin/DBNAME/udump | wc -l >> /fisc/oracle/purge/purgetrace.log
export ORACLE_HOME=/vah/oracle/product/11.2.0.2
export ORACLE_SID=DBNAME
echo $ORACLE_HOME
echo $ORACLE_SID
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trm
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trc
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trm
cat /dev/null > /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trc
/vah/oracle/product/11.2.0.2/bin/adrci >> /fisc/oracle/purge/purgetrace.log << EOF set homepath diag/rdbms/DBNAME/DBNAME purge -age 1440 -type TRACE exit EOF echo 'SIZE AFTER DBNAME TRACE PURGE' >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_29248.trc >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trm >> /fisc/oracle/purge/purgetrace.log
ls -l /vah/oracle/admin/DBNAME/udump/DBNAME_ora_17709.trc >> /fisc/oracle/purge/purgetrace.log
df -h /vah/oracle >> /fisc/oracle/purge/purgetrace.log
echo 'NUMBER OF FILES AFTER DBNAME TRACE PURGE' >> /fisc/oracle/purge/purgetrace.log
ls -1R /vah/oracle/admin/DBNAME/udump | wc -l >> /fisc/oracle/purge/purgetrace.log
cat /fisc/oracle/purge/purgetrace.log | mailx -s "DBNAME Trace Purge Job output" Harsha@email.com
Friday, May 27, 2011
Purging files older than 5 days using mtime in linux
oracle@servername:dbname> cat /fisc/oracle/purge/purgescript_1.ksh
#!/bin/ksh
echo 'SIZE BEFORE dbname TRACE PURGE' > /fisc/oracle/purge/purgetrace_1.log
ls -l /fisc/dba/traces/dbname_ap01_11336.trm >> /fisc/oracle/purge/purgetrace_1.log
df -h /fisc/dba/traces >> /fisc/oracle/purge/purgetrace_1.log
echo 'NUMBER OF FILES BEFORE dbname TRACE PURGE' >> /fisc/oracle/purge/purgetrace_1.log
ls -1R /fisc/dba/traces | wc -l >> /fisc/oracle/purge/purgetrace_1.log
export ORACLE_HOME=/ercprtp1/oracle/product/11.2.0.2
export ORACLE_SID=dbname
echo $ORACLE_HOME
echo $ORACLE_SID
cat /dev/null > /fisc/dba/traces/dbname_ap01_11336.trm
find /fisc/dba/traces/*.trm -mtime +5 -exec rm {} \;
find /fisc/dba/traces/*.trc -mtime +5 -exec rm {} \;
echo 'SIZE AFTER dbname TRACE PURGE' >> /fisc/oracle/purge/purgetrace_1.log
ls -l /fisc/dba/traces/dbname_ap01_11336.trm >> /fisc/oracle/purge/purgetrace_1.log
df -h /fisc/dba/traces >> /fisc/oracle/purge/purgetrace_1.log
echo 'NUMBER OF FILES AFTER dbname TRACE PURGE' >> /fisc/oracle/purge/purgetrace_1.log
ls -1R /fisc/dba/traces | wc -l >> /fisc/oracle/purge/purgetrace_1.log
cat /fisc/oracle/purge/purgetrace_1.log | mailx -s "dbname Trace Purge Job output" Mail-dl@fmr.com
#cat /fisc/oracle/purge/purgetrace_1.log | mailx -s "dbname Trace Purge Job output" corpid@fmr.com
*****************
chmod 777 purgescript_1.ksh
to run the .ksh
ksh -x purgescript_1.ksh
Scheduled Crontab:
00 22 * * * /fisc/oracle/purge/purgescript_1.ksh > /fisc/oracle/logs/Cron/purgescript_1.log 2>&1
******************
#!/bin/ksh
echo 'SIZE BEFORE dbname TRACE PURGE' > /fisc/oracle/purge/purgetrace_1.log
ls -l /fisc/dba/traces/dbname_ap01_11336.trm >> /fisc/oracle/purge/purgetrace_1.log
df -h /fisc/dba/traces >> /fisc/oracle/purge/purgetrace_1.log
echo 'NUMBER OF FILES BEFORE dbname TRACE PURGE' >> /fisc/oracle/purge/purgetrace_1.log
ls -1R /fisc/dba/traces | wc -l >> /fisc/oracle/purge/purgetrace_1.log
export ORACLE_HOME=/ercprtp1/oracle/product/11.2.0.2
export ORACLE_SID=dbname
echo $ORACLE_HOME
echo $ORACLE_SID
cat /dev/null > /fisc/dba/traces/dbname_ap01_11336.trm
find /fisc/dba/traces/*.trm -mtime +5 -exec rm {} \;
find /fisc/dba/traces/*.trc -mtime +5 -exec rm {} \;
echo 'SIZE AFTER dbname TRACE PURGE' >> /fisc/oracle/purge/purgetrace_1.log
ls -l /fisc/dba/traces/dbname_ap01_11336.trm >> /fisc/oracle/purge/purgetrace_1.log
df -h /fisc/dba/traces >> /fisc/oracle/purge/purgetrace_1.log
echo 'NUMBER OF FILES AFTER dbname TRACE PURGE' >> /fisc/oracle/purge/purgetrace_1.log
ls -1R /fisc/dba/traces | wc -l >> /fisc/oracle/purge/purgetrace_1.log
cat /fisc/oracle/purge/purgetrace_1.log | mailx -s "dbname Trace Purge Job output" Mail-dl@fmr.com
#cat /fisc/oracle/purge/purgetrace_1.log | mailx -s "dbname Trace Purge Job output" corpid@fmr.com
*****************
chmod 777 purgescript_1.ksh
to run the .ksh
ksh -x purgescript_1.ksh
Scheduled Crontab:
00 22 * * * /fisc/oracle/purge/purgescript_1.ksh > /fisc/oracle/logs/Cron/purgescript_1.log 2>&1
******************
Script to check top 128 sql.
select *
from
(
select
executions,
ROUND((cpu_time/1000000),2) total_cpu,
ROUND((elapsed_time/1000000),2) total_elapsed,
ROUND((cpu_time/1000000)/executions,2) cpu_per_e,
ROUND((elapsed_time/1000000)/executions,2) elapsed_per_e,
length(sql_fulltext),
sql_fulltext
from v$sql
where executions > 0
order by elapsed_per_e desc
)
where rownum <= 128;
from
(
select
executions,
ROUND((cpu_time/1000000),2) total_cpu,
ROUND((elapsed_time/1000000),2) total_elapsed,
ROUND((cpu_time/1000000)/executions,2) cpu_per_e,
ROUND((elapsed_time/1000000)/executions,2) elapsed_per_e,
length(sql_fulltext),
sql_fulltext
from v$sql
where executions > 0
order by elapsed_per_e desc
)
where rownum <= 128;
Monday, May 23, 2011
Script for Checking disk size on ASM
set lines 9999
col DISKNAME for a20
col DISKGROUP for a20
col PATH for a30
select a.name DiskGroup, b.disk_number Disk#, b.name DiskName, b.total_mb, b.free_mb, b.path,
b.header_status from v$asm_disk b, v$asm_diskgroup a where a.group_number (+) =b.group_number
order by b.group_number, b.disk_number, b.name
col DISKNAME for a20
col DISKGROUP for a20
col PATH for a30
select a.name DiskGroup, b.disk_number Disk#, b.name DiskName, b.total_mb, b.free_mb, b.path,
b.header_status from v$asm_disk b, v$asm_diskgroup a where a.group_number (+) =b.group_number
order by b.group_number, b.disk_number, b.name
Putting Sql file in Background.
index_creation.sh
sqlplus /nolog << EOF conn username/passward@DBname index_creation.sql >>EOF
-----
index_creation.sql
-------------
chmod +x index_creation.sh
sqlplus /nolog << EOF conn username/passward@DBname index_creation.sql >>EOF
-----
index_creation.sql
-------------
chmod +x index_creation.sh
Subscribe to:
Posts (Atom)