This article is to provide you all on-job commands used for oracle product support based on my 20 years of experience. I will be keep appending this document for new learning:
Key System Configuration Files
- /etc/exports – Contains file systems which may be exported to NFS clients
- /etc/fstab – Contains file systems mounted automatically at boot. Similar to /etc/vfstab for Solaris
- /etc/grub.conf – Configuration file for grub boot loader
- /etc/init.d – Control scripts that run at startup and shutdown to start/stop system processes
- /etc/inittab – Describes processes that startup at different runlevels as defined in /etc/init.d
- /etc/lilo.conf – Configuration file for lilo boot loader
- /etc/ocfs.conf – Oracle cluster file system config file
- /etc/profile.d – Default environment scripts to initialize system wide environment variables during login
- /etc/raidtab – Configuration file for raid (md) devices
- /etc/security/limits.conf – Configuration file containing resource limits for a user
- /etc/sysconfig – Directory where many files that control system configuration are stored
- /etc/sysctl.conf – Contains installation specific tunable kernel parameters (shmmax, shmmni, etc.)
- /etc/updatedb.conf – Config file for slocate (updatedb) used to index file locations for fast searching
- /etc/xinetd.d – Contains configuration files for different inet services (rsh, ftp, imap, etc.)
- /etc/X11/XF86Config – X-windows configuration file
- /proc/cpuinfo – Contains cpu count and processor info
- /proc/meminfo – Contains memory size, free memory, swap size, etc
- /proc/mdstat – Contains raid meta device information
- /proc/swaps – Contains swap information
- /proc/sys/kernel/sem – Contains current kernel semaphore settings
- /proc/sys/kernel/shmmax – Contains current kernel max shared memory settings
- /proc/sys/kernel/shmmni – Contains current kernel shared memory identifier settings
System Information Commands
- chkconfig – Updates and queries runlevel information for system services configured in /etc/rc[0-6].d directories
- chroot “directory” – Invoke a new shell, using “directory” as new root directory
- dmesg – List messages displayed during boot process
- kudzu – Detect and configure new/changed hardware
- ldd “program” – Display shared library dependencies
- lsmod – Display info about all loaded kernel modules
- lsof – List open files
- pstree -ca – Display process info in tree format
- shutdown -t 60 -r time “mesg” – Initiate shutdown at “time”, wait 60 secs between warning and kill signals, send “mesg” to users, then reboot after shutdown
- startx – Switch from text mode to X-windows mode
- strace – Trace system calls and signals, useful for debugging and troubleshooting failed system calls
File System Management Commands
- fdformat /dev/fd0H1440 – Format high density floppy
- fdisk -l – List partition table for all disk devices
- fdisk /dev/hda – Manage partition table for /dev/hda
- hdparm -i /dev/hda – Display hard drive performance parameters; useful for tuning exercises
- hdparm -i -d1 -m16 -c3 -k1 /dev/hda – Set hard drive performance parameters (dma=1, multi-sectors=16, 32 bit i/o mode=3, keep settings=1) for /dev/hda
- mkbootdisk “kernel” – Make floppy boot disk (default device /dev/fd0) for “kernel”, which must be listed in output of “ls /lib/modules” command
- mk2efs -m 1 -j /dev/hdb5 – Make ext3 file system on partition 5 for device /dev/hdb, leave 1% free for root
- mkfs.ocfs /dev/hdb1 – Create OCFS file system
- mkswap /dev/hdb1 – Create swap space on /dev/hdb1
- mount -t iso9660 /dev/cdrom /mnt/cdrom – Mount a cdrom device on /mnt/cdrom
- mount -t vfat /dev/hda9 /mnt – Mount a Windows fat32 file system for device /dev/hda9 on /mnt
- mcopy “file1” “file2” – Copy MSDOS file to/from floppy (ex: mcopy /etc/hosts a:myhost.txt)
- sftp host – Start secure ftp session as remote “user” on “host”
- swapon /dev/hdb1 – Enable swapping on /dev/hdb1
- tune2fs -L /vol2 -j /dev/hda2 – Convert ext2 file system to ext3 on device /dev/hda2, set label to /vol2
- tune2fs -l /dev/hda1 – List file system super block information for partition /dev/hda1
- umount “filesystem” – Unmount file system
Network Information Commands
- dig “domain” – Perform DNS lookup for “domain” and display results from the name server
- ifconfig -a – Display all network interfaces configured
- lsof -i – Show processes using ports
- netstat -a – Display network statistics for all ports
- netstat -rn – Display network statistics for routing tables
- tcpdump – Dump traffic on network
Package Management Commands
- rpm -qa – Query all installed packages
- rpm -qil "package" – Query package name “package”, show all info, list package files
- rpm -ivh “package” – Install new package name “package”, verbosely, show progress hash marks
- rpm -uvh “package” – Upgrade new package name “package”, verbosely, show progress hash marks
- rpm -e “package” – Erase (remove) package
- up2date – Automated install and upgrade of all or selected packages to current versions (Red Hat)
User Management Files & Commands
- $HOME/.bash_profile – executed automatically at login $HOME/.bash_logout – executed automatically at logout
- chage – Change password and expiration information
- chage -d0 – Force user to change password next login
- chsh – Change login shell
- groupadd “group” – Add new group “group”
- passwd “user” – Set password for “user” (run as root)
- passwd – Set new password for current user
- pwconv – Create /etc/shadow from /etc/passwd
- ssh host – Logon to remote host as “user” with secure shell protocol
- ulimit -a – Display all resource limits for current user
- useradd -d home_dir -g primary_group -G
- secondary_group “username” – Add user “username”
Backup, Restore, and File Transfer Commads
- curl “url” – Transfer data from or to a server using http, https, ftp, etc protocols
- scp “host:file1 file2” – Copy file1 on remote host to local file2 using secure copy
- tar -xzvf “tarfile” – Extract files from compressed tar file “tarfile”. Similar to “gzip -dc | tar xvf -”
- tar -czvf “tarfile” – Create compressed tar file of files in current directory. Similar to “tar cvf - * | gzip -dc”
- unzip “zipfile” “pattern” – Extract from compressed “zipfile” files matching “pattern” into current directory. If “pattern” is omitted, extract all files
- zip -r “zipfile” “pattern” – Create compressed “zipfile” from files/directories matching “pattern” recursively
Miscellaneous Commands
- dircolors – Setup terminal for color ls command
- import – Screen capture tool included with ImageMagick
- import -frame “filename.jpg” – Capture screen with a mouse click on the window, including window frame
- info – Documentation on Linux commands and programs
- opcontrol – Hardware performance profiler
Setting Kernel Parameters
Unlike legacy UNIX, with Linux you can quickly set kernel params without rebooting; to set values for Oracle, perform the following: (order is semmsl semmns semopm semmni for semaphores, max shared memory, shared memory identifiers, max file descriptors, min_port max_port for port range)
- echo 250 32000 100 128 > /proc/sys/kernel/sem
- echo 2147483648 > /proc/sys/kernel/shmmax
- echo 100 > /proc/sys/kernel/shmmni
- echo 65536 >/proc/sys/fs/file-max
- echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
To make the settings persistent after rebooting, add them /etc/sysctl.conf:
- kernel.sem = 250 32000 100 128
- kernel.shmmax = 2147483648
- kernel.shmmni = 100
- kernel.shmall = 2097152
- fs.file-max = 65536
- net.ipv4.ip_local_port_range = 1024 65000
Setting Process limits
- ulimit -n 65536
- ulimit -u 16384
To make the settings persistent after rebooting, add them to /etc/security/limits.conf:
- oracle soft nofile 65536
- oracle hard nofile 65536
- oracle soft nproc 16384
- oracle hard nproc 16384
Adding Interim Swap Space
Determine file system with free space to hold extra swap space. Then, perform the following (adds 1GB swap):
- dd if=/dev/zero of=tempswap bs=1k count=1048576
- chmod 600 tempswap
- mkswap tempswap
- swapon tempswap
- Remove the interim swap when it’s no longer needed:
- swapoff tempswap; rm tempswap
Adding Interim /tmp Space
Determine an ext2/ext3 file system with enough space to hold required tmp space. Then, perform the following:
- mkdir /interim_filesystem/tmp
- chgrp root /interim_filesystem/tmp
- chmod 1777 /interim_filesystem/tmp
- Before running the program that needs extra /tmp (like runInstaller for Oracle), perform the following:
- TEMP=/interim_filesystem/tmp; export TEMP
- TMPDIR=/interim_filesystem/tmp; export TMPDIR
Configuring an OCFS File System
Download rpm’s from http://oss.oracle.com/projects/ocfs and install:
- rpm -ivh ocfs*.rpm
- Next, create /etc/ocfs.conf:
- cat <<eof>>/etc/ocfs.conf
- node_name = localhost.localdomain
- ip_address = 10.0.0.1
- ip_port = 7000
- comm_voting = 1
- eof
Create the unique identification key and load OCFS the first time (boot process runs load_ocfs automatically):
- ocfs_uid_gen -c
- load_ocfs
Make an OCFS file system (choose any empty partition):
- mkfs.ocfs -b 128 -g dba -u oracle -L "/ocfstest2" –m /ocfstest2 /dev/hdg5
- Mount the new OCFS file system on /ofcstest:
- mount -t ocfs /dev/hdg5 /ocfstest
About Me
I have 20 years of thorough experience in the Information Technology industry, specializing in Oracle Database, Fusion Middleware, OBIEE, Oracle E-Business Applications, Hyperion, UPK, Oracle Cloud & Virtualization Administration using Oracle Development / Administration / Management / Training tools on different platforms across industry, including C&IP (Manufacturing, Supply Chain Planning), HCM, Financials, and TMT, with knowledge in Project Management, Application Strategy, Software Development Lifecycle (SDLC), and Application Testing (Unit, System, Integration, UAT, and Performance). I worked on number of projects, implementing custom and ERP/CRM Oracle applications and used AIM/ Macro-scope methodology Project Documentation and version control. I used IT Service Management (ITSM) guidelines and ITIL framework on projects to manage Oracle Infrastructure.
Feedback, Comments, Questions?
Please provide your valuable feedback/comments and let me know if any questions? Feel free to contact me for any ORACLE technology assistance.
Contact: +91-9930920689 | Amit.Garg@redcircle.in | Linkedin