Wednesday, April 29, 2009

File and Directory Navigation

The "pwd" command displays the current directory:
root> pwd
/u01/app/oracle/product/9.2.0.1.0
The "ls" command lists all files and directories in the specified directory. If no location is defined it acts on the current directory. The "-a" flag lists hidden "." files. The "-l" flag lists file details.
root> ls
root> ls /u01
root> ls -al
More Examples:
ls -al | pg do a full directory listing and prompt to stop stuff whizzing off the page.
ls | wc -l count the files in the current directory.
ls -alt list files in date order
ls -alt | head -10 as above but only display the first 10
ls -l $ORACLE_HOME/reports60/printer/admin/spoolcmd.sh Verify that the spoolcmd.sh file has execute permissions
ls -s | awk '{if ($1 > 50) print $1 " " $2 }' list all files over 50 blocks in size.
ls -alq List files with hidden characters. Very useful when you cannot delete a file for an unknown reason, as sometimes a file can be created with hidden control characters. (very common when stty not set properly)
ls -1 Shows the files in a list (just the file names, this option is useful in shell scripts where the files names need to be fed into another program or command for manipulation)
ls -1h The option "-h" comes handy to display the size of the files in a human readable form.
ls -lr The parameter -r shows the output in the reverse order
ls -lR The -R operator makes the ls command execute recursively—that is, go under to the subdirectories and show those files too


The "cd" command is used to change directories:
root> cd /u01/app/oracle
The "touch" command is used to create a new empty file with the default permissions:
root> touch my.log
The "rm" command is used to delete files and directories. The "-R" flag tells the command to recurse through subdirectories.
root> rm my.log
root> rm -R /archive
The "mv" command is used to move or rename files and directories. The "." represents the current directory
root> mv [from] [to]
root> mv my.log my1.log
root> mv * /archive
root> mv /archive/* .
The "cp" command is used to copy files and directories:
root> cp [from] [to]
root> cp my.log my1.log
root> cp * /archive
root> cp /archive/* .
The "mkdir" command is used to create new directories:
root> mkdir archive
The "rmdir" command is used to delete directories:
root> rmdir archive
The "grep" command performs a search for a specified string or pattern.
ps -eaf | grep oracle Show all processes owned by oracle.

The "find" command can be used to find the location of specific files. The "/" flag represents the staring directory for the search. Wildcards such as "dbms*" can be used for the filename.
root> find / -name dbmspool.sql
root> find / -print | grep dbmspool.sql Search everywhere for the specified file
root> find . -exec grep "DISPLAY" {} \; -print | pg Search all files for the text string "DISPLAY" - takes a while to run !
Display only the lines in /etc/oratab where the lines do not (-v option; negation) start with # character (^ is a special character indicating beginning of line, similarly $ is end of line).
root> grep -v '^#' /etc/oratab
Tip for Oracle Users
Oracle produces many extraneous files: trace files, log files, dump files, and so on. Unless they are cleaned periodically, they can fill up the filesystem and bring the database to a halt.
To ensure that doesn't happen, simply search for the files with extension "trc" and remove them if they are more than three days old. A simple command does the trick:
find . -name "*.trc" -ctime +3 -exec rm -f {} \;


The "which" command can be used to find the location of an executable you are using. The "which" command searches your PATH setting for occurences of the specified executable.
oracle> which sqlplus
The "PS1"changes your prompt.
root> PS1="Diego_Master:> "
Diego_Master:>
The "wc" utility displays a count of the number of characters, words and lines in a file. The switches for this utility are:
-l print line count
-c print character count
-w print word count
root> wc -l README.txt
85 README.txt
The "more" or "cat" commands lets you display the contents of a file:
cat file1 file2 > file3 Join file1 to file2 and output to file3

The "tail" command let you see a specified number of lines from the end of the file
tail -n filename

The "head" command let you see the specified number of lines from the top of the file
head -n filename

The "diff" command displays the differences between file1 and file2. Options:
diff README.txt README2.txt
-t = ignore white spaces and tabs
-i = ignore 'case' letters (A=a)
Another option, -y, shows the same output, but side by side:
diff -y file1 file2 -W 120


The "alias" command, creates an alias to some commands. Examples:
alias ls='ls -al' Alias the command 'ls -al' to ls
alias os='echo $ORACLE_HOME' alias the command to os
Here is a list of some very useful aliases I like to define:
alias bdump='cd $ORACLE_BASE/admin/$ORACLE_SID/bdump'
alias l='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias oh='cd $ORACLE_HOME'
alias os='echo $ORACLE_SID'
alias tns='cd $ORACLE_HOME/network/admin'

The "echo" command, echo strings to screen
echo $DISPLAY display the contents of the DISPLAY variable to screen.

With the "du" and "df" commands, you can display hard disk information. (-k Use 1024 byte blocks instead of the default 512)
du Display disk usage for all directories and subdirectories under the current directory.
df -k Displays disk space free on each filesystem. Very useful.

The "ftp" comamnd Invoke the file transfer protocol file exchange program:
ftp diego.domain.com ftp to that machine (it will prompt you for a login.)
Once logged in and at the ftp prompt, you have many options:
bin Change transfer mode to binary mode (essential for moving oracle files, dmp, zip, etc).
ascii Change transfer mode to ascii mode
send myfile Transfer 'myfile' from your local machine
get fred Receive the file from the host into my local machine.
mget * Transfer all files in current directory of the host to your local machine.
!pwd Check the directory of your local machine
pwd Check current directory of host machine

The "ln" command let you create a link to a file. You use this during the Oracle Software installation
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora

The "sed" cpmmand invokes the stream editor. It's helpful to do a global search and replace on a file:
ls | sed 's/$/
/g' > my_ls.html
Place the html command
at the end of each line of the output of 'ls.' Good for formatting the ouptut of unix commands into html for cgi scripts.

The "awk" command it has its own scripting language:
For example, to display only the 6th field of the output from 'who am i.' (Field 6 is the IP address of your own terminal session / PC.) you can use:
who am i | awk '{print $6}'
This can be used to automatically set the DISPLAY environment variable for users' logins.

The "cksum" command provides a checksum of a file. It's very useful for comparing two files of the same size that you suspect are different.
cksum

The "split" command can split up a file into smaller chunks.
split -10000 bug123456.z Splits 'bug123456' into minifiles of 10000 lines each.


The "gzip" and "compress" commands allows you to compress files. The gzip command results in a compressed copy of the original file with a ".gz" extension. The gunzip command reverses this process. The compress command results in a compressed copy of the original file with a ".Z" extension. The uncompress command reverses this process:
gzip myfile
gunzip myfile.gz
compress myfile
uncompress myfile

The "rsync" is a great file copier or command to SYNC directories, Here are some examples:
Only get diffs. Do multiple times for troublesome downloads
rsync -P rsync://rsync.server.com/path/to/file file
Locally copy with rate limit. It's like nice for I/O
rsync --bwlimit=1000 fromfile tofile
Mirror web site (using compression and encryption)
rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html'
Synchronize current directory with remote one
rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/


The "ssh" command lets you connect to a remote box. The "scp" command lets you perform remote copy operations
Run command on $HOST as $USER (default command=shell)
ssh $USER@$HOST command
Run GUI command on $HOSTNAME as $USER
ssh -f -Y $USER@$HOSTNAME xeyes
Copy with permissions to $USER's home directory on $HOST
scp -p -r $USER@$HOST: file dir/
Forward connections to $HOSTNAME:8080 out to $HOST:80
ssh -g -L 8080:localhost:80 root@$HOST
Forward connections from $HOST:1434 in to imap:143
ssh -R 1434:imap:143 root@$HOST

File Permissions

The "umask" command can be used to read or set default file permissions for the current user:
root> umask 022
The umask value is subtracted from the default permissions (666) to give the final permission:
666 : Default permission
022 : - umask value
644 : final permission
The "chmod" command is used to alter file permissions after the file has been created:
root> chmod 777 *.log
Owner Group World Permission
========= ========= ========= ======================
7 (u+rwx) 7 (g+rwx) 7 (o+rwx) read + write + execute
6 (u+wx) 6 (g+wx) 6 (o+wx) write + execute
5 (u+Rx) 5 (g+Rx) 5 (o+Rx) read + execute
4 (u+r) 4 (g+r) 4 (o+r) read only
2 (u+w) 2 (g+w) 2 (o+w) write only
1 (u+x) 1 (g+x) 1 (o+x) execute only
Character eqivalents can be used in the chmod command:
root> chmod o+rwx *.log
root> chmod g+r *.log
root> chmod -Rx *.log
The "chown" command is used to change the ownership of files after creation. The "-R" flag causes the command ro recurse through any subdirectories.
root> chown -R oinstall.dba *
Finally the "chgrp" command is used to change the group to a file:
root> chgrp  group
The following example changes the ownership on every single file in current directory and lower directories to oracle (useful if someone has done an install erroneously as root.)
find . -exec chown oracle {} \; -print


OS Users Management

The "useradd" command is used to add OS users:
root> useradd -G oinstall -g dba -d /usr/users/my_user -m -s /bin/ksh my_user
  • The "-G" flag specifies the primary group.
  • The "-g" flag specifies the secondary group.
  • The "-d" flag specifies the default directory.
  • The "-m" flag creates the default directory.
  • The "-s" flag specifies the default shell.
The "usermod" command is used to modify the user settings after a user has been created:
root> usermod -s /bin/csh my_user
The "userdel" command is used to delete existing users. The "-r" flag removes the default directory.
root> userdel -r my_user
The "passwd" command is used to set, or reset, the users login password:
root> passwd my_user
The "who" command can be used to list all users who have OS connections:
root> who
root> who | head -5
root> who | tail -5
root> who | grep -i ora
root> who | wc -l
  • The "head -5" command restricts the output to the first 5 lines of the who command.
  • The "tail -5" command restricts the output to the last 5 lines of the who command.
  • The "grep -i ora" command restricts the output to lines containing "ora".
  • The "wc -l" command returns the number of lines from "who", and hence the number of connected users.


Process Management

The "ps" command lists current process information:
root> ps
root> ps -ef | grep -i ora
Specific processes can be killed by specifying the process id in the "kill" command, the -9 forces to kill that process.
root> kill -9 12345


uname and hostname

The "uname" and "hostname" commands can be used to get information about the host:
root> uname -a
Linux HPLINUX 2.4.21-20.ELsmp #1 SMP Wed Aug 18 20:46:40 EDT 2004 i686 i686 i386 GNU/Linux

root> uname -a | awk '{ print $2 }'
HPLINUX

root> hostname
HPLINUX

Some helpful commands

To enable doskey mode in Unix
set -o vi

To see errors from Alert log file

grep ORA- alertSID.log
or
cat alert_LIN1.log | grep -i ORA-

To see the name of a user from his unix id (Provided your UNIX admin keeps them!)
grep userid /etc/passwd

To see if port number 1521 is reserved for Oracle
grep 1521 /etc/services

To see the latest 20 lines in the Alert log file:
tail -20 alertSID.log

To see the first 20 lines in the Alert log file:
head -20 alertSID.log

To find a file named "whereare.you" under all sub-directories of /usr/oracle
find /usr/oracle -name whereare.you -print

To remove/delete all the files under /usr/oracle which end with .tmp
find /usr/oracle -name "*.tmp" -print -exec rm -f {} \;

Remove/Delete files older than N number of days (Useful in delete log, trace, tmp file )
find . -name ‘*.*’ -mtime +[N in days] -exec rm {} \;

To list all files under /usr/oracle which are older than a week.
find /usr/oracle -mtime +7 -print

To list all files under /usr/oracle which are modified within a week.
find /usr/oracle -mtime -7 -print -> Solaris
find . -mtime -7 -exec ls -lt {} \; -> Linux

To compress all files which end with .dmp and are more than 1 MB.
find /usr/oracle -size +1048576c -name "*.dmp" -print -exec compress {} \;

To see the space used and available on /oracle mount point
df -k /oracle

To convert the contents of a text file to UPPERCASE
tr "[a-z]" "[A-Z]" <> newfilename

To convert the contents of a text file to lowercase.
tr "[A-Z]" "[a-z]" <> newfilename

To see the oracle processes
ps -ef | grep SIDNAME

To change all occurrences of SCOTT with TIGER in a file
sed 's/SCOTT/TIGER/g' filename > newfilename

To see lines 100 to 120 of a file
head -120 filename | tail -20

To remove DOS CR/LFs (^M)
sed -e 's/^M$//' filename > tempfile

Getting Information from the OS

OS

patchlevel

memory

I/O Info

CPU Info

CPU / Memory

Sun Solaris

showrev -p

sysinfo
vmstat
/usr/sbin/prtconf
for general information + memory
/usr/sbin/psrinfo -v for CPU info

sar -d
iostat

/opt/RICHPse/bin/se
/opt/RICHPse/examples/toptool.se
sar -u
/usr/bin/mpstat

/opt/RICHPse/bin/se
/opt/RICHPse/examples/toptool.se
top
/etc/swap -l

Linux

grep MemTotal /proc/meminfo
free
vmstat 3 5
grep "model name" /proc/cpuinfo
cat /proc/cpuinfo
sar -u 2 5
sar -b
top
sar -W 5 5

HP-UX

swlist

sam



vmstat -n 2 200

AIX/RS-6000

instfix -ivqk

smit or sar







Information on RAM and CPU's
(Metalink Note 233753.1)
grep MemTotal /proc/meminfo Show RAM total seen by the system

grep "model name" /proc/cpuinfo
Show CPU(s) info
cat /proc/cpuinfo


mount | column -t List mounted filesystems on the system (and align output)


free -m (in MB)


Check Swap Activity (Metalink Note
225451.1)
/sbin/swapon -s
free -t
cat /proc/swaps


The recommended SWap size is two to three times the amount of Physical Memory for Swap space (unless the system exceeds 1 GB of Physical Memory, where two times the amount of Physical Memory for Swap space is sufficient)
Swap space in Linux is used when the amount of physical memory (RAM) is full.If the system needs more memory resources and the physical memory is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.
Swapping is one of the Unix mechanisms to accommodate the size limitation of memory by moving entire processes to disk to reclaim memory.
Paging is another Unix machanism to manage the limitations of memory. Unlike swapping, where entire processes are moved in and out of memory, paging moves only individual pages of processes to disk. Paging is not as serious a problem as swapping, as the entire program does not have to reside in memory to run. A small amount of paging may not noticeably affect the performance of a system. However, the performance of a system may degraderapidly as paging activity increases.
Swap space can have a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.
When analyzing your UNIX machine, make sure that the machine is not swapping at all and at worst paging lightly. This indicates a system with a healthy amount of memory available.


How can I enable Swap in LINUX ?
First check is Swap is enabled:
/sbin/swapon -s
Filename Type Size Used Priority
/dev/sda3 partition 2040244 453180 -1

To enable swap, check for swap entries in your /etc/fstab
grep swap /etc/fstab
/dev/sda3 swap swap defaults 0 0

And use the '/sbin/swapon -a' command to enable all Swap partitions listed in /etc/fstab.


How to add a swapfile?
Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.

At a shell prompt as root, type the following command with count being equal to the desired block size:
dd if=/dev/zero of=/data2/swapfile1 bs=1024 count=65536

Setup the swap file with the command:
/sbin/mkswap /data2/swapfile1

To enable the swap file immediately but not automatically at boot time:
/sbin/swapon /data2/swapfile

To enable it at boot time, edit /etc/fstab to include:
/data2/swapfile swap swap defaults 0 0

The next time the system boots, it will enable the new swap file.

Check Services Running and stop them if not used
Services that should be removed: r* (shell or rsh, login or rlogin, exec or rexec, rcp), telnet, ftp, sendmail, exim, postfix, printer, qmail, http, portmap, SMBD (Samba)
chkconfig --list --> Show services running and its level
chkconfig --del servicename --> Stop that service
chkconfig --level 345 servicename off --> Stop that service for level 3,4,5

Also it could be necessary to check the file /etc/inetd.conf because it has references to some services, if any service that I want to stop is there, comment that line and reboot the server or run:
/etc/init.d/inetd restart


Enable FTP and TELNET Services
cd to /etc/xinetd.d
vi wu-ftpd
Change the disable field from "yes" to "no" and save changes.
vi telnet
Change the disable field from "yes" to "no" and save changes.


Information on Network

Display network interface configuration parameters

ifconfig -a


Address resolution display and control

arp -a


Check Routes:

netstat -rn


Change network, change it's ip, mask, bcast and gateway.
The easiest way is to execute sys-unconfig.
After the process finishes power down the box and move it to the new network.
When you boot the box it will ask the appropriate questions about the network configuration

Important Network LINUX files:
Making the following gross assumptions:
Your IP is: 192.168.0.1
Your Gateway is: 192.168.0.254
Your netmask is: 255.255.255.0
Your nameservers are: 192.168.0.2, 192.168.0.3, and 192.168.0.4

/etc/sysconfig/network File
NETWORKING=yes
HOSTNAME=your_machine_name.saa.senate.gov
GATEWAY=192.168.0.254

/etc/hosts File
127.0.0.1 localhost.localdomain localhost
192.168.0.1 your_machine_name.company.com your_machine_name
192.168.0.254 your_gateway.company.com your_gateway
(You don't absolutely *need* your gateway in the hosts file, but I feel it does sometimes speed up some operations)

/etc/sysconfig/network-scripts/ifcfg-eth0 File
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.0.1
NETMASK=255.255.255.0

/etc/resolv.conf File
search gateway compay_gateway
nameserver 192.168.0.2
nameserver 192.168.0.3
nameserver 192.168.0.4
(The 'search' line is optional. You can have up to 3 'nameserver' lines,and they don't need to be inside your network)

/etc/resolv.conf File
domain domain_name
nameserver 192.168.0.1
search domain_name


Get OS File System Block Size 64 bit or 32 bit

Create a file with just 1 character on it and then perform:

du -b filename

On linux
$uname -a
Linux debian 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux
On Solaris
isainfo -b -v
/usr/bin/isainfo -kv
On AIX
$ getconf -a | grep KERN
$ file /usr/lib/boot/unix*
On HP-UX
/usr/bin/ getconf KERNEL_BITS
/usr/bin/file /stand/vmunix



OS version
  • /usr/bin/uname -s -r
  • cat /proc/version
  • cat /etc/issue

OS kernel parameters files (<note:68862.1>)
  • /sbin/sysctl -a
  • more /etc/sysctl.conf Parameter kernel.shmmax shows Shared Space, must be less than REAL Memory.
  • /usr/src/linux/include/*
  • /usr/src/linux/include/linux/shm.h for shared memory
  • /usr/src/linux/include/linux/sem.h for semaphores

Max number of semaphores sets (SEMMNI)
  • /usr/bin/ipcs -ls (max number of arrays)
  • /sbin/sysctl kernel.sem (4th & last value)
  • awk '{print $4}' /proc/sys/kernel/sem

Max number of semaphores systemwide (SEMMNS)
  • /usr/bin/ipcs -ls (max semaphores system wide)
  • /sbin/sysctl kernel.sem (2nd value)
  • awk '{print $2}' /proc/sys/kernel/sem

Max number of shared segments
  • /sbin/sysctl kernel.shmmni
  • /usr/bin/ipcs -lm (max number of segments)
  • cat /proc/sys/kernel/shmmni
Max shared segment size
  • /sbin/sysctl kernel.shmmax
  • /usr/bin/ipcs -lm (max seg size (kbytes))
  • cat /proc/sys/kernel/shmmax (max value=4Gb)
Using PMAP to determine the memory size of background processes
First, to determine the memory size, the process id (PID) of the Oracle background process must be found. This is done by issuing the following command:
ps -ef |grep smon
oracle 540 1 0 Jun 25 ? 1:55 ora_smon_DEVSOL

Thenm enter the following command:
pmap -x 540 (540 is the PID for the SMON process)
Address Kbytes Resident Shared Private Permissions Mapped File
0000000100000000 50472 23640 21336 2304 read/exec oracle
0000000103248000 712 512 368 144 read/write/exec oracle
00000001032FA000 392 208 - 208 read/write/exec [ heap ]
0000000380000000 1462272 1462272 - 1462272 read/write/exec/shared [ ism shmid=0x65 ]
FFFFFFFF7CE70000 72 72 - 72 read/write [ anon ]
FFFFFFFF7CE88000 32 16 - 16 read/write [ anon ]
FFFFFFFF7CF00000 8 8 - 8 read/write [ anon ]
FFFFFFFF7CF10000 8 8 - 8 read/write [ anon ]
FFFFFFFF7CF50000 136 128 - 128 read/write [ anon ]
FFFFFFFF7CF74000 48 40 - 40 read/write [ anon ]
FFFFFFFF7D000000 8 - - - read/write/exec [ anon ]
FFFFFFFF7D100000 16 16 8 8 read/exec libc_psr.so.1
FFFFFFFF7D200000 16 16 8 8 read/exec libmp.so.2
FFFFFFFF7D304000 8 8 - 8 read/write/exec libmp.so.2
FFFFFFFF7D400000 88 72 64 8 read/exec libm.so.1
FFFFFFFF7D516000 8 8 - 8 read/write/exec libm.so.1
FFFFFFFF7D600000 8 8 - 8 read/write/exec [ anon ]
FFFFFFFF7D700000 8 8 - 8 read/exec libkstat.so.1
FFFFFFFF7D802000 8 8 - 8 read/write/exec libkstat.so.1
FFFFFFFF7D900000 32 32 24 8 read/exec librt.so.1
FFFFFFFF7DA08000 8 8 - 8 read/write/exec librt.so.1
FFFFFFFF7DB00000 32 32 24 8 read/exec libaio.so.1
FFFFFFFF7DC08000 8 8 - 8 read/write/exec libaio.so.1
FFFFFFFF7DD00000 704 600 504 96 read/exec libc.so.1
FFFFFFFF7DEB0000 56 56 - 56 read/write/exec libc.so.1
FFFFFFFF7DEBE000 8 8 - 8 read/write/exec libc.so.1
FFFFFFFF7E000000 32 24 8 16 read/exec libgen.so.1
FFFFFFFF7E108000 8 8 - 8 read/write/exec libgen.so.1
FFFFFFFF7E200000 56 40 32 8 read/exec libsocket.so.1
FFFFFFFF7E30E000 16 16 - 16 read/write/exec libsocket.so.1
FFFFFFFF7E400000 5328 1864 1736 128 read/exec libjox9.so
FFFFFFFF7EA32000 384 288 - 288 read/write/exec libjox9.so
FFFFFFFF7EA92000 8 - - - read/write/exec libjox9.so
FFFFFFFF7EB00000 8 8 - 8 read/write/exec [ anon ]
FFFFFFFF7EC00000 656 224 216 8 read/exec libnsl.so.1
FFFFFFFF7EDA4000 56 56 - 56 read/write/exec libnsl.so.1
FFFFFFFF7EDB2000 40 - - - read/write/exec libnsl.so.1
FFFFFFFF7EE00000 32 24 8 16 read/exec libskgxn9.so
FFFFFFFF7EF06000 8 8 - 8 read/write/exec libskgxn9.so
FFFFFFFF7F000000 8 8 - 8 read/write/exec [ anon ]
FFFFFFFF7F100000 8 8 - 8 read/exec libskgxp9.so
FFFFFFFF7F200000 8 8 8 - read/write/exec libskgxp9.so
FFFFFFFF7F300000 8 8 - 8 read/exec libodmd9.so
FFFFFFFF7F400000 8 8 8 - read/write/exec libodmd9.so
FFFFFFFF7F500000 8 8 - 8 read/exec libdl.so.1
FFFFFFFF7F600000 128 128 120 8 read/exec ld.so.1
FFFFFFFF7F71E000 8 8 - 8 read/write/exec ld.so.1
FFFFFFFF7F720000 8 8 - 8 read/write/exec ld.so.1
FFFFFFFF7FFDC000 144 120 - 120 read/write [ stack ]
---------------- ------ ------ ------ ------
total Kb 1522136 1490664 24472 1466192

The private memory of this SMON process is 1466192K minus the SGA size, which is the line marked with 'shmid=' above. In this case it is 1462272K.
The calculation is as follows: 1466192K minus 1462272K is 3920K.
So, the process memory for SMON is 3920K.

General Performance

free

The free command let you identify the amoung of memory used by all the apps on the box. If the amount of memory used is bigger than the available RAM, then the box starts to swap.
If you use this command with the -m option, it will show the numbers in MB.

# free -m

total used free shared buffers cached
Mem: 1772 1654 117 0 18 618
-/+ buffers/cache: 1017 754
Swap: 1983 1065 918

Here we can see that the box has 1772 MB of RAM, currently using 1654 MB, and only 117 MB of free memory.
The next line shows the changes on the size of the cache and buffers in the memory.
Finally the third one shows the amount of swap memory that is being used.

The –t options shows you the totals at the end of the output (adds physical memory plus swap memory):
# free -m -t
total used free shared buffers cached
Mem: 1772 1644 127 0 16 613
-/+ buffers/cache: 1014 757
Swap: 1983 1065 918
Total: 3756 2709 1046

Some tips
Shows the percentage of used memory:
# free -m | grep Mem | awk '{print ($3 / $2)*100}'
98.7077

Shows the percentage of swap memory:
free -m | grep -i Swap | awk '{print ($3 / $2)*100}'


top

The top command is probably the most useful one for an Oracle DBA managing a database on Linux.
Note that unlike other commands, top does not produce an output and sits still. It refreshes the screen to display new information. So, if you just issue top and leave the screen up, the most current information is always up. To stop and exit to shell, you can press Control-C.

$ top

18:46:13 up 11 days, 21:50, 5 users, load average: 0.11, 0.19, 0.18
151 processes: 147 sleeping, 4 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 12.5% 0.0% 6.7% 0.0% 0.0% 5.3% 75.2%
Mem: 1026912k av, 999548k used, 27364k free, 0k shrd, 116104k buff
758312k actv, 145904k in_d, 16192k in_c
Swap: 2041192k av, 122224k used, 1918968k free 590140k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
451 oracle 15 0 6044 4928 4216 S 0.1 0.4 0:20 0 tnslsnr
8991 oracle 15 0 1248 1248 896 R 0.1 0.1 0:00 0 top
1 root 19 0 440 400 372 S 0.0 0.0 0:04 0 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 keventd
3 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kapmd
4 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
7 root 15 0 0 0 0 SW 0.0 0.0 0:01 0 bdflush
5 root 15 0 0 0 0 SW 0.0 0.0 0:33 0 kswapd
6 root 15 0 0 0 0 SW 0.0 0.0 0:14 0 kscand
8 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kupdated
9 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 mdrecoveryd
... output snipped ...

Let's examine the different types of information produced.

The first line: 18:46:13 up 11 days, 21:50, 5 users, load average: 0.11, 0.19, 0.18
shows the current time (18:46:13), that system has been up for 11 days; that the system has been working for 21 hours 50 seconds. The load average of the system is shown (0.11, 0.19, 0.18) for the last 1, 5 and 15 minutes respectively. (By the way, you can also get this information by issuing the uptime command.)
If the load average is not required, press the letter "l" (lowercase L); it will turn it off. To turn it back on press l again. Ideally Load average should be less than 1, otherwise the processes are fully burdened

The second line: 151 processes: 147 sleeping, 4 running, 0 zombie, 0 stopped
shows the number of processes, running, sleeping, etc.

The third and fourth lines:

CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
total 12.5% 0.0% 6.7% 0.0% 0.0% 5.3% 75.2%

show the CPU utilization details. The above line shows that user processes consume 12.5% and system consumes 6.7%. The user processes include the Oracle processes. Press "t" to turn these three lines off and on. If there are more than one CPU, you will see one line per CPU.

The next two lines:

Mem:  1026912k av, 1000688k used,  26224k free,    0k shrd,  113624k buff
758668k actv, 146872k in_d, 14460k in_c
Swap: 2041192k av, 122476k used, 1918716k free 591776k cached

show the memory available and utilized. Total memory is "1026912k av", approximately 1GB, of which only 26224k or 26MB is free. The swap space is 2GB; but it's almost not used. To turn it off and on, press "m".

The rest of the display shows the processes in a tabular format. Here is the explanation of the columns:

Column Description
PID The process ID of the process
USER The user running the process
PRI The priority of the process
NI The nice value: The higher the value, the lower the priority of the task
SIZE Memory used by this process (code+data+stack)
RSS The physical memory used by this process
SHARE The shared memory used by this process
STAT

The status of this process, shown in code. Some major status codes are:
R – Running
S –Sleeping
Z – Zombie
T – Stopped

You can also see second and third characters, which indicate:
W – Swapped out process
N – positive nice value
%CPU The percentage of CPU used by this process
%MEM The percentage of memory used by this process
TIME The total CPU time used by this process
CPU If this is a multi-processor system, this column indicates the ID of the CPU this process is running on.
COMMAND The command issued by this process

While the top is being displayed, you can press a few keys to format the display as you like. Pressing the uppercase M key sorts the output by memory usage. (Note that using lowercase m will turn the memory summary lines on or off at the top of the display.) This is very useful when you want to find out who is consuming the memory. Here is sample output:

PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
31903 oracle 15 0 75760 72M 72508 S 0.0 7.2 0:01 0 ora_smon_PRODB2
31909 oracle 15 0 68944 66M 64572 S 0.0 6.6 0:03 0 ora_mmon_PRODB2
31897 oracle 15 0 53788 49M 48652 S 0.0 4.9 0:00 0 ora_dbw0_PRODB2

Now that you learned how to interpret the output, let's see how to use command line parameters.

The most useful is -d, which indicates the delay between the screen refreshes. To refresh every second, use top -d 1.

The other useful option is -p. If you want to monitor only a few processes, not all, you can specify only those after the -p option. To monitor processes 13609, 13608 and 13554, issue:

top -p 13609 -p 13608 -p 13554

This will show results in the same format as the top command, but only those specific processes.


Tip for Oracle Users

It's probably needless to say that the top utility comes in very handy for analyzing the performance of database servers. Here is a partial top output.

20:51:14  up 11 days, 23:55,  4 users,  load average: 0.88, 0.39, 0.27
113 processes: 110 sleeping, 2 running, 1 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 1.0% 0.0% 5.6% 2.2% 0.0% 91.2% 0.0%
Mem: 1026912k av, 1008832k used, 18080k free, 0k shrd, 30064k buff
771512k actv, 141348k in_d, 13308k in_c
Swap: 2041192k av, 66776k used, 1974416k free 812652k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
16143 oracle 15 0 39280 32M 26608 D 4.0 3.2 0:02 0 oraclePRODB2...
5 root 15 0 0 0 0 SW 1.6 0.0 0:33 0 kswapd
... output snipped ...

Let's analyze the output carefully. The first thing you should notice is the "idle" column under CPU states; it's 0.0%—meaning, the CPU is completely occupied doing something.
The question is, doing what?
Move your attention to the column "system", just slightly left; it shows 5.6%. So the system itself is not doing much.
Go even more left to the column marked "user", which shows 1.0%.
Since user processes include Oracle as well, Oracle is not consuming the CPU cycles.
So, what's eating up all the CPU?
The answer lies in the same line, just to the right under the column "iowait", which indicates 91.2%. This explains it all: the CPU is waiting for IO 91.2% of the time.

So why so much IO wait? The answer lies in the display. Note the PID of the highest consuming process: 16143. You can use the following query to determine what the process is doing:

select s.sid, s.username, s.program
from v$session s, v$process p
where spid = &server_process_id
and p.addr = s.paddr
/
SID USERNAME PROGRAM
------------------- -----------------------------
159 SYS rman@prolin2 (TNS V1-V3)

The rman process is taking up the IO waits related CPU cycles. This information helps you determine the next course of action.


skill and snice

From the previous discussion you learned how to identify a CPU consuming resource. What if you find that a process is consuming a lot of CPU and memory, but you don't want to kill it? Consider the top output below:

$ top -c -p 16514

23:00:44 up 12 days, 2:04, 4 users, load average: 0.47, 0.35, 0.31
1 processes: 1 sleeping, 0 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 0.0% 0.6% 8.7% 2.2% 0.0% 88.3% 0.0%
Mem: 1026912k av, 1010476k used, 16436k free, 0k shrd, 52128k buff
766724k actv, 143128k in_d, 14264k in_c
Swap: 2041192k av, 83160k used, 1958032k free 799432k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
16514 oracle 19 4 28796 26M 20252 D N 7.0 2.5 0:03 0 oraclePRODB2...

Now that you confirmed the process 16514 is consuming a lot of memory, you can "freeze" it—but not kill it—using the skill command.

$ skill -STOP 1

After this, check the top output:

23:01:11  up 12 days,  2:05,  4 users,  load average: 1.20, 0.54, 0.38
1 processes: 0 sleeping, 0 running, 0 zombie, 1 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 2.3% 0.0% 0.3% 0.0% 0.0% 2.3% 94.8%
Mem: 1026912k av, 1008756k used, 18156k free, 0k shrd, 3976k buff
770024k actv, 143496k in_d, 12876k in_c
Swap: 2041192k av, 83152k used, 1958040k free 851200k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
16514 oracle 19 4 28796 26M 20252 T N 0.0 2.5 0:04 0 oraclePRODB2...

The CPU is now 94% idle from 0%. The process is effectively frozen. After some time, you may want to revive the process from coma:

$ skill -CONT 16514

This approach is immensely useful for temporarily freezing processes to make room for more important processes to complete.

The command is very versatile. If you want to stop all processes of the user "oracle", only one command does it all:

$ skill -STOP oracle

You can use a user, a PID, a command or terminal id as argument. The following stops all rman commands.

$ skill -STOP rman

As you can see, skill decides that argument you entered—a process ID, userid, or command—and acts appropriately. This may cause an issue in some cases, where you may have a user and a command in the same name. The best example is the "oracle" process, which is typically run by the user "oracle". So, when you want to stop the process called "oracle" and you issue:

$ skill -STOP oracle

all the processes of user "oracle" stop, including the session you may be on. To be completely unambiguous you can optionally give a new parameter to specify the type of the parameter. To stop a command called oracle, you can give:

$ skill -STOP -c oracle

The command snice is similar. Instead of stopping a process it makes its priority a lower one. First, check the top output:

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
3 root 15 0 0 0 0 RW 0.0 0.0 0:00 0 kapmd
13680 oracle 15 0 11336 10M 8820 T 0.0 1.0 0:00 0 oracle
13683 oracle 15 0 9972 9608 7788 T 0.0 0.9 0:00 0 oracle
13686 oracle 15 0 9860 9496 7676 T 0.0 0.9 0:00 0 oracle
13689 oracle 15 0 10004 9640 7820 T 0.0 0.9 0:00 0 oracle
13695 oracle 15 0 9984 9620 7800 T 0.0 0.9 0:00 0 oracle
13698 oracle 15 0 10064 9700 7884 T 0.0 0.9 0:00 0 oracle
13701 oracle 15 0 22204 21M 16940 T 0.0 2.1 0:00 0 oracle

Now, drop the priority of the processes of "oracle" by four points. Note that the higher the number, the lower the priority.

$ snice +4 -u oracle

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
16894 oracle 20 4 38904 32M 26248 D N 5.5 3.2 0:01 0 oracle

Note how the NI column (for nice values) is now 4 and the priority is now set to 20, instead of 15. This is quite useful in reducing priorities.



vmstat

This utility provides a report that covers process activity, paging, memory usage, disk I/O, and CPU usage (also you can use xosview). When analyzing your UNIX machine, make sure that the machine is not swapping at all and at worst paging lightly.

Having any processes in the b or w columns is a sign of a problem system.
Having an id of 0 is a sign that the cpu is overburdoned.
Having high values in pi and po show excessive paging.


Linux Version: $ vmstat 5 3 (Displays system statistics (5 seconds apart; 3 times))

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 329476 54880 91600 613852 0 1 4 2 0 0 1 1 3 1
0 0 329476 54560 91600 613852 0 0 0 36 118 128 25 0 74 0
0 0 329476 54564 91600 613860 0 0 1 48 127 143 25 0 74 1

  • procs (Reports the number of processes in each of the following states)
    • r : The number of processes waiting for run time
    • b : The number of processes in uninterruptible sleep. Ideally close to 0.
    • w : shows the number of potential processes that have been swapped out and written to disk. If the value is not zero, then swapping occurs and the system is short of memory.
  • memory (Reports on usage of virtual and real memory)
    • swpd : the amount of virtual memory used. (Kbytes)
    • free : Amount of free physical memory (Kbytes)
    • buff : Amount of memory used like buffer (Kbytes)
    • cache : Amount of memory used like cache (Kbytes)
    • inact: the amount of inactive memory. (-a option)
    • active: the amount of active memory. (-a option)
  • swap (Reports information about page faults and paging activity (units per second). Swap-ins and swap-outs should always be zero
    • si: Amount of memory swapped in from disk. Swap-in per second. Ideally 0
    • so: Amount of memory swapped to disk. Swap-out per second. Ideally 0
  • io
    • bi: Blocks received from a block device (blocks/s).
    • bo: Blocks sent to a block device (blocks/s).
  • system
    • in : The number of interrupts per second, including the clock.
    • cs : The number of context switches per second.
  • cpu (Reports the breakdown of percentage usage of CPU time (averaged across all CPUs)
    • us : Time spent running non-kernel code. (user time, including nice time)
    • sy : Time spent running kernel code. (system time)
    • id : Time spent idle.
    • wa:

Solaris Version
$ vmstat -S 5 3 (Displays system statistics (5 seconds apart; 3 times))

procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id
0 0 0 28872 8792 8 5 172 142 210 0 24 3 11 17 2 289 1081 201 14 6 80
0 0 0 102920 1936 1 95 193 6 302 1264 235 12 1 0 3 240 459 211 0 2 97
0 0 0 102800 1960 0 0 0 0 0 464 0 0 0 0 0 107 146 29 0 0 100

  • procs (Reports the number of processes in each of the following states)
    • r : number of processes in the run queue
    • b : number of processes blocked and waiting for resources such as disk or terminal input. (I/O, paging etc.). Ideally close to 0.
    • w : number of runnable processes, or processes swapped but in a sleep state of less than twenty seconds. If this is to high, you may need more memory.
  • memory (Reports on usage of virtual and real memory)
    • swpd : Available swap space (Kbytes)
    • free : Amount of free physical memory (Kbytes)
  • page (Reports information about page faults and paging activity (units per second)
    • re : The number of pages reclaimed.
    • mf : The number of major and minor faults.
    • pi : Kbytes paged in per second.
    • po : Kbytes paged out per second
    • fr : Kbytes freed
    • de : The amount of anticipated memory needed by processes that have recently swapped in. (Kbytes)
    • sr : The pages scanned by the page daemon. High scan rates are caused by a shortage of available memory
  • disk (lists the number of disk operations per second and can show data for up to four disks at a time)
  • faults (Reports the trap/interupt rates (per second)
    • in : number if device interrupts per second
    • sy : number of system calls
    • cs : CPU context switches
  • cpu (Reports the amount of time spent in user mode, kernel mode and idle are reported. )
    • us : user time
    • sy : system time
    • id : idle time
vmstat can also report on swapping and cache flushing. The -S adds two fields to the beginning of the paging statistics. These are si, which lists the number of pages swapped in per second, and so, which gives the number of entire processes swapped out.

The buffer memory is used to save metadata from files like i-nodes.
The cache memory is used for file data.

Here there are NO pageouts (po or so) occurring on this system. It is OK and normal to have page out (po or so) activity. You should get worried when the number of page ins (pi or si) starts rising. This indicates that you system is starting to page
There are no processes that are waiting to be run (r), blocked (b), or waiting for IO (w) in the RUN QUEUE (When a process is ready to be processed by a CPU it will be placed on the waiting line or RUN-QUEUE). You want to keep the RUN-QUEUE under 5-6 for a single CPU machine.


CPU Usage

sar

$ sar -u 10 8
The sar command reports CPU Utilization (on this case 10 seconds apart; 8 times): Nice column is the priority of that process, bigger numbers less priority
Time %usr %sys %wio %idle
11:57:31 72 28 0 0
11:57:41 70 30 0 0
11:57:51 70 30 0 0
11:58:01 68 32 0 0
11:58:11 67 33 0 0
11:58:21 65 28 0 7
11:58:31 73 27 0 0
11:58:41 69 31 0 0
Average 69 30 0 1

%usr: Percent of CPU in user mode
%sys: Percent of CPU in system mode
%wio: Percent of CPU running idle with a process waiting for block I/O
%idle: Percent of CPU that is idle

If the %idle is near zero, your CPU is overloaded. If the %iowait is large, your disks are overloaded.



Once it is established that the system has high CPU usage, the next step is to find out who is using the CPU.
Ps -fe | grep smon
or
ps -e -o pcpu -o pid -o user -o args | sort -k 1 | tail -21r
Displays the top 10 CPU users on the system.

UID PID PPID C STIME TTY TIME CMD <-- Label added for clarity.
usupport 28180 1 0 Oct 31 - 0:48 ora_smon_V734
usupport 30262 1 0 Nov 01 - 0:00 ora_smon_VKHILL
usupport 30900 1 0 Oct 14 - 9:03 ora_smon_V806
usupport 31958 1 111 Oct 24 - 3:31 ora_smon_V815 <-- Notice the C column
usupport 37986 1 0 Nov 06 - 14:00 ora_smon_V805

Here we can see a smon of the database V815 using a lot of CPU by looking at the C column which reflects the CPU units of processing that are being used.
There are 100 units per CPU so the reason why this number is above 100 is that this machine has 2 cpus.

$ ps -e -o pcpu -o pid -o user -o args | sort -k 1 | tail -21r
Displays the top 20 CPU users on the system.
%CPU PID USER COMMAND
78.1 4789 oracle ora_dbwr_DDDS2
8.5 4793 oracle ora_lgwr_DDDS2
2.4 6206 oracle oracleDDDS2 (LOCAL=NO)
0.1 4797 oracle ora_smon_DDDS2
0.1 6207 oracle oracleDDDS2 (LOCAL=NO)
etc. etc. etc. etc.

The PID column can then be matched with the SPID column on the V$PROCESS view to provide more information on the process:
SELECT a.username, a.osuser, a.program, spid, sid, a.serial#
FROM v$session a, v$process b
WHERE a.paddr = b.addr
AND spid = '&pid';


mpstat

$ mpstat 10 2
Reports per-processor statistics on Sun Solaris (10 seconds apart; 8 times):
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 6 8 0 438 237 246 85 0 0 21 8542 23 9 9 59
0 0 29 0 744 544 494 206 0 0 95 110911 65 29 6 0


Automatic Startup Scripts on Linux

Create a file in the /etc/init.d/ directory, in this case the file is called myservice, containing the commands you wish to run at startup and/or shutdown.

Use the chmod command to set the privileges to 750:
chmod 750 /etc/init.d/myservice
Link the file into the appropriate run-level script directories:
ln -s /etc/init.d/myservice /etc/rc0.d/K10myservice
ln -s /etc/init.d/myservice /etc/rc3.d/S99myservice
Associate the myservice service with the appropriate run levels:
chkconfig --level 345 dbora on
The script should now be automatically run at startup and shutdown (with "start" or "stop" as a commandline parameter) like other service initialization scripts.


CRON and & Command

Jobs in background
You can add the '&' command at the end of any command to run in background
cp * /tmp &
You can also use the "nohup" command to avoid the termination of a background job even if the shell terminates
nohup cp * /tmp &

You can use "bg" to take a job to the background. Before issuing this command, press ^Z, to suspend the process and then use bg, to put it in the background

You can use "fg" to bring a background job to foreground.

Finally, the command "jobs" will list the current jobs in the shell.

Cron Commands
Cron is a unix utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon often termed as cron jobs.
Crontab (CRON TABLE) is a file which contains the schedule of cron entries to be run and at specified times, you can invoke it with the "crontab -e" command.

syntax
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval. You can also specify a range of values.

* * * * * command to be executed
- - - - -
| | | | |
| | | | +-----> day of week (1 - 7) (monday = 1)
| | | +-----
------> month (1 - 12)
| | +--------
---------> day of month (1 - 31)
| +-----
------------------> hour (0 - 23)
+-----------------------------> min (0 - 59)


The first 5 fields can be specified using the following rules:
*       - All available values or "first-last".
3-4 - A single range representing each possible from the start to the end of the range inclusive.
1,2,5,6 - A specific list of values.
1-3,5-8 - A specific list of ranges.
0-23/2 - Every other value in the specified range.
Examples
The following entry runs a cleanup script a 01:00 each Sunday. Any output or errors from the script are piped to /dev/null to prevent a buildup of mails to root:
0 1 * * 0 /u01/app/oracle/dba/weekly_cleanup > /dev/null 2>&1


# Execute the file save.sh every day at 0.05 and send results to a log file:
5 0 * * * /home/oracle/save.sh.sh 1>>/home/
oracle/log 2>&1

#
Execute at 2:15pm the first day of each month and do not send the results:
15 14 1 * * /home/
oracle/mensual.sh 1>/dev/null 2>&1

#
Execute from Monday to Friday at 10PM
0 22 * * 1-5 shutdown -h now 1>/dev/null 2>&1

#
Execute every minute
* * * * * /home/
oracle/espia.sh


Cluster Wide CRON Jobs On Tru64

On clustered systems cron is node-specific. If you need a job to fire once per cluster, rather than once per node you need an alternative approach to the standard cron job. One approach is put forward in the HP best practices document (Using cron in a TruCluster Server Cluster), but in my opinion a more elegant solution is proposed by Jason Orendorf of HP Tru64 Unix Enterprise Team (TruCluster Clustercron).

In his solution Jason creates a file called /bin/cronrun with the following contents:
#!/bin/ksh
set -- $(/usr/sbin/cfsmgr -F raw /)
shift 12
[[ "$1" = "$(/bin/hostname -s)" ]] && exit 0
exit 1
This script returns TRUE (0) only on the node which is the CFS serving cluster_root.

All cluster wide jobs should have a crontab entry on each node of the cluster like:
5 * * * /bin/cronrun && /usr/local/bin/myjob
Although the cron jobs fire on all nodes, the "/bin/cronrun &&" part of the entry prevents the script from running on all nodes except the current CFS serving cluster_root.


NFS Mount (Sun)

The following deamons must be running for the share to be seen by a PC:
  • /usr/lib/nfs/nfsd -a
  • /usr/lib/nfs/mountd
  • /opt/SUNWpcnfs/sbin/rpc.pcnfsd
To see a list of the nfs mounted drives already present type:
exportfs
First the mount point must be shared so it can be seen by remote machines:
share -F nfs -o ro /cdrom
Next the share can be mounted on a remote machine by root using:
mkdir /cdrom#1

mount -o ro myhost:/cdrom /cdrom#1


NFS Mount (Tru64)

On the server machine:

If NFS is not currently setup do the following:
  • Application Manager -> System Admin -> Configuration -> NFS
  • Select the "Configure system as an NFS server" option.
  • Accept all defaults.
Create mount point directory:
mkdir /u04/backup
Append the following entry to the "/etc/exports" file:
/u04/backup
Make sure the correct permissions are granted on the directory:
chmod -R 777 /u04/backup
On the client machine:

If NFS is not currently setup do the following:
  • Application Manager -> System Admin -> Configuration -> NFS
  • Select the "Configure system as an NFS client" option.
  • Accept all defaults.
Create mount point directory:
mkdir /backup
Append an following entry to the "/etc/fstab" file:
nfs-server-name:/u04/backup     /backup         nfs rw,bg,intr 0 0
Finally, mount the fileset:
mount /backup
At this point you can start to use the mount point from your client machine. Thanks to Bryan Mills for his help with Tru64.


PC XStation Configuration

- Download the CygWin setup.exe from http://www.cygwin.com.
- Install, making sure to select all the X11R6 (or XFree86 in older versions) optional packages.
- If you need root access add the following entry into the /etc/securettys file on each server:
:0
- From the command promot on the PC do the following:
set PATH=PATH;c:cygwinbin;c:cygwinusrX11R6bin
XWin.exe :0 -query
- The X environment should start in a new window.

- Many Linux distributions do not start XDMCP by default. To allow XDMCP access from Cygwin edit the "/etc/X11/gdm/gdm.conf" file. Under the "[xdmcp]" section set "Enable=true".

- If you are starting any X applications during the session you will need to set the DISPLAY environment variable. Remember, you are acting as an XStation, not the server itself, so this variable must be set as follows:
DISPLAY=:0.0; export DISPLAY


Useful Profile Settings

The following .profile settings rely on the default shell for the user being set to the Korn shell (/bin/ksh).

The backspace key can be configured by adding the following entry:
stty erase "^H"
The command line history can be accessed using the [Esc][k] by adding the following entry:
set -o vi
Auto completion of paths using a double strike of the [Esc] key can be configured by adding the following entry:
set filec


Useful Files

Here are some files that may be of use:

Path Contents
/etc/passwd User settings
/etc/group Group settings for users.
/etc/hosts Hostname lookup information.
/etc/system Kernel parameters for Solaris.
/etc/sysconfigtab Kernel parameters for Tru64.

No comments:

Post a Comment