SlideShare a Scribd company logo
1 of 39
Download to read offline
ESSENTIAL
LINUX COMMANDS
DBAs
Gökhan Atıl
GÖKHAN ATIL
➤ DBA Team Lead with 15+ years of experience
➤ Oracle ACE Director (2016)

ACE (2011)
➤ 10g/11g and R12 OCP
➤ Founding Member and Vice President of TROUG
➤ Co-author of Expert Oracle Enterprise Manager 12c
➤ Blogger (since 2008) gokhanatil.com
➤ Twitter: @gokhanatil
2
INTRODUCTION
➤ This session will cover only the tools shipped with Oracle
Enterprise Linux 7 (no external repositories required).
➤ Power user tools / “root” privileges are not required.
➤ There are three main sections:
➤ Quick System Health Check (USE Method)
➤ Profilers & Tracing
➤ Other Useful Stuff
QUICK SYSTEM
HEALTH CHECK
USE (THE UTILIZATION SATURATION AND ERRORS) METHOD
➤ For every resource, check:
1. Utilization: busy time
2. Saturation: queue length or queued time
3. Errors
➤ You may check Brendan Gregg’s website: 

http://www.brendangregg.com/usemethod.html
RESOURCE
UTILIZATION (%)
Saturation
Errors
o o x o x o
CPU
RAM
Storage
Network
UPTIME
➤ Average number of processes (runnable + uninterruptable)
for the past 1, 5 and 15 minutes.
➤ Check if load is higher than CPU count.
➤ Useful to see the trend of “load”.
0
1
2
3
4
FREE
➤ Displays the total amount of free and used physical and swap
memory in the system, as well as the buffers and caches used
by the kernel.
➤ Check available memory and swap usage
➤ Information is gathered by parsing /proc/meminfo
TOP
➤ The top utility provides the same information with “uptime”
and “free”, and it also shows who’s consuming CPU
➤ Short-lived processes can be missing entirely!
TOP (CONT’D)
➤ us, user: time running un-niced user processes
➤ sy, system: time running kernel processes
➤ ni, nice: time running niced user processes
➤ id, idle: time spent in the kernel idle handler
➤ wa, IO-wait: time waiting for I/O completion
➤ hi: time spent servicing hardware interrupts
➤ si: time spent servicing software interrupts
➤ st: time stolen from this vm by the hypervisor
TOP (CONT’D)
➤ PID: Process Id
➤ PR: The priority of the process. The highest priority is -20 and the lowest is 20.
➤ NI: Nice value, is a way of setting your process' priority.
➤ VIRT: Virtual Memory Size (KiB)
➤ RES: Resident/non-swapped Memory Size (KiB)
➤ SHR: Shared Memory Size (KiB)
➤ S: Process Status ('R' = running, ’S' = sleeping, ’Z' = zombie )
➤ TIME+: Total CPU time the task has used since it started.
➤ COMMAND: Start top with the -c flag to see the full command line that launched the
process
TOP (CONT’D)
➤ Press “f” key to modify visible columns and sort order
VMSTAT
➤ vmstat reports information about processes, memory, paging,
block IO, disks and CPU activity.
➤ The first line of output shows the averages since the last
reboot.
VMSTAT (CONT’D)
➤ if the r (number of runnable processes) is generally higher
than number of CPUs, there’s possible a CPU bottleneck
➤ if the si + so (Swap-ins and swap-outs) are not zero, your
system needs more memory.
➤ If the wa (time waiting for I/O) column is high, there’s
possible a disk bottleneck.
IOSTAT
➤ iostat shows CPU and I/O statistics for devices and partitions.
iostat -x 1 100
➤ avgqu-sz: The average queue length of the requests that were
issued to the device. Higher numbers may indicate saturation!
➤ await: The average time (in milliseconds) for I/O requests.
MPSTAT
➤ mpstat command reports activities for each available
processor,
mpstat -P ALL 1 100
➤ Check for an imbalance. If some CPUs are busiest than
others, there could be a single-threaded application
PIDSTAT
➤ pidstat reports statistics for Linux tasks.
pidstat 1 100
pidstat -d 1 100
SAR (SYSTEM ACTIVITY REPORT)
➤ sar displays CPU, memory, disk I/O, and network usage, both
current and historical.
➤ It uses “/var/log/sa/saXX" file to read historical data. XX is
the day of the month.
sar -f /var/log/sa/sa16
sar -f /var/log/sa/sa16 -s 07:00:00
SAR (CONT’D)
➤ sar can be used like mpstat:
sar -P ALL 1 100
sar P ALL -f /var/log/sa/sa16
SAR (CONT’D)
➤ sar can be used like iostat:
sar -p -d 1 100
Device names may also be pretty-printed if option -p is used
SAR (CONT’D)
➤ You can use sar to check network load and errors.
sar -n DEV,EDEV 1 100
➤ Possible keywords: DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP,
EICMP, TCP, ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 and
UDP6
DMESG
➤ dmesg is used to examine the kernel ring buffer. It’s a good
place to start checking if there’s any error on the system:
dmesg -T | tail 50
TRACING &
PROFILERS
PERF
➤ perf is a performance analyzing tool in Linux, available from
Linux kernel version 2.6.31.
perf record -p XXXX sleep X
perf record program_name
perf report
➤ Performance counter summaries, including IPC:
perf stat program_name
➤ root can give access to regular users:
echo -1 > /proc/sys/kernel/perf_event_paranoid
perf top
PERF (CONT’D)
➤ Sample output of the perf report:
STRACE
➤ strace records the system calls and the signals received by a
process.
-p: attach a process
-e trace=file,process,network,signal,ipc,desc,memory
-o: write output to a file
-f: trace child processes (fork)
-tt: include time info at the beginning of each line
-c: report a summary of time, calls, and errors for each system
call
STRACE
➤ Sample output of strace (tracing oracle log writer):
strace -tt -e trace=ipc -p 3582
LTRACE
➤ ltrace records the dynamic library calls and the signals received by
a process.
➤ Its use is very similar to strace.
-p: attach a process
-o: write output to a file
-f: trace child processes (fork)
-e: {[+-][symbol_pattern][@library_pattern]}
-c: report a summary of time, calls, and errors for each system call
-tt: include time info at the beginning of each line
-S: Display system calls as well as library calls
LTRACE
➤ Sample output of ltrace (tracing oracle log writer):
ltrace -tt -e pwrite64 -p 3582
ls -l /proc/3582/fd/25[89]
PSTACK
➤ pstack attaches to an active process and prints out an
execution stack trace.
➤ You may want to check Tanel Poder’s “Advanced Oracle
Troubleshooting Guide, Part 6: Understanding Oracle
execution plans with os_explain”
OTHER
USEFUL
STUFF
FILE
➤ file tool is used to determine file type.
file sqplus oracle dbca
➤ It uses magic signature file in /usr/share/misc/magic
DD
➤ dd can copy from a file/device to another file/device.
➤ Becareful about “conv” parameter. It should be set to
“notrunc” otherwise it will truncate the output file.
dd if=/dev/zero of=sample01.dbf bs=8192 seek=132
conv=notrunc count=1
dd if=/dev/random of=/dev/null
dd if=/dev/zero of=/dev/sdc1 count=1
HEXDUMP
➤ hexdump displays file contents in hexadecimal, ascii, decimal
or octal.
dd if=datafile.dbf bs=8k skip=1 count=1 | hexdump -C
STRINGS
➤ strings prints the printable characters in files.
strings dbv
FUSER
➤ fuser displays the PIDs of processes using the specified files
or file systems.
fuser -u *
➤ fuser can also send signals (-l to list signals, -k to kill
processes)
LSOF
➤ lsof lists all open files belonging to all active processes.
lsof *
➤ you can list all open files belong to a user:
lsof -uoracle
IPCS
➤ ipcs provides information on the inter-process communication
facilities such as shared memory segments, semaphore sets
and message queues.
ipcs
LDD
➤ ldd prints the shared libraries required by each program or
shared library specified on the command line.
ldd program_name/library_name
THANK YOU FOR ATTENDING! 

ANY QUESTIONS?

More Related Content

What's hot

Configuring Oracle Enterprise Manager Cloud Control 12c for HA White Paper
Configuring Oracle Enterprise Manager Cloud Control 12c for HA White PaperConfiguring Oracle Enterprise Manager Cloud Control 12c for HA White Paper
Configuring Oracle Enterprise Manager Cloud Control 12c for HA White Paper
Leighton Nelson
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQL
Kyle Hailey
 
Managing Oracle Enterprise Manager Cloud Control 12c with Oracle Clusterware
Managing Oracle Enterprise Manager Cloud Control 12c with Oracle ClusterwareManaging Oracle Enterprise Manager Cloud Control 12c with Oracle Clusterware
Managing Oracle Enterprise Manager Cloud Control 12c with Oracle Clusterware
Leighton Nelson
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 

What's hot (20)

Configuring Oracle Enterprise Manager Cloud Control 12c for HA White Paper
Configuring Oracle Enterprise Manager Cloud Control 12c for HA White PaperConfiguring Oracle Enterprise Manager Cloud Control 12c for HA White Paper
Configuring Oracle Enterprise Manager Cloud Control 12c for HA White Paper
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
10 ways to improve your rman script
10 ways to improve your rman script10 ways to improve your rman script
10 ways to improve your rman script
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should Know
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQL
 
Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015
 
Intro to ASH
Intro to ASHIntro to ASH
Intro to ASH
 
Configuring Oracle Enterprise Manager Cloud Control 12c for High Availability
Configuring Oracle Enterprise Manager Cloud Control 12c for High AvailabilityConfiguring Oracle Enterprise Manager Cloud Control 12c for High Availability
Configuring Oracle Enterprise Manager Cloud Control 12c for High Availability
 
Developing Information Schema Plugins
Developing Information Schema PluginsDeveloping Information Schema Plugins
Developing Information Schema Plugins
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning Concept
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data mining
 
2008 Collaborate IOUG Presentation
2008 Collaborate IOUG Presentation2008 Collaborate IOUG Presentation
2008 Collaborate IOUG Presentation
 
Managing Oracle Enterprise Manager Cloud Control 12c with Oracle Clusterware
Managing Oracle Enterprise Manager Cloud Control 12c with Oracle ClusterwareManaging Oracle Enterprise Manager Cloud Control 12c with Oracle Clusterware
Managing Oracle Enterprise Manager Cloud Control 12c with Oracle Clusterware
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation
 
10053 otw
10053 otw10053 otw
10053 otw
 
Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000
 

Similar to Essential Linux Commands for DBAs

Perf stat windows
Perf stat windowsPerf stat windows
Perf stat windows
Accenture
 
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and AnalysisServers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysis
dreamwidth
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
Sidney Chen
 

Similar to Essential Linux Commands for DBAs (20)

Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Perf stat windows
Perf stat windowsPerf stat windows
Perf stat windows
 
What’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorWhat’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributor
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems Performance
 
The New Systems Performance
The New Systems PerformanceThe New Systems Performance
The New Systems Performance
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and AnalysisServers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysis
 
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
 
Hotsos Advanced Linux Tools
Hotsos Advanced Linux ToolsHotsos Advanced Linux Tools
Hotsos Advanced Linux Tools
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
 
Marian Marinov, 1H Ltd.
Marian Marinov, 1H Ltd.Marian Marinov, 1H Ltd.
Marian Marinov, 1H Ltd.
 
Performance comparison of Distributed File Systems on 1Gbit networks
Performance comparison of Distributed File Systems on 1Gbit networksPerformance comparison of Distributed File Systems on 1Gbit networks
Performance comparison of Distributed File Systems on 1Gbit networks
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)
 
linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning
 
Introduction to Java Profiling
Introduction to Java ProfilingIntroduction to Java Profiling
Introduction to Java Profiling
 
Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...
Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...
Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet
 

More from Gokhan Atil

More from Gokhan Atil (15)

Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with Python
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
SQL or noSQL - Oracle Cloud Day Istanbul
SQL or noSQL - Oracle Cloud Day IstanbulSQL or noSQL - Oracle Cloud Day Istanbul
SQL or noSQL - Oracle Cloud Day Istanbul
 
EM13c: Write Powerful Scripts with EMCLI
EM13c: Write Powerful Scripts with EMCLIEM13c: Write Powerful Scripts with EMCLI
EM13c: Write Powerful Scripts with EMCLI
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAs
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAs
 
Enterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIEnterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLI
 
EMCLI Crash Course - DOAG Germany
EMCLI Crash Course - DOAG GermanyEMCLI Crash Course - DOAG Germany
EMCLI Crash Course - DOAG Germany
 
Oracle Enterprise Manager 12c: EMCLI Crash Course
Oracle Enterprise Manager 12c: EMCLI Crash CourseOracle Enterprise Manager 12c: EMCLI Crash Course
Oracle Enterprise Manager 12c: EMCLI Crash Course
 
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yoluTROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
 
Oracle 12c Database In Memory DBA SIG
Oracle 12c Database In Memory DBA SIGOracle 12c Database In Memory DBA SIG
Oracle 12c Database In Memory DBA SIG
 
Oracle 12c Database In-Memory
Oracle 12c Database In-MemoryOracle 12c Database In-Memory
Oracle 12c Database In-Memory
 
Oracle DB Standard Edition: Başka Bir Arzunuz?
Oracle DB Standard Edition: Başka Bir Arzunuz?Oracle DB Standard Edition: Başka Bir Arzunuz?
Oracle DB Standard Edition: Başka Bir Arzunuz?
 
Enterprise Manager 12c ASH Analytics
Enterprise Manager 12c ASH AnalyticsEnterprise Manager 12c ASH Analytics
Enterprise Manager 12c ASH Analytics
 
Using APEX to Create a Mobile User Interface for Enterprise Manager 12c
Using APEX to Create a Mobile User Interface for Enterprise Manager 12cUsing APEX to Create a Mobile User Interface for Enterprise Manager 12c
Using APEX to Create a Mobile User Interface for Enterprise Manager 12c
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Recently uploaded (20)

Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 

Essential Linux Commands for DBAs

  • 2. GÖKHAN ATIL ➤ DBA Team Lead with 15+ years of experience ➤ Oracle ACE Director (2016)
 ACE (2011) ➤ 10g/11g and R12 OCP ➤ Founding Member and Vice President of TROUG ➤ Co-author of Expert Oracle Enterprise Manager 12c ➤ Blogger (since 2008) gokhanatil.com ➤ Twitter: @gokhanatil 2
  • 3. INTRODUCTION ➤ This session will cover only the tools shipped with Oracle Enterprise Linux 7 (no external repositories required). ➤ Power user tools / “root” privileges are not required. ➤ There are three main sections: ➤ Quick System Health Check (USE Method) ➤ Profilers & Tracing ➤ Other Useful Stuff
  • 5. USE (THE UTILIZATION SATURATION AND ERRORS) METHOD ➤ For every resource, check: 1. Utilization: busy time 2. Saturation: queue length or queued time 3. Errors ➤ You may check Brendan Gregg’s website: 
 http://www.brendangregg.com/usemethod.html RESOURCE UTILIZATION (%) Saturation Errors o o x o x o CPU RAM Storage Network
  • 6. UPTIME ➤ Average number of processes (runnable + uninterruptable) for the past 1, 5 and 15 minutes. ➤ Check if load is higher than CPU count. ➤ Useful to see the trend of “load”. 0 1 2 3 4
  • 7. FREE ➤ Displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. ➤ Check available memory and swap usage ➤ Information is gathered by parsing /proc/meminfo
  • 8. TOP ➤ The top utility provides the same information with “uptime” and “free”, and it also shows who’s consuming CPU ➤ Short-lived processes can be missing entirely!
  • 9. TOP (CONT’D) ➤ us, user: time running un-niced user processes ➤ sy, system: time running kernel processes ➤ ni, nice: time running niced user processes ➤ id, idle: time spent in the kernel idle handler ➤ wa, IO-wait: time waiting for I/O completion ➤ hi: time spent servicing hardware interrupts ➤ si: time spent servicing software interrupts ➤ st: time stolen from this vm by the hypervisor
  • 10. TOP (CONT’D) ➤ PID: Process Id ➤ PR: The priority of the process. The highest priority is -20 and the lowest is 20. ➤ NI: Nice value, is a way of setting your process' priority. ➤ VIRT: Virtual Memory Size (KiB) ➤ RES: Resident/non-swapped Memory Size (KiB) ➤ SHR: Shared Memory Size (KiB) ➤ S: Process Status ('R' = running, ’S' = sleeping, ’Z' = zombie ) ➤ TIME+: Total CPU time the task has used since it started. ➤ COMMAND: Start top with the -c flag to see the full command line that launched the process
  • 11. TOP (CONT’D) ➤ Press “f” key to modify visible columns and sort order
  • 12. VMSTAT ➤ vmstat reports information about processes, memory, paging, block IO, disks and CPU activity. ➤ The first line of output shows the averages since the last reboot.
  • 13. VMSTAT (CONT’D) ➤ if the r (number of runnable processes) is generally higher than number of CPUs, there’s possible a CPU bottleneck ➤ if the si + so (Swap-ins and swap-outs) are not zero, your system needs more memory. ➤ If the wa (time waiting for I/O) column is high, there’s possible a disk bottleneck.
  • 14. IOSTAT ➤ iostat shows CPU and I/O statistics for devices and partitions. iostat -x 1 100 ➤ avgqu-sz: The average queue length of the requests that were issued to the device. Higher numbers may indicate saturation! ➤ await: The average time (in milliseconds) for I/O requests.
  • 15. MPSTAT ➤ mpstat command reports activities for each available processor, mpstat -P ALL 1 100 ➤ Check for an imbalance. If some CPUs are busiest than others, there could be a single-threaded application
  • 16. PIDSTAT ➤ pidstat reports statistics for Linux tasks. pidstat 1 100 pidstat -d 1 100
  • 17. SAR (SYSTEM ACTIVITY REPORT) ➤ sar displays CPU, memory, disk I/O, and network usage, both current and historical. ➤ It uses “/var/log/sa/saXX" file to read historical data. XX is the day of the month. sar -f /var/log/sa/sa16 sar -f /var/log/sa/sa16 -s 07:00:00
  • 18. SAR (CONT’D) ➤ sar can be used like mpstat: sar -P ALL 1 100 sar P ALL -f /var/log/sa/sa16
  • 19. SAR (CONT’D) ➤ sar can be used like iostat: sar -p -d 1 100 Device names may also be pretty-printed if option -p is used
  • 20. SAR (CONT’D) ➤ You can use sar to check network load and errors. sar -n DEV,EDEV 1 100 ➤ Possible keywords: DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP, EICMP, TCP, ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 and UDP6
  • 21. DMESG ➤ dmesg is used to examine the kernel ring buffer. It’s a good place to start checking if there’s any error on the system: dmesg -T | tail 50
  • 23. PERF ➤ perf is a performance analyzing tool in Linux, available from Linux kernel version 2.6.31. perf record -p XXXX sleep X perf record program_name perf report ➤ Performance counter summaries, including IPC: perf stat program_name ➤ root can give access to regular users: echo -1 > /proc/sys/kernel/perf_event_paranoid perf top
  • 24. PERF (CONT’D) ➤ Sample output of the perf report:
  • 25. STRACE ➤ strace records the system calls and the signals received by a process. -p: attach a process -e trace=file,process,network,signal,ipc,desc,memory -o: write output to a file -f: trace child processes (fork) -tt: include time info at the beginning of each line -c: report a summary of time, calls, and errors for each system call
  • 26. STRACE ➤ Sample output of strace (tracing oracle log writer): strace -tt -e trace=ipc -p 3582
  • 27. LTRACE ➤ ltrace records the dynamic library calls and the signals received by a process. ➤ Its use is very similar to strace. -p: attach a process -o: write output to a file -f: trace child processes (fork) -e: {[+-][symbol_pattern][@library_pattern]} -c: report a summary of time, calls, and errors for each system call -tt: include time info at the beginning of each line -S: Display system calls as well as library calls
  • 28. LTRACE ➤ Sample output of ltrace (tracing oracle log writer): ltrace -tt -e pwrite64 -p 3582 ls -l /proc/3582/fd/25[89]
  • 29. PSTACK ➤ pstack attaches to an active process and prints out an execution stack trace. ➤ You may want to check Tanel Poder’s “Advanced Oracle Troubleshooting Guide, Part 6: Understanding Oracle execution plans with os_explain”
  • 31. FILE ➤ file tool is used to determine file type. file sqplus oracle dbca ➤ It uses magic signature file in /usr/share/misc/magic
  • 32. DD ➤ dd can copy from a file/device to another file/device. ➤ Becareful about “conv” parameter. It should be set to “notrunc” otherwise it will truncate the output file. dd if=/dev/zero of=sample01.dbf bs=8192 seek=132 conv=notrunc count=1 dd if=/dev/random of=/dev/null dd if=/dev/zero of=/dev/sdc1 count=1
  • 33. HEXDUMP ➤ hexdump displays file contents in hexadecimal, ascii, decimal or octal. dd if=datafile.dbf bs=8k skip=1 count=1 | hexdump -C
  • 34. STRINGS ➤ strings prints the printable characters in files. strings dbv
  • 35. FUSER ➤ fuser displays the PIDs of processes using the specified files or file systems. fuser -u * ➤ fuser can also send signals (-l to list signals, -k to kill processes)
  • 36. LSOF ➤ lsof lists all open files belonging to all active processes. lsof * ➤ you can list all open files belong to a user: lsof -uoracle
  • 37. IPCS ➤ ipcs provides information on the inter-process communication facilities such as shared memory segments, semaphore sets and message queues. ipcs
  • 38. LDD ➤ ldd prints the shared libraries required by each program or shared library specified on the command line. ldd program_name/library_name
  • 39. THANK YOU FOR ATTENDING! 
 ANY QUESTIONS?