Saturday, September 18, 2010

Install Oracle Database Server Patch Using Silent Mode

Oracle user patch to do bug fixed and upgade. Hear is an example of installing Oracle 10g 10.2.0.3 patch using Silent Mode.

1.Download the Patch
Download the patch from oracle support site: https://support.oracle.com/CSP/ui/flash.html(aka http://metalink.oracle.com). The patch file is p5337014_10203_LINUX.zip for 32 bit system and p5337014_10203_LINUX-x86-64.zip for 64 bit system/

To loacate the patch, after login to https://support.oracle.com, click:

  1. Patches and Update (on the top menu)
  2. Latest Patches (Left side bar, under Oracle Server/Tool
  3. Oracle Database (under Latest Oracle Server/Tool Patch Sets)

All the patches are listed there.

2. Prepare for Patch Installation
Select a temporary directory to store the installation packages. For example, the /tmp directory. Use unzip to extract the packages. The packages will store in a directory call Disk1.

#>unzip p5337014_10203_LINUX x86-64.zip

3. Update Oracle Time Zone Definitions
Before installing the patch, check if the the Oracle Time Zone definitions had been installed in the existing installation by running an Oracle script, utltzuv2.sql, in the $ORACLE_HOME/rdms/admin/ directory.

SQL> @?/rdbms/admin/utltzuv2.sql;
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
PL/SQL procedure successfully completed.
Commit complete.

4 Shutdown the Oracle Server and Lisntner
To begin installing the patch, all the existing Oracle processes need to be shutdowned. First, shutdown the Oracle Server.

#>sqlplus /nolog
SQL>connect sys/password as sysdba;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit

Secondly, shutdown the listener.

#>lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 09-SEP-2010 17:59:09

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully

If there is any other process running, shutdown it too. To check if all the Oracle processes had been shutdowned, do the following:

#>ps –ef | grep ora.

It should show any Oracle process running.

5.Install the Patch
Following are steps to install the pach package. It involves installing the binaries by running the installer, runInstaller, and excuting two Oracle sql scripts that are come with the pactch.

• Remove the existinting inventory directory: /u0/oracle/product/10.2.0/oraInventory
#>mv oraInventory/ oraInventory10201
• Change to the pactch directory:
#>cd /tmp/Disk1
• Run the installation utility:
#> ./runInstaller -silent -responseFile /tmp/enterprise_install.rsp –force
Make sure to check the installation log as show on the screen to check for errors in installation.
• Check Opatch Version
There is a untility script that we can use to checked the binary version. The script is in $ORACLE_HOME/OPatch directory.
#> cd $ORACLE_HOME
#> cd OPatch/
#> opatch version
Invoking OPatch 10.2.0.3.0
OPatch Version: 10.2.0.3.0
OPatch succeeded.

6.Upgrade the Database
Startup Oracle in upgrade mode and run the catupgrd.sql script, which is in the $ORACLE_HOME/rdbms/admin/ director, to upgrade the database. This script will take more than 20 minutes to complete.
#>Sqlplus /nolog
SQL>connect sys/password as sysdba;
SQL> startup upgrade
SQL> spool upgrade.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> spool off

Once the upgrade is done. Check any errors in the spooled file. If every thing is OK, proceed to next step to recompile the invalids using utlrp.sql script present in ORACLE_HOME/rdbms/admin directory.

7. Recompile the Invalids
SQL> @? /rdbms/admin/utlrp.sql;

After recompiling, shutdown the database and startup for allowing access to the users which is show in next step.

7.1 Restart the server.
If there is no error after upgrading and recompiling, we can now shutdown the database and startup for allowing access to the users.

7.2 Restart Server
SQL> shutdown immediate;
SQL>startup mount;
ORACLE instance started.

Total System Global Area 1.2583E+10 bytes
Fixed Size 2094096 bytes
Variable Size 1728056304 bytes
Database Buffers 1.0838E+10 bytes
Redo Buffers 14680064 bytes
Database mounted.

SQL> alter database open;
Database altered.
Check the alert log for error:
#>cd /u0/oracle/admin/OVI/bdump
#>vi alert_ovi.log
If there is no error, the patch upgrade is completed.

7.3 Start Listner
#>lsnrctl start

Now the database is ready for user connections.

Related Notes:


1 comment:

Anonymous said...

Very efficiently written article. It will be valuable to anyone who utilizes it, as well as me.
Keep up the good work - can'r wait to read more posts.