Tools

Linux Commands for Oracle DBA

Share:
Article Summary

Key Linux commands for Oracle DBAs to manage databases, monitor systems, and handle backups efficiently.

A concise list of essential Linux commands every Oracle DBA should know to efficiently manage database servers, perform system checks, and troubleshoot issues.

System Information

uname -a                      # Show kernel version and system architecture
cat /etc/*release             # Display OS version details
uptime                        # Show system uptime and load averages
top                           # Interactive CPU and memory usage
vmstat                        # Report virtual memory and CPU stats
df -h                         # Display disk space usage in human-readable form
free -m                       # Show memory usage in MB
dmesg                         # Kernel message buffer
iostat                        # CPU and disk I/O statistics
sar                           # Collect and report system activity

User and Group Management

id                            # Display current user UID and GID
whoami                        # Show current logged-in user
who                           # List logged-in users
w                             # Detailed list of logged-in users and processes
groups                        # Display user’s group memberships
su - <user>                   # Switch to another user
sudo -i                       # Switch to root user shell
passwd                        # Change user password

Process Management

ps -ef                        # List all running processes
kill <pid>                   # Terminate process by PID
kill -9 <pid>                # Force terminate process
top                           # Real-time process monitoring

Disk Management

df -h                         # Disk space usage summary
du -sh <dir>                  # Disk usage of directory
lsblk                         # List block devices and partitions
mount | grep <filesystem>     # Show mounted filesystems
umount <device>               # Unmount filesystem
fdisk -l                      # List disk partitions
blkid                         # Show UUIDs of filesystems

Network Commands

ip a                          # Display IP addresses and interfaces
ifconfig                      # Network interface info (older tool)
ping <host>                   # Check network connectivity
traceroute <host>             # Trace network route to host
netstat -tulnp                # List listening ports and associated processes
ss -tulnp                     # Modern alternative to netstat
dig <hostname>                # DNS query
nslookup <hostname>           # DNS lookup tool
curl -I <URL>                 # Fetch HTTP headers
wget <URL>                    # Download files from URL
scp <file> user@host:/path    # Secure copy to remote server
sftp user@host                # Secure FTP session

File Management

ls -lh                        # List files with sizes and permissions
cd /path/to/dir               # Change directory
pwd                           # Show current directory path
cp -r <source> <dest>         # Copy files or directories recursively
mv <source> <dest>            # Move or rename files/directories
rm -rf <file/dir>             # Remove files or directories forcefully
find /path -name <filename>   # Search files by name
grep -r "pattern" /path       # Search recursively for a pattern in files
tar -cvf archive.tar /path    # Create tar archive
tar -xvf archive.tar          # Extract tar archive
zip -r archive.zip /path      # Create zip archive
unzip archive.zip             # Extract zip archive

Oracle Database Commands

sqlplus "/ as sysdba"         # Connect to Oracle DB as SYSDBA
lsnrctl status                # Check Oracle listener status
lsnrctl start                 # Start Oracle listener
lsnrctl stop                  # Stop Oracle listener
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1  # Set ORACLE_HOME
export PATH=$ORACLE_HOME/bin:$PATH                          # Update PATH for Oracle binaries
export ORACLE_SID=ORCL        # Set Oracle SID
tnsping <service_name>        # Test Oracle TNS connectivity
dbstart                       # Start Oracle database services
dbshut                        # Shutdown Oracle database services
rman target /                 # Connect to RMAN for backup/recovery
crsctl status resource -t     # Check RAC Clusterware resource status
srvctl status database -d ORCL # Check Oracle RAC DB status
srvctl start database -d ORCL # Start RAC database
srvctl stop database -d ORCL  # Stop RAC database

Log and Monitoring

tail -f alert_ORCL.log        # Monitor Oracle alert log in real-time
vi /u01/app/oracle/diag/...   # Edit Oracle diagnostic log files
grep "ORA-" alert_ORCL.log    # Search for ORA errors in alert log
df -h | grep /u01             # Check disk usage for Oracle mount points
cat /etc/oratab               # List Oracle instances configured on system

Backup and Scheduling

crontab -l                    # List scheduled cron jobs
crontab -e                    # Edit cron jobs
rsync -av /source /dest       # Synchronize files/directories
rman target /                 # RMAN backup and recovery utility
tar -cvf oracle_backup.tar /u01/app/oracle/datafiles  # Create backup archive

System Administration

systemctl status <service>    # Check status of a service
systemctl restart <service>   # Restart a service
journalctl -xe                # View detailed system logs
history                       # Show command history
alias                         # List defined command aliases
unalias <name>                # Remove an alias
shutdown -h now               # Shutdown system immediately
reboot                        # Reboot system

This list covers essential Linux commands for Oracle DBAs to manage databases, monitor systems, handle backups, and perform administrative tasks efficiently.

Was this helpful?

Written by

W3buddy
W3buddy

Explore W3Buddy for in-depth guides, breaking tech news, and expert analysis on AI, cybersecurity, databases, web development, and emerging technologies.