Installing Linux on Windows Using VMWare


This post is about redhat Linux 5 installation done on windows. The installation steps are basically same as installing a Linux on new server booting from a disk, but the only difference been that here I have installed VMWare in windows and created a virtual machine and then installed Linux on top of it, kind of like a virtual operating system.

Uses who wants to install Linux on a new server can skip the VMWare installation part and can proceed with Linux installation given. Others who want to use VMWare can install VMWare first on the base operating system and then proceed with Linux installation.

In this post I am going to show only the redhat linux 5 installation and you can check the VMWare installation from Oracle Base site. Oracle Base has given really good steps to install and configure VMWare for our requirement.

Once VMWare is installed and allocated required RAM and diskspace, you can proceed with following Redhat Linux 5 installation.

Linux Redhat 5 Installation

Users who has installed VMWare can start Virtual Machine and it will automatically pick the CD present in CDROM drive, that should be your 1st CD of installation of Linux or the Linux DVD or you can also use the iso image of DVD and provide that as an input to VMWare.

I have provided iso image as an input to VMWare. Use following step to provide iso image as input.

When you start the VMWare local host you will see the following hardware (shown in below fig) attached to the virtual machine

Double click on CD-ROM and change the connection setting to “Use ISO Image” as shown in below fig

Click on OK and start the virtual machine. Virtual machine will automatically detect your ISO image and show you BOOT prompt. We are now ready to install Linux.

Step 1)

When you see boot prompt, hit enter and this will kick off installation.

Step 2)

After execution of some scripts in the backend you will see a welcome screen as shown below. Click on next

Step 3)

Next screen will ask you about the language. Select the prefered language and click on next.

Step 4)

Next it will ask about the keyboard preferences. Select accordingly and click on next.

Step 5)

After clicking next, it will ask for Installation number. In case you have brought a licence from REDHAT, then you can provide the serial number provided by them. This is going to synch up the licence number along with the complete information about your system in there RHN (Redhat network database). Next time any updates come for this version and if its applicable to you then those updates will automatically get downloaded for you. Else you can skip as well, because this is not a mandatory step.

In case you skip then you will see another message, you need to skip that as well as shown below.

Step 6) Next step will ask you about partitioning of dirve. If you want to customize partitioning then you can select “Create Custom Partition” and click on next.

Step 7) You can create custom partition on next screen. Click on “New”button.

Here you can give with standard partition name or any custom name you want to create. Give the required size and format you want to use. usually by default for normal disk, we use ext3 format, which is an ext2 with journoling enabled. Click on OK. Like this you can create all the required partition. The partitioning screen will look as shown below.

Step 8) This step will ask you about the GRUB loader configuration. In my installation I want to keep it simple as of now, so I am not doing any special configuration for GRUB loader.

Step 9) Next screen will ask about the network setting. If you are connected to network, then DHCP will automatically assign IP address to your host. Optionally you can remove DHCP setting and provide a static IP to your host in some different range. In my setup I am keeping DHCP setting as it is.

Step 10) Step 11 will ask you to select the timezone you want to set for your setup. Select the required time zone. Click on next.

Step 11) Next it will ask for root password. You can set any root password you want and confirm the same. This will be your root password to administer and will have all privileges.

Step 12) Next screen will show you the additional general services that comes with redhat, you can select these if you want. Also it provides you a customization option. If you select customize now radio button as shown below, then next screen will be a customization screen and it will ask what are other applications that you want to install. You can select what ever application program you want to install with this installation. I am going for default option as my requirement doesnt need any of these application.

Step 13) This is the last screen before installation. If you proceed it will start the installation first by formatting the disk partition you have provided. You can still back out at this stage if you want to as nothing has changed till now. But if you proceed, you have no control and its going to format the partition provided by you. Click next and installation starts.

step 14) Installation !!

Approximate time for installation is around 15 mins. If the server configuration is good, it completes in 8 mins (believe me ūüôā )

After installation there are few post install steps like setting the data and time, setting firewall, setting SE Linux setting.

SE Linux is a secured Enterprise linux feature introduced in Linux 5, you can set this value to either disable which will disable this feature or you can set it to Enforcing or Permissive. We will talk about this in my future post.

Once all setup is done, it will ask you to reboot the system and after that you can login as root with your password and access this beautiful open source implementation of operating system.

Hope this helps !!

Run Levels and inittab – RHEL

Now that we have already seen the boot sequence and GRUB file for linux, lets now check what is run level and one of the important file /etc/inittab which is used during booting linux.

Run Level

Operating system like linux has several services that are running. Each service will provide some functionality to OS. Example ftp service will allow other machine to FTP from your machine. Similarly network service will allow networking functionality.

But keeping all the services running while working on only few serivce will impact performance. Some times administrator does not need all the services and just need few services for working.

For this kind of situation, linux provides different runlevel. Each run level has some specific set of services running. Example if you start your linux in run level 1, some specific set of services will get started but not all. If you boot linux in run level 2 some more services will get started over and above services from run level 1. So run level is just a way to tell OS what are all services it should start during boot time.

Linux has 7 run levels, they are given as below. These run levels are defined in a file /etc/inittab which is the file read during boot time to get the default run level set and linux will boot in that run level.

0 -> Used for shutdown. Setting this in /etc/inittab, linux wont be able to boot.
1 -> Single user mode. Linux will start in single user mode. Usually used for maintenance task.
2 -> Multiuser, without NFS.
3 -> Full multiuser mode, no X Server started so no graphical display.
4 -> unused
5 -> Starts XDisplay as well. X Server is started with all graphical display.
6 -> reboot. Do not set this value in /etc/inittab, else linux will reboot continuously.

You can check the current run level of your Linux using following command.

[chramana@ap6023fems chramana]$ /sbin/runlevel
N 3

Here it gives 2 characters which are <previous Run level> <Current Run Level>. So the current run level is 3 and previous run level is null, meaning that system started with run level 3 from the very beginning.

After having this brief idea about run level we will see the content of /etc/inittab file


This file is one of the most important file for booting. Every the entry in this file has following format each seperated by “:””

Identification tag of that line : Run level numbers : Keyword : Path of script to be executed



In the above line there is no “Run level number” after 1st “:”, that means that this command will run for all the run levels.

Following are the different entries in the file

The first entry in file is


This line decide what should be runlevel at the time of booting. Here the run level is 3, that means that system will start in run level 3 by default. If we change this run level from 3 to 5 and reboot then system will start in run level 5.


This line is for system initialization and is executed at all run level. It calls the script /etc/rc.d/rc.sysinit to initialize the system during startup.

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

These lines will carry out the task based on the run level in which we are starting the system. Depending on the run level proccessing will change.
Each of this entry will call same script /etc/rc.d/rc but will pass the arguement as run level #, depending on which run level system is booting.

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

This command is used to trap the key pressed and will be executed for all run level. If a combination of ctrl+Alt+Del key is pressed then it will shutdown the system by running /sbin/shutdown command. -t3 -r now are the arguements to this script.

pf::powerfail:/sbin/shutdown -f -h +2 “Power Failure; System Shutting Down”

The above line tells what needs to be done is a power falure is detected by the system. There are device drivers which will detect change in the UPS status when power goes off. When such condition occurs then this command will guide system for required action.
In this case its doing to display message “Power Failure; System Shutting Down” and system will do a clean shutdown using /sbin/shutdown script in 2 mins (hence +2 in script). This command will run for all run sequence.

ppr:12345:powerokwait:/sbin/shutdown -c “Power Restored; Shutdown Cancelled”

This is a power restore action. Suppose when power goes off and we have configured to run shutdown command after 10 mins (+10 option) and lets say power comes back in 9 mins, then we dont want to shutdown the system as power came back, in this case we can specify the action to be taken in this command.

x:5:respawn:/etc/X11/prefdm -nodaemon

The above command starts a X11 server in run level 5.

/etc/inittab calls several other script which initializes and configures the system at the time of starting.

We can also check which all services starts at what level using chkconfig command as shown below.

[root@ap6023fems chramana]# /sbin/chkconfig –list
xinetd          0:off   1:off   2:off   3:off   4:on    5:on    6:off
gpm             0:off   1:off   2:on    3:off   4:on    5:on    6:off
ypxfrd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
dc_client       0:off   1:off   2:off   3:off   4:off   5:off   6:off
lm_sensors      0:off   1:off   2:on    3:off   4:on    5:on    6:off
ldap            0:off   1:off   2:off   3:off   4:off   5:off   6:off
winbind         0:off   1:off   2:off   3:off   4:off   5:off   6:off
rpcidmapd       0:off   1:off   2:off   3:off   4:on    5:on    6:off
snmptrapd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
ripd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
ocfs2           0:off   1:off   2:on    3:off   4:on    5:on    6:off
sysstat         0:off   1:on    2:on    3:off   4:on    5:on    6:off
squid           0:off   1:off   2:off   3:off   4:off   5:off   6:off
messagebus      0:off   1:off   2:off   3:off   4:on    5:on    6:off
rawdevices      0:off   1:off   2:off   3:off   4:on    5:on    6:off
FreeWnn         0:off   1:off   2:off   3:off   4:off   5:off   6:off
lisa            0:off   1:off   2:off   3:off   4:off   5:off   6:off
crond           0:off   1:off   2:on    3:off   4:on    5:on    6:off
openibd         0:off   1:off   2:on    3:off   4:on    5:on    6:off
cups            0:off   1:off   2:on    3:off   4:on    5:on    6:off
ripngd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
iiim            0:off   1:off   2:on    3:off   4:on    5:on    6:off
cpuspeed        0:off   1:on    2:on    3:off   4:on    5:on    6:off
multipathd      0:off   1:off   2:off   3:off   4:off   5:off   6:off
apmd            0:off   1:off   2:on    3:off   4:on    5:on    6:off
rdisc           0:off   1:off   2:off   3:off   4:off   5:off   6:off
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
yppasswdd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
rpcgssd         0:off   1:off   2:off   3:off   4:on    5:on    6:off
irda            0:off   1:off   2:off   3:off   4:off   5:off   6:off

— output truncated —

The first column gives the service name and further column gives the status of services at different run level starting from 1 to 6. Last script that will be executed is /etc/rd.d/rc.local. So any customization can be done in this script.

You can switch off or switch on any service for that run level using following command.

chkconfig <service_name> off | on

chkconfig acpid off

This will turn off acpid service, so next time when you reboot, it wont start acpid serivce which its supposed to start at run level 4 and 5.

system-config-services is the graphical interface to chkconfig.

Same things can be done using system-config-services tool.

Hope this helps !!

RHEL 5 Boot sequence and GRUB

Change is inevitable !!!

Having worked on Apps and database administration, its time to broaden the scope. I will be discussing few topics on RHEL (RedHat Entrprise Linux) system administration. Hope this will help beginners to gain knowledge about the most matured open source operating system available in the world.

Lets have a very quick review of how the Linux boots. Here are the very brief steps.

1) When a PC is booted it starts running a BIOS program which is a memory resident program on an EEPROM integrated circuit. The BIOS program will eventually try to read the first sector on a booting media such as a hard or floppy drive. The boot sector contains a small program that the BIOS will load and attempt to pass run control to. This program will attempt to read the operating system from the disk and run it.

2) The small program containing in the boot sector that BIOS will load and attempt to pass control to is called bootloader. This is a small program residing in the 1st sector of primary partition. Primary partition by default is always /boot. This directory will have all files required for bootup.

The boot loader program is present in 2 stages in Linux.

Stage 1: Small stage and resides in MBR (Master boot record) or boot sector. This is the once we were taking above – A small program residing in the 1st sector of primary partition /boot.

Stage 2: This is the complete bootup program present in /boot partiton and is called from first stage.

So 1st stage is present in MBR and just called for stage 2.

This MBR sector is 512 bytes size. The first 446 bytes contains the GRUB program (1st stage).

3) GRUB program reads the configuration file /boot/grub/grub.conf during boot time. Since this file is present in /boot partition, this partition should be present in file system that GRUB will understand, because it has to read the file before OS starts. So /boot mount point should be formated with either ext2 or ext3.

We will discuss about GRUB file shortly after finishing this brief booting sequence steps.

So once control comes to GRUB program it executes and you will see a red spashing windown comes up which gives the countdown in seconds like

Booting up Redhat Enterprise Linux in 5..4..3.. Secs

Now before the conuntdown ends, you can press either space or enter. Once you press that, you will see a table on a screen with list of operating systems present in that server. Example if you have installed Windows initially and then you installed Linux this table will show both OS in the option.

But to get this list of OS you need to enter space or enter, else it will bootup the default operating system which will be Linux.

This showing up of operating system list can be controlled by parameter hiddenmenu present in GRUB config file. We will see this in a short while. Also you can control the time for which it should countdown (timeout parameter in GRUB file).

GRUB will load the specific kernel into the RAM (which kernel to load is passed to GRUB in its script) and uncompress the kernel program in RAM. Once it uncompresses, the control is taken over by kernel and job of GRUB script ends here.

4) The kernel initialization files generates output which may not be possible to see on screen as it scrolls quickly but can be seen in log message file /var/log/dmesg which contains the snapsot of these kernel messages taken just after control is passed to init.

Many packages and device drivers present in kernel program are called. Device drivers will check all there respective hardware devices if they are available. If successful in locating devices, the driver will initialize and usually log output to kernel message buffer.

kernel of Linux is made light weight and hence will load only the required module and packages. But if some of the modules also needs to be loaded along with the kernel, its not a good idea to make it a part of kernel. Instead in redhat those additional modules are included in initrd file, which is then temporarily mounted by kernel on a RAM disk to make modules available for initialization process. This file initrd is password as one of the arguement in GRUB file for loading the kernel. We will see this arguement when we see GRUB file.

After all essential drivers are loaded, kernel will mount the root filesystem in read-only mode so that no process while booting should make any changes to any file on disk.

The first process is then created and loaded and control is passed from kernel to that process. This first process that gets created is called “init”. This process is having PID=1 and its the initialization process. This will intialize the system.

5) Init process created above will read its configuration file /etc/inittab. This file stores the information like initial run level, system initialization script, run level specific scripts, trap certain key sequences etc.
We will discuss about this file in my next post when I will explain run levels.

The final file that is run in boot sequence is /etc/rc.d/rc.local

So if we have to make any customization or call a custom script, we can call from this file. Example if we want to start a database when our server boots up we can add a script in /etc/rc.d/rc.local to start a database.

Having a brief idea about boot sequence for Linux, lets see the content of GRUB config file


The GRUB file in RHEL is present in /boot/grub/grub.conf

Following is the content of this file

# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-version.img
title Enterprise (2.6.9-
root (sd0,0)
kernel /vmlinuz-2.6.9- ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-
title Enterprise-smp (2.6.9-
root (sd0,0)
kernel /vmlinuz-2.6.9- ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-
title Enterprise-up (2.6.9-
root (sd0,0)
kernel /vmlinuz-2.6.9- ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-

lets understand meaning of each parameter here.

default -> This gives the default operating system to be booted in case the user is not giving any choice. Example if there are 2 OS installed on a server (lets say Linux and Windows, linux with number 0 and windows with number 1) then default=0 will boot Linux by default. The number is decided by the sequence in which these OS are listed in grub.conf above.

If we see the lines starting with “title”, these are the list of OS installed on server and this list (only the title) will be displayed at the time of booting when control goes from BIOS to GRUB. Since its present in grub.conf 1st stage of bootloader program will display this OS list.

In above file default=0 will pick “Enterprise (2.6.9-” OS by default.

timeout -> This gives the time for which countdown will continue or time for which the list of OS should be displayed before taking default option. Example in out case timeout=5 means it will show the option for 5 seconds.

splashimage -> This option gives a red spashing window of redhat linux while showing the list of OS or while booting. If you remove this file it will show a black window.

hiddenmenu -> This options will hide the list of OS installed on server. It will only show the countdown. If you press enter or space (as explained previously in point 3 of boot sequence) then it will show the list of OS. If you remove this option by default while booting it will show the list of OS installed.

title -> As explained just now these are the title to be shown during booting from where you can select. You can change title to anything that you want. Example “My OS”. This will show “My OS” as one of the option during booting.

root (sd0,0) -> This tells us that the boot loader program is present in 1st disk (sd0 indicate 1st hard disk) and 1st partition (,0 indicates 1st partition). So here we are telling where exactly is the bootloader program.

kernel /vmlinuz-2.6.9- ro root=LABEL=/ rhgb quiet

kernel is a parameter, /vmlinuz-2.6.9- is a value -> This is the name of kernel file to be used.

ro -> opens the filesystem in readonly mode during booting. If we remove this arguement it will open the filesystem in read write mode.

rhgb -> This is redhar graphical boot. This parameters gives a graphical progress bar while booting. If we remove this then it will give a traditional black window with many [ OK ] messages.

root=LABEL=/ -> This gives the location of root directory where all the installation has happened. this is usaully /. We can also give device name directly example in my case the device name is /dev/sda2. So we can give root=/dev/sda2
This will also work.

quiet -> This will hide details while booting up and will show only few message ehgb mode or in traditional mode. Only few [ OK ] messages will be displayed corresponding to services that are getting started. Else if we remove this parameter many more detailed messages will be displayed.

initrd /initrd-2.6.9- -> This gives the extended modules which we want to load while booting. As I explained that not all modules are part of kernel, in order to keep it light. So if additional extended modules needs to be intalled then we need to give this file as input.

My next post will be in run levels and understanding /etc/inittab file. Happy reading !!

Hope this helps !!

Cloning Oracle AS10g

This post is about cloning an Oracle Application Server 10g R3. This was based on one of our requirement to clone AS10g instance. I have carried out those steps and sharing the same. Our instance was a simple J2EE & Webcache installation.

Release we used was oracle AS 10g R3 (

Cloning AS10g instance (only mid tier) consists of following simple steps

  1. Pre-Cloning
  2. Cloning
  3. Post-Cloning

Pre-Cloning Steps:

At the source, you run the script called This is a Perl script that prepares the source for cloning. It takes a snapshot of the information required for cloning.

During this phase, parses files in the source Oracle home to extract and store required values and backs up required files.

Then, you tar the Oracle home directories.

Example in our case:

-bash-3.00$ $ORACLE_HOME/perl/bin/perl ORACLE_HOME=$ORACLE_HOME
Can’t locate in @INC (@INC contains: /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl .) at line 59.
BEGIN failed–compilation aborted at line 59.

-bash-3.00$ export PERL5LIB=$ORACLE_HOME/perl/lib/5.8.3/i686-linux-thread-multi:$ORACLE_HOME/perl/lib/5.8.3:$ORACLE_HOME/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/
-bash-3.00$ $ORACLE_HOME/perl/bin/perl ORACLE_HOME=$ORACLE_HOME

Clone log file location: /slot/ems2261/oracle/product/10.1.3/OracleAS_1/clone/logs/clone1219226546.log
Error log file location: /slot/ems2261/oracle/product/10.1.3/OracleAS_1/clone/logs/error1219226546.log
Wed Aug 20 03:02:26 2008  INFO: Starting with the Prepare Clone operation at the source
Wed Aug 20 03:02:26 2008  INFO: The temp directory being used is /tmp
Wed Aug 20 03:02:26 2008  INFO: The prepare clone operation completed successfully.

Once Pre-Cloning is done, you can tar the complete software installation file and ftp the same to target host.


Cloning step is to be done on target host. You can untar the tar file you created and FTPed to target host. Then you need run on target side.

On the target host, you might face a problem regarding the inventory. If /etc/oraInst.loc file is pointing to some inventory and you dont have permission to that inventory then it will throw the error.

-bash-3.00$ perl $ORACLE_HOME/clone/bin/ ORACLE_HOME=/slot/ems2599/oracle/product/10.1.3/OracleAS_1 -invPtrLoc $HOME/oraInst.loc ORACLE_HOME_NAME=ias_oracle_home -instance OAS -oc4jadmin_old_password dmtra123 -oc4jadmin_new_password dmtra123 -silent



Tue Aug 19 05:05:59 2008  INFO: backing up the dms.conf for instances.
Tue Aug 19 05:05:59 2008  INFO: backing up the httpd.conf for instances.
Tue Aug 19 05:05:59 2008  INFO: backing up the oracle_apache.conf for instances.
Tue Aug 19 05:05:59 2008  INFO: backing up the mod_oc4j.conf for instances.
Tue Aug 19 05:05:59 2008  INFO: backing up the ssl.conf for instances.
Tue Aug 19 05:05:59 2008  INFO: Done with the PreClone operation
You do not have sufficient permissions to access the inventory ‘/slot/ems2400/oracle/oraInventory’. Installation cannot continue. Make sure that you have read/write permissions to the inventory
directory and restart the installer.: Permission denied
Tue Aug 19 05:06:00 2008¬† INFO: Starting Oracle Universal Installer…

Tue Aug 19 05:06:00 2008  INFO: No pre-requisite checks found in oraparam.ini, no system pre-requ
Tue Aug 19 05:06:00 2008  ERROR: Error occured invoking OUI in the clone mode. Exiting with error
code 65280
Tue Aug 19 05:06:00 2008¬† ERROR: ………………..(START) Printing contents of file /tmp/silen
Tue Aug 19 05:06:00 2008¬† ERROR: ………………..(END) Printing contents of file /tmp/silentI

In this case you need to set the local inventory before stating the cloning. This can be done by editing the file present in ORACLE_HOME/clone/ias/config location.

In, you will find a line clone_command_line= -silent

Append -invptrloc <Local path for oraInst.loc>


clone_command_line= -silent -invptrloc /slot/ems2599/oracle/oraInst.loc

Once this is done, save the file and run the above clone command again.

perl $ORACLE_HOME/clone/bin/ ORACLE_HOME=/slot/ems2599/oracle/product/10.1.3/OracleAS_1 ORACLE_HOME_NAME=ias_oracle_home -instance dmntra4Pro -oc4jadmin_old_password dmtra123 -oc4jadmin_new_password dmtra123



Wed Aug 20 00:13:26 2008  INFO: Final Status:
Wed Aug 20 00:13:26 2008  INFO: ==============
Wed Aug 20 00:13:26 2008  INFO: The clone operation completed successfully.

This completes the clone for AS10g.


The postinstallation configuration assistants are not designed to be run again at clone time. Consequently, some of the instance-specific configuration files that should be updated by the configuration assistants are not updated at the end of the Oracle Universal Installer cloning session. Instead, Oracle has created a set of post-cloning scripts that update those files to bring the cloned home to a working state.

For more detail refer to Oracle Documentation on Post cloning steps

Hope this helps !!


Oracle Documentation

OPATCH Utility (Oracle RDBMS Patching)


This post has been written on request of one of regular visitor of my blog (Altaaf). This post is all about Oracle Patching Utility (OPATCH) and various options that can be used along with Opatch.

We will begin the discussion by knowing what exactly is Opatch?

– OPatch is a java based utility that allow the application and rolling back of interim patches to an Oracle product. The program has sub-commands that may take arguments. The program requires Java(JVM) to be present on the current system.OPatch expects users to have commands such as fuser, jar, ar and make on Unix platforms and jar on Windows platforms to be available in their PATH.

Opatch Details

How to check the Opatch version?

-bash-3.00$ ./opatch version
Invoking OPatch

OPatch Version:

OPatch succeeded.

How to know which version is the correct version of Opatch for your RDBMS home?

You can verify whether the Opatch version for your RDBMS release is correct or not using metalink note ID 357221.1.

This note ID gives the copatibilities between OPatch version and RDBMS version.

How to get the latest version of OPatch?

You can download the latest version of OPatch from metalink using following URL.

In the release dropdown you can select the OPatch release that you want to download based on your RDBMS version. Please read the README.txt before applying the patch.

What is Oracle Database Inventory and where it is located?

Oracle Inventory is the location or the place where all the information about an Oracle Home is stored and maintained. When ever we install an RDBMS Oracle Home, a new inventory gets created. Applying any new patch to Oracle Home will update the invnrtory for that Oracle Home and record the details for the patch applied. This inventory is in the form of XML files.

The location of inventory is defined in a file called oraInst.loc. The path for this file is provided while installing Oracle Home. If we dont supply any path, the is file will be present at central location /etc/oraInst.loc. Also we can have a central inventory if its not used by any other oracle installation. If the central inventory is used by previous Oracle installation we can create local inventory. The content of oraInst.loc file is as shown below.

-bash-3.00$ cd $ORACLE_HOME
-bash-3.00$ cat oraInst.loc

Here “inventory_loc” gives the location of Inventory directory where as inst_group gives the name of the group which is the owner of this inventory.

How to create Local Inventory?

You can create local inventory at any location while installing Oracle Home. You need to use -invPtrLoc variable along with runInstaller command and give the location of oraInst.loc. Otherwise the default path assumed for oraInst.loc is /etc/oraInst.loc.

./runInstaller -invPtrLoc /slot/ems2029/appmgr/apps/tech_st/10.1.2/oraInst.loc

After the installation starts it will ask for location of oraInventory directory and group which should own it. It will make entry of these into oraInst.loc file.

Having know the above information about opatch, now we will move to details about using opatch and various options available.

Opatch help

You can get all the options using opatch -help

-bash-3.00$ ./opatch -help
Invoking OPatch

Oracle Interim Patch Installer version
Copyright (c) 2007, Oracle Corporation.  All rights reserved.

Usage: opatch [ -help ] [ -r[eport] ] [ command ]

command := apply

<global_arguments> := -help       Displays the help message for the command.
-report     Print the actions without executing.

‘opatch -help’
‘opatch apply -help’
‘opatch lsinventory -help’
‘opatch prereq -help’
‘opatch rollback -help’
‘opatch util -help’

OPatch succeeded.

You can get specific help for any command of opatch using opatch <command> -help. Example opatch apply -help.

Applying single patch using opatch

1. You MUST read the Readme.txt file included in opatch file, look for any prereq. steps/ post installation steps or and DB related changes. Also, make sure that you have the correct opatch version required by this patch.
2.Make sure you have a good backup of database.
3. Make a note of all Invalid objects in the database prior to the patch.
4. Shutdown All the Oracle Processes running from that Oracle Home , including the Listener and Database instance, Management agent etc.
5. You MUST Backup your oracle Home and Inventory

tar cvf – $ORACLE_HOME $ORACLE_HOME/oraInventory | gzip > Backup_Software_Version.tar.gz

6. Unzip the patch in $ORACLE_HOME/patches

If you are applying a single intrim patch to oracle home, then change the location to the directory of that patch and then invoke following command.

Example if I need to apply patch 6972343 to RDBMS Oracle Home

-bash-3.00$ cd 6972343
-bash-3.00$ pwd
-bash-3.00$ ls
etc  files  README.txt
$ORACLE_HOME/OPatch/opatch apply

If you have created local inventory then you need to give the correct path for local inventory stored in oraInst.loc. If you have updated /etc/oraInst.loc with correct location of your inventory, then above command will work, If not you can give the correct location by giving local oraInst.loc file.

$ORACLE_HOME/OPatch/opatch apply -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc

Remember that when we are applying patch, patch number is NOT provided as an input to opatch command. So we have to to be in the directory of patch since opatch will pick the patch files from current directory.

Rolling back a patch

In case if a patch did not fix the issue or if you has applied wrong patch to oracle home, you can always rollback the patch using following comamnd.

opatch rollback -id <Patch Number>

Applying bundle patches

Some times if you have to apply bundle patch having many patches, example lets say you want to a bundle patch 6778860 ( BUNDLED PATCH FOR EBS 11I)) containing many other patches to RDBMS home, OPatch provides a facility to apply many patches to RDBMS home using a single comamnd. Following command should be used for applying bundle patches.

Download the patch and extract the same. You will see many directories (one for each patch) inside the main patch directory. Execute following command to apply all patches.

$ORACLE_HOME/OPatch/opatch util NApply -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc

NApply -> Will apply all patches to RDBMS home.

You can also use -phBaseDir to point to the directory where bundle patch is installed. So you can run opatch command from any location

$ORACLE_HOME/OPatch/opatch util NApply -phBaseDir /slot/ems2029/oracle/db/tech_st/11.1.0/patches/6778860 -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc

You can also apply specific patches using NApply

opatch util napply <patch_location> -id 1,2,3 -skip_subset -skip_duplicate

This will apply patches 1, 2, and 3 which are under < the patch_location> directory. OPatch will skip duplicate patches and subset patches (patches under <patch_location> that are subsets of patches installed in the ORACLE_HOME)

You can see all the options for NApply using following help command.

$ORACLE_HOME/OPatch/opatch util NApply -help

Query the inventory for patches applied

We can query the inventory to check various components installed for database as well as to check various patches applied to database. Use following command to get a minimum information from inventory about patches applied and components installed.

$ORACLE_HOME/OPatch/opatch lsinventory -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc

Patch  5763576      : applied on Wed May 28 03:20:53 PDT 2008
Created on 6 Feb 2008, 02:26:04 hrs PST8PDT
Bugs fixed:

If you are using central inventory then -invPtrLoc variable is not required.

You can also get the detailed view of inventory using following command. In case of detail information it gives which are the files that this patch have touched.

$ORACLE_HOME/OPatch/opatch lsinventory -detail -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc

Patch  6318357      : applied on Wed May 28 03:33:27 PDT 2008
Created on 4 Dec 2007, 22:02:16 hrs PST8PDT
Bugs fixed:
Files Touched:
udjvmrm.sql –> ORACLE_HOME/javavm/install/udjvmrm.sql
Patch Location in Inventory:
Patch Location in Storage area:

Which options are installed in Oracle Home?

You can check the options installed in RDBMS home using above command. The options installed will be listed at the start of output.
Example: $ORACLE_HOME/OPatch/opatch lsinventory -detail -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc

The complete output of this command can be seen at this location.

Opatch Log files

Log file for Opatch utility can be found at $ORACLE_HOME/cfgtoollogs/opatch

Advanced Option for OPatch

Here are some of the advanced options of OPatch utility.


It is used to propagate/remove files/directories to/from remote nodes using files under ORACLE_HOME/.patch_storage/<ID>/rac/*.

The directories listed in copy_dirs.txt will be copied to remote nodes.
The files listed in copy_files.txt wil be copied to remote nodes.
The directories listed in remove_dirs.txt will be deleted from remote nodes.
The files listed in remove_files.txt will be deleted from remote nodes.
This is used where RAC setup is present.


It is used to clean up ‘, make.txt’ files and ‘rac, scratch, backup’ directories in the ORACLE_HOME/.patch_storage directory. If -ps option is used, then it cleans the above specified areas only for that patch, else for all patches under ORACLE_HOME/.patch_storage. You will be still able to rollback patches after this cleanup.
Example: opatch util cleanup -ps 6121183_Ju _21_2007_04_19_42


It is used to copy all files listed in ORACLE_HOME/.patch_storage/<ID>/rac/copy_files.txt to remote nodes. If -fp option is used, then one can specify the path of the file containing the list of files to be copied. The files mentioned in this file will be copied to the remote nodes.
Example: opatch util copylistedfiles -fp a -remote_nodes ceintcb-a5
This is used where RAC setup is present.


It is used to copy a single file to remote nodes. The usage remains the same as CopyListedFiles.
Example: opatch util copylistedfilestest -fp /home/oracle/a -remote_nodes ceintcb-a5
This is used where RAC setup is present.


It is used to recursively copy all directories listed in ORACLE_HOME/.patch_storage/<ID>/rac/copy_dirs.txt to remote nodes. If -dp option is used, then one can specify the path of the file containing the list of directories to be copied. The directories mentioned in this file will be copied to the remote nodes.
This is used where RAC setup is present.


It is used to copy a single file to remote nodes. The usage remains the same as CopyListedDirs.
This is used where RAC setup is present.


It is used to remove files listed in ORACLE_HOME/.patch_storage/<ID>/rac/remove_files.txt on remote nodes. If -fr option is used, then one can specify the path of the file containing the list of files to be removed. The files mentioned in this file will be removed from the remote nodes.
This is used where RAC setup is present.


It is used to remove a single file from remote nodes. The usage remains the same as RemoveListedFiles.
This is used where RAC setup is present.


It is used to recursively remove directories listed in ORACLE_HOME/.patch_storage/<ID>/rac/remove_dirs.txt from remote nodes. If -dr option is used, then one can specify the path of the file containing the list of directories to be removed. The directories mentioned in this file will be removed from the remote nodes.
This is used where RAC setup is present.


It is used to remove a single directory from remote nodes. The usage remains the same as RemoveListedDirs.
This is used where RAC setup is present.


It is used to invoke re-link on the local node. The make commands are stored in ORACLE_HOME/.patch_storage/<ID>/make.txt. You need to use the -ps option to specify the Patch ID with timestamp. A directory by this name will be present under ORACLE_HOME/.patch_storage. The make.txt file present under ORACLE_HOME/.patch_storage/<Patch ID with timestamp>/ will be used to perform the local make operation. This command cannot be run if you have already run Cleanup as it would have removed these make.txt files.

Example: opatch util runlocalmake -ps 6121250_ un_21_2007_04_16_11


It is used to invoke re-link on remote nodes. The make commands are stored in
ORACLE_HOME/.patch_storage/<ID>/rac/makes_cmd.txt. The usage remains the same as RunLocalMake.
This is used where RAC setup is present.


It is used to run any command on remote nodes. The command should be specified using the -cmd option.
Example: opatch util runanycommand -remote_nodes ceintcb-a5 -cmd ls
This is used where RAC setup is present.


It is used to check the validity of an XML file. The -xmlInput option can be used to specify the path of the xml file.

@ Support can use this utility to verify the integrity of XML files contained in the local and central inventory.
Example: opatch util loadxml -xmlInput $ORACLE_HOME/inventory/ContentsXML/comps.xml


It is used to run the patch verification process to ensure that the patch was applied to the ORACLE_HOME. It uses the defined ORACLE_HOME and the given patch location via -ph, to run the check.

@ Support can use this utility to re-run the OPatch verification stage, if required for patch diagnosis. The patch staging area has to be present or created.

Example: opatch util verify -ph ~/6646853/6121183


Some times the inventory get corrupted because of some issues. In that case you need to repair the inventory. Following are the two methods which I know can be used to repair the inventory.

1) Development has released a utility (checkinv) which can be use to repair the  inventory if it becomes corrupted for some reason.

Please note that this version of checkinv works only for 9.2 and 10.1 releases of oracle database. This doesn’t work for 10.2 releases of oracle database.

You can download the checkinv utility from Patch 4121946.

To cleanup the components, you should determine the unwanted or dangling components, then specify those using the option “-remcomp”, to cleanup the component list.

The utility detects and asks user’s permission to repair a bad inventory.¬† In case you want to repair the inventory, the utility will first back up the files before any modification.

However, it is better that you backup the inventory before running the tool.

For more details, check metalink note ID 298906.1

2) Creating a new inventory using Oracle Universal Installer (OUI).

Check my older post for the same.

Hope this helps !!


Metalink note ID : 298906.1
Metalink note ID : 554417.1
Metalink note ID : 374092.1
Metalink note ID : 357221.1

Cleaner APEX URLs

Some times for production systems, we need to have cleaner URLs, specially for APEX application in order to hide the details about the host or the parameters that are passed when we go from one page to another in an application.

This post is about giving a simpler way to do the same. I faced similar issue for one of out main production system where objective was to standardise our URLs. We have more then 20 applications running on same APEX installation having different application ID.

Here is what I did.

1) Check the document root of Apache

/slot/ems2154/oracle/product/Apache/Apache/Apache/htdocs in my case.

2) Suppose my APEX URL is some thing like this

and I want to make is some thing like

just for example I am using “test” as context root. In your case you can have any name. So when we hit this second URL (, Apache will search for a file called test under document root (/slot/ems2154/oracle/product/Apache/Apache/Apache/htdocs).

So we can create a simple file in DocumentRoot location and name that file as test. Below should be the content of that file (in my case).

  <title>Some Title</title>
<frameset rows="100%,*" border="0">
  <frame src="http://your_host/pls/otn/f?p=xxxxx" frameborder="0" />
  <frame frameborder="0" noresize />

In your case you can change the src=<URL> accordingly. Bounce the Apache.

After that you can hit the URL and it will work. Also it will not show any details about your application.

Hope this helps !!


Patrick Wolf Blog