Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

Basic Unix Command for Oracle DBA

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran Dalvi
  • 11 Jun, 2019
  • 0 Comments
  • 2 Mins Read

Basic Unix Command for Oracle DBA

In this video you will understand the use of unix command for daily dba life. you will find this command useful while while working on dba environment.

1. To Cleanup trace files more than n days old

$ find $DBA/$ORACLE_SID/bdump/*.trc -mtime +n -exec rm {} \;

2. To get the value of all environment variables.

$ env

3. To find all files that end with “log” in directory /ora0/admin

$ find /ora0/admin -name “*log” -print

4. To send mails from the server

To mail the contents of message.log to xyz and abc with a subject.

$ mail -s “Messages from Me” “xyz@abc.com” “abc@xyz.com” < message.log

$ uuencode awrrpt_1_2545_2546.txt awrrpt_1_2545_2546.txt |mailx -s “awr” abc@xyz.com

5. To see errors from Alert log file

$ cd alertlogdirectory

$ grep ORA- alertSID.log

6. To see the latest 20 lines in the Alert log file

$ tail -20 alertSID.log

To see the first 20 lines in the Alert log file

$ head -20 alertSID.log

8.To remove ^M character in a file and write the new contents in another tempfile.

$ sed -e ‘s/^M$//’ filename > tempfile

9. Details of the Server

$ uname -a

10. File System Information

$ df -k (in kb)

$ df -h (in gb)

11. Last Reboot Time of the server

$ who -b

12. Memory Size on Server

$ /usr/sbin/prtconf |grep “Memory size”

13. Swap Space on Server

$ /usr/sbin/swap -s

14. Number of CPUs on server

$ /usr/sbin/psrinfo

$ cat /proc/cpuinfo | grep processor (Solaris)

15. Top CPU consuming processes

$ top

$ prstat -J (Used in Solaris)

$ topaz (Used in AIX)

16.To get the users currently logged in

$ who

To get the details of the user as whom I have logged in

$ who am i

17. To change certain terminal characteristics.

For erasing using <backspace> . In some settings, entering backspace may return garbage values. To avoid this use:

$stty erase ^?

18. Terminal and disk I/O activity and CPU utilization

$ iostat -xtc 5 2

Time: 08:46:51 PM

avg-cpu: %user %nice %sys %iowait %idle

4.26 0.00 1.45 2.87 91.42

19. To get virtual memory statistics.

$ vmstat 5

procs ———–memory———- —swap– —–io—- –system– —-cpu—-

r b swpd free buff cache si so bi bo in cs us sy id wa

0 0 8 1061668 1094224 7348112 0 0 1625 257 0 0 4 1 91 3

20. To get network-related information.

$ netstat -rn

Kernel IP routing table

Destination Gateway Genmask Flags MSS Window irtt Iface

172.168.1.3 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0

172.168.1.3 172.168.1.5 255.255.255.255 UGH 0 0 0 ppp0

172.168.1.2 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1

172.168.1.2 172.168.1.4 255.255.255.255 UGH 0 0 0 ppp1

174.12.3.32 0.0.0.0 255.255.255.240 U 0 0 0 bond0

179.254.0.0 0.0.0.0 255.255.0. U 0 0 0 bond0

0.0.0.0 164.12.3.46 0.0.0.0 UG 0 0 0 bond0

20. Displays today’s CPU activity so far

$ sar -u 5 5 (Used in Linux)

08:51:50 PM CPU %user %nice %system %iowait %idle

08:51:55 PM all 0.87 0.00 0.69 0.71 97.73

08:52:00 PM all 4.66 0.00 1.62 0.93 92.80