===================================
WorkSheets - Operating System
===================================
http://www.athirathram.org/home.html
Linux Commands -http://www.pixelbeat.org/cmdline.html
Grepping multiple processes - ps -ef | egrep -i "
spliting a file in to several - split -b 1024m
parts of 1 GB filesize each.
Presentation Pictures - http://www.istockphoto.com/file_search.php?action=file&lightboxID=664079
Report format-
###begin_report###
###end_report###
"DB - 8*5 check"
To direct an output to screen as well as file - ./102_relocate_containers.sh | tee 102_relocate_containers.log
pk7xap01@s96ss0d14:/home/pk7xap01 : while true
> do
> db2 list utilities show detail
> sleep 60
> done
------------------------------------------------
CISM database checking procedure -
Server - s96ars10-v2
Database - arsprd
PORT - 1522
Check Listener - ps -ef | grep -i inherit
TNS Checking - tnsping arsprd
OS user - ora_arsprd
------------------------------------------------
Laste successful TSM backup- `db2adutl query full db $LOGNAME|grep '1 Time:'|awk '{print $3}'|head -1`
To find the TSM using - dsmc q sess
Operating System
================
Creating log file for a .sh script:
-----------------------------------
Send a message (Banner) for all users:
--------------------------------------
wall +
Create a link
=============
Soft link -
ln -s
Example:
ln -s /epeople/onredom/hrepgll9 hrepprd9
Removal of link-
rm hrepprd9
Process tree structure
======================
SUN - pstree
AIX - proctree
List system error message
=========================
SUN - errpt
No of processors
================
AIX - lsdev -Cc processor | wc -l
SUN - prtdiag -v
Bit version
===========
Sun - isainfo -kv
AIX - bootinfo -K
HP - getconf KERNEL_BITS
Linux - getconf LONG_BIT
Memory tracking
===============
Linux:
------
Linux stores memory related information in a file called /proc/meminfo.
You can list the meminfo file to see the current state of system memory.
cat /proc/meminfo
The Linux free command extracts and formats pertinent
information from the meminfo file and displays it as follows:
free -k or free -m
To check memory size in Linux using dmesg, run the following command:
dmesg |grep -i memory (Running dmesg command in Linux displays memory in kilobytes)
Linux also comes with top command, top can be run to check real memory size and
memory utilization.Top display total memory size,used memory,free memory ,memory
buffers size and swap memory utilization :
top
Solaris:
--------
To display the amount of RAM:
top
/usr/sbin/prtconf | grep Memory
vmstat
HP-UX:
------
vmstat
swapinfo -tm (HP-Ux swap space monitor)
AIX:
----
nmon
lsps -s (AIX paging monitor)
prtconf | grep -i mem
How to check system error messages
==================================
Sun - cat /var/adm/messages (Optionally tail /var/adm/messages)
AIX - errpt
Create and maintain screen
==========================
Create screen - screen -S
Eg: screen -S TT11320203_Ora_task
Attach to screen - screen -r
Eg: screen -r TT11320203_Ora_task
Detach from screen - CTRL+A and release hand then press D
Database list in EDC
====================
read db_name;cat /sysadm/utils/ora_util.sid..| grep -i $db_name
read db_name;cat ora_util.sid..| grep -i $db_name
cat /sysadm/utils/ora_util.sid..| grep -i
Find
====
To find the pattern and print the line + the line above
-------------------------------------------------------
awk '{if ($2=="ALTER") {print ab,"\n",$0} {ab=$0}}'
To find the pattern in a file
-----------------------------
awk '{print $1}' imp_ttu2_METADATA_ONLY_19022010.log|grep -i ORA-|head
awk '{print $1}' imp_ttu2_METADATA_ONLY_19022010.log|grep -i ORA-|sort -u
Loop to monitor
===============
while :;do ls -l | wc -l;sleep 60;done # use CTRL+C for exit from loop
while : ; do ls -l *.Z | wc -l ; sleep 60 ; done
Loop to monitor a FS
--------------------
cat > fschk.sh
clear; echo 'Please enter FS: '; read fs; clear; echo 'Please enter freequency (in seconds): '; read freeq; while : ; do clear; df -h $fs ; sleep $freeq; clear ; done
chmod 755 fschk.sh
alias watch=./fschk.sh
Ex:
while : ; do clear ; echo "Fleetboard Restoration Progress (in last 30 mins)" ; ./fleetboard_db_restore_status.sh|grep "Completed Work"; sleep 1800 ; clear ; done
To make the desired date format
-------------------------------
Date format: $(date +"%d%m%Y") - ddmmyy
Date format: $(date +"%d-%m-%Y %H:%M:%S") - dd-mm-yyyy hh24:mi:ss
File management
===============
Replacement command
-------------------
Press SHIFT+: then type 1,$s/10.2.0/10.2.0.4/g -- Here 10.2.0 is the string to be replaced with 10.2.0.4
Checking difference in 2 files
------------------------------
diff
Example:
--------
vkvxap01@s96gbs01:/home/vkvxap01 : ls -ltr backup_dbm_cfg_270309.txt
-rw-r--r-- 1 vkvxap01 vkvxap01 5220 Mar 27 05:05 backup_dbm_cfg_270309.txt
vkvxap01@s96gbs01:/home/vkvxap01 : db2 get dbm cfg > dbm_cfg_updated_270309.txt
vkvxap01@s96gbs01:/home/vkvxap01 : ls -ltr dbm_cfg_updated_270309.txt
-rw-r--r-- 1 vkvxap01 vkvxap01 5220 Mar 27 05:37 dbm_cfg_updated_270309.txt
vkvxap01@s96gbs01:/home/vkvxap01 :
vkvxap01@s96gbs01:/home/vkvxap01 :
vkvxap01@s96gbs01:/home/vkvxap01 : diff backup_dbm_cfg_270309.txt dbm_cfg_updated_270309.txt
8c8
< CPU speed (millisec/instruction) (CPUSPEED) = 5.038339e-07
---
> CPU speed (millisec/instruction) (CPUSPEED) = 5.668131e-07
vkvxap01@s96gbs01:/home/vkvxap01 :
Delete audit files
------------------
find
Pack/ Compress
--------------
gzip -9
nohup gzip -c
compress
Example:
gzip -9 < /log/oracle/network/listener.log > /log/oracle/network/listener.log.gz
compress < /log/oracle/network/listener.log > /log/oracle/network/listener.log.Z
Pack/ Compress perticular files
-------------------------------
cd
FILES="`ls`"
tar -cvf
gzip --best
rm $FILES
Example:
cd /db2/backup_zujxap03/
FILES="`echo ls *.trc`"
tar -cvf db_oft1_trcs_301109.tar $FILES
gzip --best db_oft1_trcs_301109.tar
rm $FILES
New Methode:
echo '';echo 'listing files to be archived:';echo '';FILES="`ls *.Z *.1`";echo $FILES;echo '';echo 'compressing..';echo '';tar -cvf logs_$(date +"%d%m%Y").tar $FILES;gzip -9 logs*.tar;echo '';echo 'files compressed as -';echo '';ls -ltr logs*tar*.gz
dsmc arch "logs*tar*.gz"
dsmc q arch "logs*tar*.gz"
rm $FILES
Truncate file
--------------
cat '' >
Eg: cat '' > /log/oracle/network/listener.log
Note:
While handlying with listener, do not remove this file as the listener keeps a
filehandle to this file. In case , if we accidently removed listener.log, The
only solution to this problem is restarting the listener. If one knows that the
database is at that moment not under heavy connect/disconnect-load, then restart
online. su -
Now the disc-space should have been freed!
File system HWM
---------------
df -g
read fs;df -h fs
read dir_name;cat /sysadm/utils/ora_fsmon.`hostname`.par | grep -i $dir_name
cat /sysadm/utils/ora_fsmon.`hostname`.par | grep -i
cat /sysadm/utils/ora_fsmon.`hostname`.par
Finding a word in all files under a FS
--------------------------------------
grep
Ex: grep DATABASE_PASSWORD $(find .)
Finding file sizes in unix mountpoints
--------------------------------------
find
Easly copy file from local desktop to PUTTY
-------------------------------------------
Copy from file (Press CTRL+A and CTRL+C )
in PUTTY -
cat >
Right click the mouse
Press CTRL+D
Split file into equal size
--------------------------
split -b
Once split complete, rename the files
Eg:
split -b 1945m VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001.gz -- spliting file into 1.9G approx
root@s96ivk2d1:/mig12 : ls -ltr
total 66228304
drwxrwxrwx 2 root system 4096 Sep 23 14:48 .snapshot
-rw-r----- 1 vl6xaq01 vl6xaq01 16921180833 Oct 19 14:40 VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001.gz
-rw------- 1 vl6xaq01 vl6xaq01 0 Oct 19 15:00 nohup.out
-rw-r--r-- 1 root system 2039480320 Oct 19 20:03 xaa
-rw-r--r-- 1 root system 2039480320 Oct 19 20:05 xab
-rw-r--r-- 1 root system 2039480320 Oct 19 20:06 xac
-rw-r--r-- 1 root system 2039480320 Oct 19 20:08 xad
-rw-r--r-- 1 root system 2039480320 Oct 19 20:09 xae
-rw-r--r-- 1 root system 2039480320 Oct 19 20:11 xaf
-rw-r--r-- 1 root system 2039480320 Oct 19 20:13 xag
-rw-r--r-- 1 root system 2039480320 Oct 19 20:14 xah
-rw-r--r-- 1 root system 605338273 Oct 19 20:15 xai
root@s96ivk2d1:/mig12 :
root@s96ivk2d1:/mig12 :
root@s96ivk2d1:/mig12 : mv xaa VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_01
root@s96ivk2d1:/mig12 : mv xab VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_02
root@s96ivk2d1:/mig12 : mv xac VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_03
root@s96ivk2d1:/mig12 : mv xad VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_04
root@s96ivk2d1:/mig12 : mv xae VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_05
root@s96ivk2d1:/mig12 : mv xaf VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_06
root@s96ivk2d1:/mig12 : mv xag VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_07
root@s96ivk2d1:/mig12 : mv xah VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_08
root@s96ivk2d1:/mig12 : mv xai VL6XAQ01.0.vl6xaq01.NODE0000.CATN0000.20101019132228.001_09
To find pool serevr
===================
tail -100 /sysadm/utils/ora_omnib.log | grep -i dyn
To check the total backup for a server
======================================
root@
TSM Commands
============
Archieve to TSM - dsmc arch
Eg : dsmc arch ZU8XAP01.0.zu8xap01.NODE0000.CATN0000.20081026194320.001
Query TSM - dsmc q arch
Eg : dsmc q arch ZU8XAP01.0.zu8xap01.NODE0000.CATN0000.20081026194320.001
If those commands not working -
Archieve to TSM - dsmc back
Eg: dsmc back listener.log.01042009.Z
Query TSM - dsmc q back
Eg: dsmc q back listener.log.01042009.Z
Archive multiple files - dsmc archive "
Eg: dsmc archive "nncc*"
Query TSM - dsmc q archive "
Eg: dsmc q archive "nncc*"
dsmc ret "*S006297*" -subdir=yes /db2/tmp_logs/
Archive files under a directory
-------------------------------
dsmc arch -subdir=yes "/oracle/data1/exports/TT9416776/*" -desc=TT0011119940
dsmc q arch "/oracle/data1/exports/TT9416776/*" -desc=TT0011119940
RMAN backup schedule monitoring
===============================
As root - ps -ef | grep dsm
Eg:
root@s96hrd11:/root : ps -ef | grep dsm
root 1269888 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_leadsnt.opt
root 1274016 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_leadt.opt
root 1286228 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_omr1.opt
root 1310858 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_epwtint.opt
root 1327244 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_hrapp03i.opt
root 1331340 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_hrapp01t.opt
root 1335438 1 0 Jun 24 - 0:02 /usr/bin/dsmcad -optfile=/usr/bin/dsm_s96hrd11_hrapp01i.opt
root 9347194 9789580 38 03:18:50 - 0:47 /opt/tivoli/tsm/client/ba/bin/dsmc incremental -subdir=yes / /epeople/cntrl1/ /epeople/cntrl2/ /epeople/cntrl3/ /epeople/databases/ /epeople/log/ /epeople/offredo/ /epeople/onredom/ /epeople/onredop/ /epeople/sort/ /glockware/ /home/ /opt/ /oracle/ /root/ /sysmgmt/ /tmp/ /usr/ /var/
root 9482396 9797792 0 03:29:34 pts/1 0:00 grep dsm
dsmc q sched <-optfile>
Eg:
root@s96hrd11:/root : dsmc q sched -optfile=/usr/bin/dsm_s96hrd11_epwtint.opt
IBM Tivoli Storage Manager
Command Line Backup/Archive Client Interface
Client Version 5, Release 3, Level 4.0
Client date/time: 06/27/09 03:29:45
(c) Copyright by IBM Corporation and other(s) 1990, 2006. All Rights Reserved.
Node Name: S96HRD11_EPWTINT
Session established with server S96TSM02: AIX-RS/6000
Server Version 5, Release 5, Level 1.1
Server date/time: 06/27/09 03:29:45 Last access: 06/27/09 03:29:01
Schedule Name: ONLINE_EPWTINT
Description: schedules RMAN Onlinebackup
Schedule Style: Enhanced
Action: Command
Options:
Objects: /usr/bin/su - ora9i -c "export ORACLE_SID=epwtint;/usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh -l full -s BUOn -r 1 -o 30"
Priority: 5
Next Execution: 1 Minute
Duration: 1 Hour
Period:
Day of Week: Tuesday, Saturday
Month: Any
Day of Month: Any
Week of Month: Any
Expire: Never
ps -ef | grep /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh
Eg:
root@s96hrd11:/root : ps -ef | grep /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh
ora9i 9212104 9367796 0 03:30:06 - 0:00 /usr/bin/ksh /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh -l full -s BUOn -r 1 -o 30
root 9416958 9797792 1 03:30:49 pts/1 0:00 grep /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh
ora10g 9842854 8982722 0 03:29:07 - 0:00 /usr/bin/ksh /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh -l full -s ArchRedo -r 1
root@s96hrd11:/root : ps -ef | grep /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh
ora9i 9212104 9367796 0 03:30:06 - 0:00 /usr/bin/ksh /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh -l full -s BUOn -r 1 -o 30
root 9670860 9797792 0 03:35:53 pts/1 0:00 grep /usr/tivoli/tsm/client/oracle/scripts/oracle_tdpo.ksh
root@s96hrd11:/root :
Check the log file-
cd /opt/tivoli/tsm/client/oracle/logs
ls -ltr | grep epwtint | grep dbback | tail
Eg:
root@s96hrd11:/opt/tivoli/tsm/client/oracle/logs : ls -ltr | grep epwtint | grep dbback | tail
-rw-r--r-- 1 ora9i dba 19131 May 30 11:23 rman_out.30.05.09-03:30:06.dbbackup.epwtint.5562582
-rw-r--r-- 1 ora9i dba 19131 Jun 02 17:09 rman_out.02.06.09-03:30:11.dbbackup.epwtint.4710402
-rw-r--r-- 1 ora9i dba 19131 Jun 06 11:13 rman_out.06.06.09-03:30:09.dbbackup.epwtint.7864520
-rw-r--r-- 1 ora9i dba 19131 Jun 09 17:33 rman_out.09.06.09-03:30:16.dbbackup.epwtint.8315070
-rw-r--r-- 1 ora9i dba 19131 Jun 13 11:27 rman_out.13.06.09-03:30:04.dbbackup.epwtint.8839226
-rw-r--r-- 1 ora9i dba 6093 Jun 16 03:30 rman_out.16.06.09-03:30:10.dbbackup.epwtint.8265896
-rw-r--r-- 1 root system 489 Jun 16 19:57 rman_out.16.06.09-15:06:52.dbbackup.epwtint.8212650
-rw-r--r-- 1 ora9i dba 6111 Jun 17 16:13 rman_out.17.06.09-15:36:31.dbbackup.epwtint.9240606
-rw-r--r-- 1 ora9i dba 19131 Jun 23 19:36 rman_out.23.06.09-08:00:14.dbbackup.epwtint.4481260
-rw-r--r-- 1 ora9i dba 5456 Jun 27 03:30 rman_out.27.06.09-03:30:06.dbbackup.epwtint.9212104
tail -f
Eg:
root@s96hrd11:/opt/tivoli/tsm/client/oracle/logs : :30:06.dbbackup.epwtint.9212104 <
RMAN-08522: input datafile fno=00079 name=/epeople/databases/epwtint/dbf/pclarge01.dbf
RMAN-08522: input datafile fno=00103 name=/epeople/databases/epwtint/dbf/pswork01.dbf
RMAN-08522: input datafile fno=00126 name=/epeople/databases/epwtint/dbf/tllarge01.dbf
RMAN-08522: input datafile fno=00045 name=/epeople/databases/epwtint/dbf/eotpapp01.dbf
RMAN-08522: input datafile fno=00025 name=/epeople/databases/epwtint/dbf/eocmwrk01.dbf
RMAN-08522: input datafile fno=00029 name=/epeople/databases/epwtint/dbf/eodslrg01.dbf
RMAN-08522: input datafile fno=00034 name=/epeople/databases/epwtint/dbf/eoeilrg01.dbf
RMAN-08522: input datafile fno=00039 name=/epeople/databases/epwtint/dbf/eoiulrg01.dbf
RMAN-08522: input datafile fno=00052 name=/epeople/databases/epwtint/dbf/glapp01.dbf
RMAN-08038: channel epwtint_t1: starting piece 1 at 27-jun-2009_03:30:13
Copy directory
==============
cp -r
tar cf - ./
Example:
tar cf - ./V9.1 | ( cd /mif/DB/mifarchive/AbsBackup/20090325to20190325/DB2/s96mif0c0 ; tar xf - )
Compress directory
==================
tar -cvf
Example: tar -cvf pk6xap01_db2move.tar db2move
xxx -------------------------------------------------------------------- xxx -------------------------------------------------------------------- xxx
Linux Shell Scripting Excercises
================================
Sites: http://www.freeos.com/guides/lsst/
http://linuxgazette.net/133/cherian.html
Eg :1
-----
hostname>name.log ; vserver=`cat name.log` ; echo $vserver ; rm name.log
Eg :2
-----
ora1023@s96dbt01:/home/ora1023 : cat test.sh
echo "Enter character:"
read vchr
if [ "$vchr" = "" ]
then
echo 'Invalid!'
else
echo $vchr
fi
Eg :3
-----
uname > OSname.log
vos=`cat OSname.log`
rm OSname.log
echo 'File removed sucessfully!'
if [ "$vos" = "SunOS" ]
then
echo 'Sun Operating System'
else
echo 'Not a Sun Operating System'
fi
xxx -------------------------------------------------------------------- xxx -------------------------------------------------------------------- xxx
root@s96iuk0d0:/oracle/log/iukp/cdump : cp -rf /oracle/log/iukp/cdump/core_* /root/core
root@s96iuk0d0:/oracle/log/iukp/cdump : cd /root/core
root@s96iuk0d0:/root/core : ls -l
total 18
drwxr-x--- 2 root root 512 Feb 3 23:20 core_10403
drwxr-x--- 2 root root 512 Feb 3 23:20 core_1093
drwxr-x--- 2 root root 512 Feb 3 23:20 core_1103
drwxr-x--- 2 root root 512 Feb 3 23:20 core_11675
drwxr-x--- 2 root root 512 Feb 3 23:20 core_22041
drwxr-x--- 2 root root 512 Feb 3 23:20 core_23177
drwxr-x--- 2 root root 512 Feb 3 23:20 core_27323
drwxr-x--- 2 root root 512 Feb 3 23:21 core_28608
drwxr-x--- 2 root root 512 Feb 3 23:21 core_4117
root@s96iuk0d0:/root/core :
root@s96iuk0d0:/root : tar -cvf /root/core.tar /root/core
a /root/core/ 0K
a /root/core/core_10403/ 0K
a /root/core/core_10403/core 151478K
a /root/core/core_1093/ 0K
a /root/core/core_1093/core 28160K
a /root/core/core_1103/ 0K
a /root/core/core_1103/core 5784K
a /root/core/core_11675/ 0K
a /root/core/core_22041/ 0K
a /root/core/core_22041/core 135477K
a /root/core/core_23177/ 0K
a /root/core/core_23177/core 0K
a /root/core/core_27323/ 0K
a /root/core/core_27323/core 149837K
a /root/core/core_28608/ 0K
a /root/core/core_4117/ 0K
a /root/core/core_4117/core 138990K
root@s96iuk0d0:/root :
root@s96iuk0d0:/root :
root@s96iuk0d0:/oracle/log/iukp/cdump : mv /root/core.tar.gz .
root@s96iuk0d0:/oracle/log/iukp/cdump : bdf .
Filesystem kbytes used avail capacity Mounted on
/oracle/log 985951 595769 331025 65% /oracle/log
root@s96iuk0d0:/oracle/log/iukp/cdump :
Script to be checked -
cat /tmp/awk.scr
awk '/ORA-1109/{print x};{x=$0}' /dblogs/oft1/bdump/alert_oft1.log.1
awk '/ORA-1109/{print}' /dblogs/oft1/bdump/alert_oft1.log.1
awk '/ORA-1109/{getline;print}' /dblogs/oft1/bdump/alert_oft1.log.1
No comments:
Post a Comment