Thursday, July 12, 2018

unix command used by DBA



Hi Friends , hope you are Doing well .
Here I going to tell you about basic check for database at unix / linux level  which are generally used by DBA .  
1)    Df-hP  :   it will give all mount point size , available size  , mounted on  and % use  .

df -hP
Filesystem                                                                         Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv                                                          7.8G  1.4G  6.1G  18% /
tmpfs                                                                              118G  1.6M  118G   1% /dev/shm
/dev/xvda1                                                                         477M  224M  224M  51% /boot
/dev/mapper/rootvg-homelv                                                          2.5G  2.1G  268M  89% /home
/dev/mapper/rootvg-tmplv                                                           9.8G  257M  9.1G   3% /tmp
/dev/mapper/rootvg-usrlv                                                           8.8G  3.1G  5.3G  37% /usr
/dev/mapper/rootvg-varlv                                                           3.9G  3.1G  645M  83% /var
/dev/mapper/Appsvg-U007                                                            197G  137G   50G  74% /u007
/dev/mapper/Redovg-U004                                                             63G   22G   38G  37% /u004

2)    Top :
 it will show you all process running on server , their memory consumption , pid, %CPU.
Also dhows load avg , total memory ,used and free memory .

$ top
top - 19:27:30 up 1 day, 20:04,  1 user,  load average: 5.70, 7.07, 8.49
Tasks: 783 total,   5 running, 778 sleeping,   0 stopped,   0 zombie
Cpu(s): 21.5%us,  2.2%sy,  0.1%ni, 75.4%id,  0.2%wa,  0.0%hi,  0.4%si,  0.3%st
Mem:  247362720k total, 241972860k used,  5389860k free,  5064440k buffers
Swap: 50327548k total,        0k used, 50327548k free, 211509480k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6315 oracle    20   0 64.4g  16g  16g R 91.6  6.9  73:32.02 oracle
25278 oracle    20   0 64.4g  16g  16g R 40.3  7.2 103:34.35 oracle
19877 oracle    20   0 64.2g  83m  77m S 16.5  0.0  22:06.73 oracle

3)    Date and  uptime :    it will show cureent date and time , uptime show server up from time

]$ date
Wed Jul 11 19:33:56 UTC 2018
[oracle@servername  ]$ uptime
 19:34:02 up 1 day, 20:10,  1 user,  load average: 8.31, 7.74, 8.25

4)    ps -ef|grep pmon :   it will check whether database is up or not also it will show how many database running on particular serever .

$ ps -ef|grep pmon
oracle   14253     1  0 Jul09 ?        00:00:24 ora_pmon_D1
oracle   18369     1  0 Jul09 ?        00:00:31 ora_pmon_D2
oracle   19779     1  0 Jul09 ?        00:00:20 ora_pmon_T1
oracle   21625     1  0 Jul10 ?        00:00:29 ora_pmon_D3
oracle   25230 17342  0 19:56 pts/0    00:00:00 grep pmon
5)     ps –ef|grep tns  :    it will show listener name and status .

$ ps -ef|grep tns
root       113     2  0 Jul09 ?        00:00:00 [netns]
oracle   23140     1  0 Jul10 ?        00:00:30 /u002/app/oracle/product/D3/11.2.0/bin/tnslsnr  D3 -inherit
oracle   23348     1  0 Jul09 ?        00:00:34 /u002/app/oracle/product/T1/12.1.0.2/bin/tnslsnr  T1 -inherit
oracle   23367     1  0 Jul09 ?        00:00:01 /u002/app/oracle/product/D1/11.2.0/bin/tnslsnr  D1 -inherit
oracle   23376     1  0 Jul09 ?        00:01:52 /u002/app/oracle/product/D2/11.2.0/bin/tnslsnr  D2 -inherit
oracle   30197 17342  0 20:01 pts/0    00:00:00 grep tns

6)    ls –lrt   :   ---   it will show all the fiels and directory listed in current dir.

]$ ls -lrt
total 4
drwxrwxrwx. 6 oracle dba 4096 May  3 20:31 oracle

7)    ps –ef|grep oracle  : -----

it will show all oracle process which are running currently   with there pid .

8)    ps –ef|grep applmgr  : ----

it will show all the application (oracle apps ) process running currently

9)    du –sh *

it will show all sub directory and files size under main directory

# du -sh
171G    .
]# du -sh *
184K    admin
12K     cfgtoollogs
14G     diag
158G    product

10)                       du -sm * | sort -rn | head -10   :

for seeing top 10 dir high space  which are consuming high space in main directory.
Note :  please run this command as a root user

# du -sm * | sort -rn | head -10
161154  product
13446   diag
1       cfgtoollogs
1       admin

11)                        find command :----

find . –name  ‘<file_name’

run this command  under main directory , it will give result o/p  of file  name along with full location on the server .

Please let me know if you are looking for any specific output command .
 











No comments:

Post a Comment