Essential Linux Commands for Oracle DBA
A handy list of Linux commands every Oracle DBA should know! From system checks to database management, this guide makes your tasks simpler and faster.
# 1. System Information
uname -a # Display kernel version and system architecture
cat /etc/*release # Show OS version
uptime # System uptime
top # Show CPU and Memory usage
vmstat # Report virtual memory statistics
df -h # Check disk space usage
free -m # Display memory usage
dmesg # Display kernel-related messages
iostat # Show CPU and disk I/O stats
sar # Collect, report, and save system activity
# 2. User and Group Management
id # Display current user UID, GID
whoami # Show current user
who # List logged-in users
w # Detailed view of logged-in users
groups # List group memberships
su - <user> # Switch to another user
sudo -i # Switch to root user
passwd # Change user password
# 3. Process Management
# 4. Disk Management
df -h # Disk space usage
du -sh <dir> # Disk usage of a directory
lsblk # List all block devices
mount | grep <filesystem> # Check mounted filesystems
umount <device> # Unmount a filesystem
fdisk -l # List partitions
blkid # List UUIDs of file systems
# 5. Network Commands
ip a # Show IP address configuration
ifconfig # Network interface info
ping <hostname/IP> # Check connectivity
traceroute <hostname/IP> # Show network path
netstat -tulnp # List listening ports and processes
ss -tulnp # Replacement for netstat
dig <hostname> # Query DNS
nslookup <hostname> # DNS resolution
curl -I <URL> # Fetch HTTP headers
wget <URL> # Download file from URL
scp <file> user@host:/path # Secure copy to remote
sftp user@host # Secure FTP to remote server
# 6. File Management
ls -lh # List files with size and permissions
cd /path/to/dir # Change directory
pwd # Show current directory
cp -r <source> <dest> # Copy files/directories
mv <source> <dest> # Move/rename files
rm -rf <file/dir> # Remove files/directories
find /path -name <filename> # Find files by name
grep -r "pattern" /path # Search 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
# 7. Oracle Database Specific Commands
sqlplus "/ as sysdba" # Connect to Oracle DB as sysdba
lsnrctl status # Check 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
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 Recovery Manager (RMAN)
crsctl status resource -t # Clusterware status (RAC)
srvctl status database -d ORCL # Status of Oracle RAC DB
srvctl start database -d ORCL # Start RAC database
srvctl stop database -d ORCL # Stop RAC database
# 8. Log and Monitoring
tail -f alert_ORCL.log # Tail Oracle alert log file
vi /u01/app/oracle/diag/... # Edit Oracle log files
grep "ORA-" alert_ORCL.log # Search for ORA errors in logs
df -h | grep /u01 # Monitor Oracle DB mount point usage
cat /etc/oratab # Check Oracle instances on the system
# 9. Backup and Scheduling
crontab -l # List cron jobs
crontab -e # Edit cron jobs
rsync -av /source /dest # Sync files/directories
rman target / # RMAN for database backup
tar -cvf oracle_backup.tar /u01/app/oracle/datafiles
# 10. General System Administration
systemctl status <service> # Check service status
systemctl restart <service> # Restart a service
journalctl -xe # View system logs
history # Show command history
alias # List user-defined aliases
unalias <name> # Remove an alias
shutdown -h now # Shutdown system immediately
reboot # Reboot the system
This list contains all the essential Linux commands an Oracle DBA would need for database management, troubleshooting, and system administration.