iSelfSchooling.com - Copyright © 1999-2009 iSelfSchooling.com ||  References  |  Job Openings
    Home  | Search more...  |  FREE Online VIDEO Oracle Training 

    Oracle Syntax  | Suggestions  | Private Tutoring

  Copyright & User Agreement

Email2aFriend  | Homepage us! |  Bookmark

Services

 Vision/Mission

 Services

 Biography

 Contact Us

 FREE Training

 SQL

 PL/SQL

 Forms 

 Reports

 Other TOOLS

 Fundamentals

 Performance

 OEM

 Application Server

 Grid Control

 Articles

 Prepare for OCP

Oracle SYNTAX

 Oracle Functions

 Oracle Syntax

 Oracle 10g Syntax

  PL/SQL Syntax

UNIX and more...

 UNIX for DBAs

 LINUX for DBAs

 DB using PHP

  A+ Certification

 Basics of JAVA  

 Tips of  SEO

Finance/Jobs

 Financial Aid

 Skilled

 Oracle

 Jobs

  Magazine

More Training

 Q & Answers

 SQL-PL/SQL

 DBA

 Developer

 Important Notes

 Case Studies

 9i New Features

 10g New Features

 10g Qs/As

 Grid Control

 OracleAS # I

 OracleAS # II

  LDAP and OID

  HTTP Server

 Instructor-Led

  Virtual Hosts

 Community Sharing

More to know...

Acknowledgement**

 FREE Legal Forms

 Who is who

 Market Place

 University Directory

 Advisory Articles

 Links...

 

 

 

Subject:  Quick UNIX and LINUX notes for Oracle DBAs (Good to know)

 

More Resources by Google:

 

Quick UNIX and LINUX notes for Oracle DBAs

The following are the commands that you, as a DBA,

 do not need to know but it is good to know.

INDEX

 

Apache Web Server

 

 

 

 

 boot

cpio

devfsadm

format

groupadd

groupdel

init

isainfo

java

ln

mount

mt

 

 

 

patchadd

patchrm

prtconf

showrev

sync

symsm

sync

tar

ufsdump

ufsrestore

 

umount

uname

useradd

userdel

wget

psrinfo

Volume Manager

 

 

 

 

cpio

Copy file archives in and out.

Example:

$cd /etc                                                  #Go to directory that you want to have a backup.

$ls | cpio –oc > /u01/cpio_bkup                #Copy all files in /etc to the /u01/cpio_bkup file.

$mkdir /u01/copyhere                      #Make a directory.

$cd /u01/copyhere                      #Change directory to the created directory.

$cat /u01/cpio_bkup | cpio –ic  #Read cpio_bkup file and copy all data into the current directory.

$ls | cpio –oc > /dev/rmt/0                              #Copy all ls output files into tape device.

Back to index


devfsadm

Administration command  for  /dev  and    /devices.

Example;

$cd /dev/rmt                                          #Check the content of the /dev/rmt directory.

$devfsadm –c tape                        #A new tape device was added to the system.

$cd /dev/rmt                                          #Check the differences.

$mt status                                              #Check your magnetic tape status.

$dttape init /dev/rmt/0 –volume X                #Initialize the tape using datatools.

$obacktrack                                           #Use obacktrack if you have sqlback track.

Back to index


format

Disk partitioning and maintenance utility (Unix/Solaris only).

Example;

$format                                                   #Disk partitioning and maintenance utility.

Back to index

 


init

Initialize your server.

Example:

$su root

$init 0                                                     #Shutdown the server and have OK prompt.

$init 6                                                     #Reboot the server.

$reboot                                                  #Reboot the server.

Back to index

 


boot

On the OK prompt, you can boot.

Example:

$ok boot                                                #Boot from default disk.

$ok boot cdrom                                    #Boot from cdrom

$ok boot 2th_boot_disk                      #Boot from a different boot disk.

$ok nvalue /2th_boot_disk /…/….    #Define an alias for the second boot disk.

$ok nvstore                                           #Save the alias.

Back to index

 


groupadd

Add a Unix/Linux group account.

Example:

$more /etc/group|grep dba                         #Check to see if the group exists.

$groupadd –g dba                         #If not add a group.

$more /etc/group|grep dba                         #Check to see that the group was added.

Back to index

 


groupdel

Delete a Unix/Linux group account.

Example:

$more /etc/group|grep dba                         #Check to see if the group exists.

$groupdel dba                                      #Delete a group.

$more /etc/group|grep dba                         #Check to see that the group was deleted.

Back to index

 


isainfo

Describe instruction set architectures.

Example:

$isainfo –v                                            #Describe instruction set architectures (64bits or 32bits).

Back to index

 


java

Display java version or other information.

Example:

$java –version                                      #Display java full version.  

Back to index

 


ln

Assign a symbolic link.

Example:

$cd /u01                                                 #Change your directory.

$df –k > myfile                                      #Create a file that contains disk space allocation.

$more myfile                                          #Display the file content.

$mkdir mylinkdir                                   #Create a directory for all your links.

$ln –s /u01/myfile /u01/mylinkdir/mylink

                                                                #Create a link.

$more /u01/mylinkdir/mylink          #Display the link file content.

Back to index

 


mount

Mount a device.

Example:

$mount /dev/rmt/1 /mnt                     #Mount a second external tape device.

$mount /dev/dsk/c3t1d0s0 /mnt     #Mount a disk device.

$mount 127.0.0.1:/cdrom/cdrom0 /mnt

                                                                #Mount your disktop cdrom or if a server does not have cdrom.

Back to index

 


mt

A device status.

Example:

$mt -f /dev/rmt/0 status

Back to index

 


patchadd

Apply single patch to your O/S.

Example:

$patchadd patch_number                      #Add a single patch to your O/S.

Back to index

 


patchadd

Add multiple patches to your O/S.

Example:

$cd /../patches                                      #Change directory to downloaded patches.

$for i in ‘ls –l 1*’;do                    #For all patches that their numbers start from 9.

$patchadd $i                                         #Read each patch number.

$done                                                     #Apply patches.

Back to index

 


patchrm

Remove a single patch from your O/S.

Example:

$patchrm patch_number                      #Remove a single patch from your O/S.

Back to index

 


prtconf

Print system configuration.

Example:

$prtconf                                         #Print all system configuration.

$prtconf | grep Mem                       #Print the size of system memory.

 

$prtstat   #For memory usage

Back to index

 


psrinfo

Print process system configuration.

Example:

$psrconf -v                                                 #Print all process system configuration.

Back to index

 


showrev

Display the latest release of your applied patches.

Example:

$showrev –p |grep patch_number                #Display the latest information about your patches.

Back to index

 


symsm  

Symplicity Storage Manager Tool

Example:

$/usr/lib/symsm/bin/symsm &     #Execute the Symplicity Storage Manager Tool.

Back to index

   


sync

Synchronize your system. Do this before your shutdown.

Example:

$sync;sync;sync;halt                         #Before halting your system, synchronize the system.

Back to index

 


tar

Tar to a tape.

Example:

$cd /u01/app/oracle                    #Change to a directory that you want to tar all information to a tape.

$tar –cvf  /dev/rmt/0 .                            #Copy all the current information to a tape.

$tar –tvf /dev/rmt/0                              #Display the tape table of contents.

$tar –xvf /dev/rmt/0                              #Extract files from tape.

Back to index

 


umount

Un-mount the file system device.

Example:

$cd /                                                       #Go to route sub-directory.

$mkdir u01                                             #Make a directory.

$mount /dev/dsk/c3t1d0s5 /u01     #Mount it.

$cd /u01                                                 #Change your current directory to /u01. Add files to it.

$cd /                                                       #Go back to route directory (make sure you are not using /u01 device).

$umount                                                                #umount it.

$cd /u01                                                 #Change your current directory to /u01 (what do you see?).

Back to index

 


uname

Print name of current system.

Example:

$uname –a                                             #Print name of current system with all information (-a).

Back to index

 


ufsdump

Dump a system file incrementally.

Example:

$umount                  /u01                                        #Un-mount the device that you want to do a dump.

$ufsdump 0uf /dev/rmt/0 /dev/rdsk/c3t1d0s0

                                                                #Dump un-mounted device into a tape.

$ufsdump 0uf /u01dump /dev/rdsk/c3t1d0s0

                                                                #Dump un-mounted device into a disk.

                                                                # 0 – all files, u – update the dump record, f – file system device.

$mount /dev/rdsk/c3t1d0s0 /u01     #Mount the device that you have dumped.

#Don’t forget when you un-mount and mount a file system, change the vfstab file also if needed.

Back to index

 


ufsrestore

Restore a system file.

Example:

$mount /dev/rdsk/c3t1d0s0 /u01     #Mount the device that you want to restore a file system.

$cd /u01                                                 #Change the directory to the mounted device.

$ufsrestore tvf /dev/rmt/0                              #Show the table of contents from tape.

$ufsrestore rvf /dev/rmt/0                              #Restore recursively from tape to /u01.

                                                                # r – restore recursively, v – verbose, and f - file system device.

Back to index

 


useradd

Add a Unix/Linux user account.

Example:

$more /etc/shadow|grep oracle     #Check to see the Oracle user exists.

$userdel –r oracle                                 #Delete it and also its default directory.

$mkdir /home/app                                #Make the Oracle default directory.

$chown oracle /home/app                             #Change its owner to the ‘oracle’ user.

$useradd –u 1001 –d /home/app –s /bin/ksh oracle

                                                                #Create oracle user with default directory /home/app and

                                                                #user id 1001, password ‘pass’ and default shell (korn shell).

$more /etc/shadow|grep oracle     #Check to see the user was added.

Back to index

 


userdel

Delete a Unix/Linux user account.

Example:

$more /etc/shadow|grep oracle     #Check to see the Oracle user exists.

$userdel –r oracle                                 #Delete it and also its default directory (-r remove the default directory).

$mkdir /home/app                                #Make the Oracle default directory.

$chown oracle /home/app                             #Change its owner to the ‘oracle’ user.

$useradd –u 1001 –d /home/app –s /bin/ksh –p pass oracle

                                                                #Create oracle user with default directory /home/app and

                                                                #user id 1001, password ‘pass’ and default shell (korn shell).

$more /etc/shadow|grep oracle     #Check to see the user was added.

$userdel –r oracle                                 #Delete it and also its default directory (-r remove the default directory).

Back to index

 


SQL Backtrack

To backup your Oracle data, you may have sql-backtrack. Remember the following function.

Example:

$obacktrack                                           #Run SQL backtrack interactively.

Back to index

 


Networker

Quick and simple commands.

Example:

$/usr/bin/nsr/networker start                #Start networker.

$/usr/bin/nsr/networker stop                #Stop networker.

$/usr/sbin/nsr/nsrjb –Hev                 #Diagnose networker.

$tail /usr/logs/messages                            #Check error messages.

$tail -100 /usr/logs/daemon.log         #Check logs.

Back to index

 


Managing your disk (Unix/Solaris only):

 

Disksuite (Things to remember)

Volume Manager (Things to remember)

$metastat

$metastat –p

$metadb

(/dev/md/dsk/dxx, df –k, format)

$vxdisk list

$vxprint –ht

 

(/dev/vx/dsk/assetdg/assetdgvol04, df –k, format)

 

System Prameters

$ifconfig –a    #Display network interface configuration parameters

$arp –a    #Address resolution display and control

$drvconfig   #drvconfig - configure the /devices directory

$disks  #disks - creates /dev entries for hard disks attached to  the system

$devlinks   #devlinks - adds /dev entries for miscellaneous  devices  and pseudo-devices

 

New device:

$init 0

$ok printenv

$ok setenv auto_boot? False

$ok reset_all

$ok probe_scsi_all

$ok set auto_boot? True

$ok boot

$format

$newfs /dev/rdsk/c3t2d0s4

$newfs /dev/md/dsk/d15

$fsck /dev/md/dsk/d15

Back to index


Important Network UNIX files:

/etc/hosts

                127.0.0.1                localhost                 localhost.domain.name

 

/etc/nsswitch.dns

                hosts:                     dns, files

 

/etc/resolv.conf

                domain                   domain_name

                nameserver                155.33.222.140

                search                    domain_name

 

/etc/defaultrouter

                127.0.0.1                #Router IP address.

Back to index  


Important Network LINUX files:

Basic linux network configuration 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

======================

NETWORKING=yes

HOSTNAME=your_machine_name.saa.senate.gov

GATEWAY=192.168.0.254

 

/etc/hosts

==========

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

=========================================

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

IPADDR=192.168.0.1

NETMASK=255.255.255.0

 

/etc/resolv.conf

================

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)

 

Generic Linux documentation can always be found at: http://www.tldp.org

 

Back to index  


Important Network Information:

IP address:

Netmask:

Network:

Broadcast:

Hostname:

Gateway:

Primary DNS:

Secondary DNS:

Ternary DNS:

 

Back to index  


Important Notes to disable or enable Linux components:

 

How to disable or enable Software component in LINUX for example telnet.

First list or check to see if your software is on or off.

$chkconfig –list (you must be as root)

 

Open the "/etc/xinetd.d/telnet" file.

 You get something like this:

[oracle@linux xinetd.d]$ more telnet

# default: on

# description: The telnet server serves telnet sessions; it uses \

# unencrypted username/password pairs for authentication.

service telnet

{

        flags           = REUSE

        socket_type     = stream       

        wait            = no

        user            = root

        server          = /usr/sbin/in.telnetd

        log_on_failure  += USERID

        disable         = no

}

Change the disable parameter to "no" or "yes" in order to disable or enable the telnet session.

 

Back to index  


Apache Web Server:
What is Apache? 
Apache was originally based on code and ideas found in the most popular HTTP server of the time.. NCSA httpd 1.3 (early 1995). It has since evolved into a far superior system which can rival (and probably surpass) almost any other UNIX based HTTP server in terms of functionality, efficiency and speed. Since it began, it has been completely rewritten, and includes many new features. Apache is, as of January 1997, the most popular WWW server on the Internet.

Why the name "Apache"? 
A cute name which stuck. Apache is "A PAtCHy server". It was based on some existing code and 
a series of "patch files".


find / -name httpd.conf       #find the httpd.conf file.
cp /etc/apache/httpd.conf-sample /etc/apache/httpd.conf    #copy sample and change the httpd.conf file.
edit /etc/apache/httpd.conf if the port 80 is in used.
edit /etc/apache/jserv.properties to point to correct java version. Ex: wrapper.bin=/usr/java/bin/java

check /var/apache/logs/errors.log if you cannot start the web server.

ps -ef|grep apache  #check the web server was started.

Start and stop web server:
/usr/apache/bin/apachectl start
/usr/apache/bin/apachectl stop
/usr/apache/bin/apachectl restart

Web server version:
/usr/apache/bin/httpd -v

netstat -an | grep 80   #check the port 80 is in used.

How to reset your log files
Sooner or later, you'll want to reset your log files (access.log and error.log) because they are too big, or full of old information you don't need. access.log typically grows by 1Mb for each 10,000 requests. Most people's first attempt at replacing the logfile is to just move the logfile or remove the logfile. This doesn't work. Apache will continue writing to the logfile at the same offset as before the logfile moved. This results in