Saturday, January 24, 2009

Unix/Linux Administrative Commands For DBA

Some UNIX/Linux commands are particularly useful for administrative purpose.They help us find the Server Statistics including CPU usage,Memory Usage,Virtual Memory statistics,I/O statistics.The commands and their details are given below :

tar - Unix Backup and restore utility

tar -cvf backup-devicepath pathofsourcefiletobe archived- creates a new archive.Hyphen is optional

tar -xvf backupdevicepath archivefile - extracts the archived file.

cpio - Copy input/output command

cpio -o - cpio command with -o option copies files to standard output such as disk or tape

cpio -i - cpio command with -i option extracts file from standard input.

Usage :

cpio -o > standardtape/disk path

cpio - i <>

iostat - displays input output statistics for all the disks on our system

sar - System Activity reporter.Its a very powerful tool that offers a way to analyze how the read/write operations are occuring from disk to buffer cache and from buffer cache to disk.By using various options of sar command we can monitor disk and CPU activity,in addition to buffercache activity.

top - It is a commonly used performance monitoring tool.It shows us a little bit of information on everything such as the top CPU and memory utilization processes,the percentage of CPU time used by the top processes, and memory utilization.

glance - A system-monitoring tool in HP-UNIX.Used for monitoring memory,Disk I/O,CPU Performance

netstat - Monitor network to make sure that there are no serious traffic bottlenecks.

ps - Once tha database or any application is started in a UNIX/Linux system the primary step is to ensure that processes have been invoked. ps -efgrep process-name is a clear way to ensure that processes are running. If the output doesnt give out any ros then processes are down and systems need to be restarted again.

ssh - Secure shell. It is a Protocol used to secure communications between hosts.It encrypts the username and password.It uses private keys to authenticate user communication between hosts without a passowrd.This is useful in automating operational tasks using Shell Script,RAC installation etc.

ftp - File Transfer Protocol. It is used to upload files to a host. It needs username/password authentication.telnet - Terminal that enables us to connect to a server.rlogin - Remote login.Enables us to login remotely into a server.

rcp - Remote copy.Enables us to copy files remotely.exit - Enables us to exit a user session.crontab - Schedule shell programs and automate tasks.

ls - List the files and subdirectory in a directory.Doesnt list the hidden files.

ls -a - Lists the hidden files.some files have name like .cshrc,.loin (prefix with .). They are called as hidden files and are used for security reasons.They are not visible under normal listing.

Various types of shells - sh,ksh,bash,csh,tcsh,zsh

No comments: