Pages

Wednesday, February 15, 2012

Upgrade Oracle 10g Release 2 to Oracle 11g Release 1

Upgrade Oracle 10g Release 2 to Oracle 11g Release 1

Posted by Zahid on July 28, 2010.

This article is a step by step guide to upgrade oracle database 10gR2 (10.2.0.4) to 11gR1 (11.1.0.6). The current environment is RHEL 5.5.

Preparing for upgrade to 11g Release 1

The first step is to stop all the components of the oracle 10g database.
-- stop isqlplus
$ isqlplusctl stop
iSQL*Plus 10.2.0.4.0
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
Stopping iSQL*Plus ...
iSQL*Plus stopped.

-- stop enterprise manager dbconsole
$ emctl stop dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0  
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
Stopping Oracle Enterprise Manager 10g Database Control ... 
 ...  Stopped. 

-- stop listener
$ lsnrctl stop

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully

-- Shutdown the database.
$ sqlplus / as sysdba

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
Now take a cold backup of the database and the ORACLE_HOME directory.
$cd /u01/app/oracle/oradata/

/*
 All my data files , control files and log files are in a directory ora10g
 at the location /u01/app/oracle/oradata/.
 I am going to make a tar archive of ora10g directory. If these files
 are at separate locations then add all those locations into the tar archive.
 And since this is just a test database and is very small in size so tar archive
 works much better then every thing else. But if it would be a production db and 
 is big in size then I would consider other faster ways to take a cold backup of
 my data files.
*/

$ tar czf /home/oracle/ora10g.tar.gz ora10g

$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1

/*
 This is Home Directory for Oracle 10g so I would make a tar archive of "db_1" directory.
*/

$ cd /u01/app/oracle/product/10.2.0/
$ tar czf /home/oracle/oraHomeBackup.tar.gz db_1

$ ls /home/oracle/*.tar.gz
/home/oracle/ora10g.tar.gz  /home/oracle/oraHomeBackup.tar.gz

Configure the system for oracle 11g Release 1 Installation

Now is the time to install oracle 11g R1 in a separate home directory from the oracle 10g.
I would recommend that before going ahead you should have a look at this article, at least the pre-installation configurations.
Since Oracle 10g is already installed on this server so you may find some of the pre-installation configurations already there.
I will go through the adjustments in the pre-installation configurations that I had to make when preparing for 11gR1 install on a server where 10gR2 was already installed.
Open /etc/sysctl.conf and the following lines:
# Oracle settings
fs.file-max = 65536
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
If any one of these exist already and value is higher then or equal to the above, then don't add the new value but if the value is lower remove the already existing value and add the above.
-- Make the kernel parameters changes effective immediately:
# /sbin/sysctl -p

-- Verify the parameters are changed or not? 
# /sbin/sysctl -a | grep name_of_kernel_parameter -- e.g. shmall
Now we need to make sure we have all necessary packages for Oracle. Most of the rpm packages listed in the article I mentioned above would be installed. However to verify you may go ahead and issue the following command for each of them.
# rpm -qa | grep binutils-2
binutils-2.17.50.0.6-12.el5
It will show you if the package is installed or not.
Now which ever package you find missing install them. Put your Linux Media into DVD and go to the "Server" directory.
cd /dvd_mount_point/Server

-- In my case only following three were missing.
rpm -Uvih libaio-devel-0*`uname -p`*
rpm -Uvih numactl-devel-0*`uname -p`*
rpm -Uvih unixODBC-2*`uname -p`*
rpm -Uvih unixODBC-2*i386*
rpm -Uvih unixODBC-devel-2*`uname -p`*
NOTE: If you are using RHEL5 DVD then you should find them all in the "Server" directory in your DVD. And if you don't find one there you may download it from the Linux vendor's Web site. If you have your Linux distribution in 3 CDs then these will be scattered on all three CDs in the Server directory on all CDs.
In my case the linux user that owns the oracle software installation is oracle. Check for the existence of the groups it needs.
# cat /etc/group | grep dba
dba:x:501:oracle
# cat /etc/group | grep oinstall
oinstall:x:500:
# cat /etc/group | grep oper

-- Group oper doesn't exist. Create it and assign it to the user oracle as secondary group.

groupadd oper
usermod -g oinstall -G dba,oper oracle
Allow the user oracle to use X server, which it will need to run Oracle Universal Installer.
# xhost +SI:localuser:oracle
localuser:oracle being added to access control list
Now switch to the user oracle.
# su - oracle
Create a new directory for 11g Oracle Home under your Oracle Base directory.
$ echo $ORACLE_BASE
/u01/app/oracle
$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1
$ 
$ cd /u01/app/oracle/product
$ mkdir -p 11.1.0/db_1
$ mkdir -p 11.1.0/oraInventory
-- We will use a separate inventory location for 11g installation.
Add these lines into the file ~/.bash_profile
# Oracle 11g Home settings
#ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
#ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME
#ORACLE_SID=ora10g; export ORACLE_SID
With these changes the ~/.bash_profile should look like this:
# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

# Oracle settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

# If /tmp doesn't have 400mb space free then you can workaround it
# by pointing the variables TMP AND TMPDIR to a location where you
# have sufficient space. Oracle will then use this directory for 
# temporary files.


# Oracle 11g Home settings
#ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
#ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME
#ORACLE_SID=ora10g; export ORACLE_SID
# Oracle 10g Home settings
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=ora10g; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; 
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; 
export CLASSPATH

if [ $USER = "oracle" ]; then
      if [ $SHELL = "/bin/ksh" ]; then
            ulimit -p 16384
            ulimit -n 65536
      else
            ulimit -u 16384 -n 65536
      fi
fi
As you can see I have made two sections in the file. One to setup the Environemnt for Oracle 11g and one for 10g. During the Upgrade we will need to switch back and forth in the 10g and 11g environemnts, and these settings will make it easy for us.
If we want to set the user environemnt to 11g Oracle Home we will edit the file and uncomment 11g setting and comment out the 10g settings and will do the vice versa to set the user environemnt to 10g.
How to set the oracle user environment to 10g:
- Edit the ~/.bash_profile, comment out the 11g settings and uncomment the 10g settings.
- Logout and Login again to bring the changes in effect.
How to set the oracle user environment to 11g:
- Edit the ~/.bash_profile, comment out the 10g settings and uncomment the 11g settings.
- Logout and Login again to bring the changes in effect.

Install Oracle 11g Release 1 software

Open another console and login as user root. Edit the file /etc/oraInst.loc to change the Oracle Inventory location.
The contents of the file should look like this.
inventory_loc=/u01/app/oracle/product/11.1.0/oraInventory
inst_group=oinstall

Download Oracle 11gR1 software

You will have to login to your OTN web account first.
Once download is complete unzip the files that you downloaded.
-- Do this in the console where user oracle is logged in.
$ cd /home/oracle
-- This is where I downloaded the zip files.
$ ls *.zip
linux.x64_11gR1_database_1013_1.zip
$ 
$ unzip linux.x64_11gR1_database_1013_1.zip
Set the oracle user environment to 11g using the way described above.
$ cd /home/oracle/database/
$ ./runInstaller -invPtrLoc /etc/oraInst.loc

Welcome to Oracle Universal Installer

This is the first screen you should see when you run Installer. Just press Next.

  • Welcome to Oracle Universal Installer

  • Select Installation Type

    Choose the type of installation you want to proceed with. In my case I choose "Enterprise Edition".

  • Select Installation Type

  • Install Location

    Choose your installation locations i.e. ORACLE_BASE and ORACLE_HOME locations.

  • Install Location

  • Product Specific Prerequisite Checks

    Oracle will perform all prerequisite checks here it will show a report about the checks performed. If you have configured your environment properly before starting the installation as demonstrated here, all checks should pass.

  • Product Specific Prerequisite Checks

  • Upgrade an Existing Database

    Choose No here as we will upgrade the database manually.

  • Upgrade an Existing Database

  • Select Configuration Option

    Choose "Install Software Only" and press next.

  • Select Configuration Option

  • Privileged Operating System Groups

    Provide the OS groups that you created for OSDBA, OSOPER and OSASM privileges. We have no plans for ASM at this point so we didn't create and OS group to be used for OSASM privilege. In my case OSDBA group is dba, OSOPER group is oper and I would use oinstall group for OSASM.

  • Privileged Operating System Groups

  • Summary

    This is the install summary. Review it and press Install.

  • Summary

  • Installation Progress

    Oracle software will be installed now. Sit back and relax until the progress bar goes to 100%.

  • Installation Progress

  • Execute Configuration Scripts

    Execute the suggested scripts as root. See below.

  • Execute Configuration Scripts

  • Open another console, log in as root and perform run the root.sh script suggested by the Oracle installer.
    # which dbhome
    /usr/local/bin/dbhome
    # cd /usr/local/bin/
    
    # mv dbhome dbhome_10204
    # mv oraenv oraenv_10204
    # mv coraenv coraenv_10204
    
    # /u01/app/oracle/product/11.1.0/db_1/root.sh
    Running Oracle 11g root.sh script...
    
    The following environment variables are set as:
        ORACLE_OWNER= oracle
        ORACLE_HOME=  /u01/app/oracle/product/11.1.0/db_1
    
    Enter the full pathname of the local bin directory: [/usr/local/bin]: 
       Copying dbhome to /usr/local/bin ...
       Copying oraenv to /usr/local/bin ...
       Copying coraenv to /usr/local/bin ...
    
    Entries will be added to the /etc/oratab file as needed by
    Database Configuration Assistant when a database is created
    Finished running generic part of root.sh script.
    Now product-specific root actions will be performed.
    Finished product-specific root actions.
    You have mail in /var/spool/mail/root

    End of Installation

    Press "Exit" to end the installation.

  • End of Installation

  • Pre-Upgrade tool (utlu111i.sql)

    You should analyze your database before upgrading it. Oracle 11g Release 1 ships a script utlu111i.sql aka Pre-Upgrade tool. This script can be found in the ORACLE_HOME/rdbms/admin directory. This script checks the current database which you are trying to upgrade to 11gR1 and display a report, if there are any changes need to be done before and after the upgrade. Besides its reporting nature, it is mandatory to run the Pre-Upgrade Script before a manual upgrade.

    How to run Oracle 11gR1 Pre-Upgrade tool (utlu111i.sql)

    To run the Pre-Upgrade tool the environment should be set like this:
    $ORACLE_HOME = Oracle Home which you are planning to upgrade (Old Oracle Home).
    $ORACLE_SID = SID of the database being upgraded.
    $PATH = should point to the original/old Oracle Home.
    Copy the script utlu111i.sql from 11gR1 ORACLE_HOME/rdbms/admin to another directory say /tmp, change to that directory and start sqlplus. Run the script and view the output.
    $ echo $ORACLE_HOME
    /u01/app/oracle/product/10.2.0/db_1
    -- Verify that this is the 10g ORACLE_HOME
    $ cd /u01/app/oracle/product/11.1.0/db_1/rdbms/admin/
    $ cp utlu111i.sql /tmp
    $ cd /tmp
    $ sqlplus / as sysdba
    
    SQL> startup
    
    SQL> spool pre_upgrade.log
    SQL> @utlu111i.sql
    Oracle Database 11.1 Pre-Upgrade Information Tool    07-28-2010 17:53:06
    .
    **********************************************************************
    Database:
    **********************************************************************
    --> name:          ORA10G
    --> version:       10.2.0.4.0
    --> compatible:    10.2.0.1.0
    --> blocksize:     8192
    --> platform:      Linux x86 64-bit
    --> timezone file: V4
    .
    **********************************************************************
    Tablespaces: [make adjustments in the current environment]
    **********************************************************************
    --> SYSTEM tablespace is adequate for the upgrade.
    .... minimum required size: 742 MB
    .... AUTOEXTEND additional space required: 242 MB
    --> UNDOTBS1 tablespace is adequate for the upgrade.
    .... minimum required size: 440 MB
    --> SYSAUX tablespace is adequate for the upgrade.
    .... minimum required size: 421 MB
    .... AUTOEXTEND additional space required: 181 MB
    --> TEMP tablespace is adequate for the upgrade.
    .... minimum required size: 61 MB
    .... AUTOEXTEND additional space required: 32 MB
    --> EXAMPLE tablespace is adequate for the upgrade.
    .... minimum required size: 69 MB
    .
    **********************************************************************
    Update Parameters: [Update Oracle Database 11.1 init.ora or spfile]
    **********************************************************************
    WARNING: --> "sga_target" needs to be increased to at least 672 MB
    .
    **********************************************************************
    Renamed Parameters: [Update Oracle Database 11.1 init.ora or spfile]
    **********************************************************************
    -- No renamed parameters found. No changes are required.
    .
    **********************************************************************
    Obsolete/Deprecated Parameters: [Update Oracle Database 11.1 init.ora or spfile]
    **********************************************************************
    --> "background_dump_dest" replaced by  "diagnostic_dest"
    --> "user_dump_dest" replaced by  "diagnostic_dest"
    --> "core_dump_dest" replaced by  "diagnostic_dest"
    .
    **********************************************************************
    Components: [The following database components will be upgraded or installed]
    **********************************************************************
    --> Oracle Catalog Views         [upgrade]  VALID
    --> Oracle Packages and Types    [upgrade]  VALID
    --> JServer JAVA Virtual Machine [upgrade]  VALID
    --> Oracle XDK for Java          [upgrade]  VALID
    --> Oracle Workspace Manager     [upgrade]  VALID
    --> OLAP Analytic Workspace      [upgrade]  VALID
    --> OLAP Catalog                 [upgrade]  VALID
    --> EM Repository                [upgrade]  VALID
    --> Oracle Text                  [upgrade]  VALID
    --> Oracle XML Database          [upgrade]  VALID
    --> Oracle Java Packages         [upgrade]  VALID
    --> Oracle interMedia            [upgrade]  VALID
    --> Spatial                      [upgrade]  VALID
    --> Data Mining                  [upgrade]  VALID
    --> Expression Filter            [upgrade]  VALID
    --> Rule Manager                 [upgrade]  VALID
    --> Oracle OLAP API              [upgrade]  VALID
    .
    **********************************************************************
    Miscellaneous Warnings
    **********************************************************************
    WARNING: --> Database contains stale optimizer statistics.
    .... Refer to the 11g Upgrade Guide for instructions to update
    .... statistics prior to upgrading the database.
    .... Component Schemas with stale statistics:
    ....   SYS
    ....   WMSYS
    ....   OLAPSYS
    ....   SYSMAN
    ....   CTXSYS
    ....   XDB
    ....   MDSYS
    WARNING: --> Database contains INVALID objects prior to upgrade.
    .... USER PUBLIC has 1 INVALID objects.
    .... USER SYS has 2 INVALID objects.
    WARNING: --> Database contains schemas with objects dependent on network
    packages.
    .... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
    WARNING: --> EM Database Control Repository exists in the database.
    .... Direct downgrade of EM Database Control is not supported. Refer to the
    .... 11g Upgrade Guide for instructions to save the EM data prior to upgrade.
    .
    
    PL/SQL procedure successfully completed.
    SQL> spool off
    SQL> exit
    Fix the warnings reported by the Pre-Upgrade tool. The warnings about parameters and tablespaces if there are any needs to be done before the database upgrade. As far as the Miscellaneous Warnings are concerned some you have to fix before the upgrade and some after the upgrade.
    Please look at the article Oracle 11g Release 1 Pre Upgrade tool utlu111i.sql to see how to fix warnings and cautions reported by the Pre-Upgrade tool.
    I have fixed the following warnings prior to the upgrade with the help of the link Oracle 11g Release 1 Pre Upgrade tool utlu111i.sql.
    WARNING: --> Database contains schemas with stale optimizer statistics.
    WARNING: --> EM Database Control Repository exists in the database.
    While fixing the warning about EM Database Control Repository, I have started the Oracle listener and EM console. Shut them down to start the Oracle 11g Upgrade process.
    -- Stop the listener
    $ lsnrctl stop
    
    Copyright (c) 1991, 2007, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    The command completed successfully
    
    -- Stop the EM database console.
    $ emctl stop dbconsole
    TZ set to US/Eastern
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0  
    Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
    Stopping Oracle Enterprise Manager 10g Database Control ... 
     ...  Stopped.
    Now log in as sysdba and change the initialization parameters as suggested by the Pre-Upgrade Tool. Once done, shutdown the database and create a pfile from spfile, that we will ship to the 11g ORACLE_HOME.
    $ sqlplus / as sysdba
    
    SQL> show parameter sga_max_size
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    sga_max_size                         big integer 572M
    
    SQL> show parameter sga_target
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    sga_target                           big integer 572M
    
    -- change sga_max_size to 700m and bounce the database.
    
    SQL> alter system set sga_max_size=700m scope=spfile;
    
    System altered.
    
    SQL> shutdown immediate
    
    SQL> startup
    
    -- Change the sga_target to 700m now.
    
    SQL> alter system set sga_target=700m scope=both;
    
    System altered.
    
    -- remove *_dump_dest parameters from spfile.
    
    SQL> alter system reset background_dump_dest scope=spfile sid='*';
    
    System altered.
    
    SQL> alter system reset core_dump_dest scope=spfile sid='*';
    
    System altered.
    
    SQL> alter system reset user_dump_dest scope=spfile sid='*';
    
    System altered.
    
    -- Shutdown the database and create pfile from spfile.
    
    SQL> shutdown immediate
    
    SQL> create pfile from spfile;
    
    File created.
    
    SQL> exit
    Now copy the newly created pfile (init[SID].ora) and the password file (orapw[SID]) from oracle 10g ORACLE_HOME/dbs to oracle 11g ORACLE_HOME/dbs.
    $ echo $ORACLE_HOME
    /u01/app/oracle/product/10.1.0/db_1
    $ cd $ORACLE_HOME/dbs
    $ cp initora10g.ora orapwora10g /u01/app/oracle/product/11.1.0/db_1/dbs/
    $ 
    
    Now open another console, log in as root and edit /etc/oratab to change the oracle home with the sid ora10g to 11g ORACLE_HOME. After the change the /etc/oratab should look like this.
    ora10g:/u01/app/oracle/product/11.1.0/db_1:N
    Now set the oracle user environment to 11g Oracle Home using the way described above in this article.
    Once the environment is set to 11g ORACLE_HOME, open sqlplus and startup the database in upgrade mode.
    $ echo $ORACLE_HOME
    /u01/app/oracle/product/11.1.0/db_1
    
    $ cd $ORACLE_HOME/rdbms/admin/
    
    $ sqlplus / as sysdba
    
    Connected to an idle instance.
    
    

    SQL> startup upgrade pfile='/u01/app/oracle/product/11.1.0/db_1/dbs/initora10g.ora'

    ORACLE instance started. Total System Global Area 606806016 bytes Fixed Size 1338196 bytes Variable Size 201327788 bytes Database Buffers 398458880 bytes Redo Buffers 5681152 bytes Database mounted. Database opened. SQL> spool upgrade.log SQL> @catupgrd.sql . . [output trimmed] . . SQL> /*****************************************************************************/ SQL> /* Step 10 - SHUTDOWN THE DATABASE..!!!!! SQL> */ SQL> /*****************************************************************************/ SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> SQL> SQL> SQL> DOC DOC>####################################################################### DOC>####################################################################### DOC> DOC> The above sql script is the final step of the upgrade. Please DOC> review any errors in the spool log file. If there are any errors in DOC> the spool file, consult the Oracle Database Upgrade Guide for DOC> troubleshooting recommendations. DOC> DOC> Next restart for normal operation, and then run utlrp.sql to DOC> recompile any invalid application objects. DOC> DOC>####################################################################### DOC>####################################################################### DOC># SQL> SQL> SQL> SQL> SQL> SQL> Rem Set errorlogging off SQL> SET ERRORLOGGING OFF; SQL> SQL> Rem ********************************************************************* SQL> Rem END catupgrd.sql SQL> Rem ********************************************************************* SQL> SQL> SPOOL OFF SQL> exit
    When catupgrd.sql finishes it will automatically shutdown the database. Exit from sqlplus and open the spool file for the upgrade process and see if there were any errors during the upgrade. If you don't see any errors proceed further with the upgrade. If you see errors refer to the link below to trouble shoot them.
    Troubleshoot the Upgrade

    Post upgrade steps: Oracle 11g Release 2

    Create the spfile from the pfile so that the system should use the spfile for next startup.
    $ sqlplus / as sysdba
    
    Connected to an idle instance.
    
    SQL> create spfile from pfile='/u01/app/oracle/product/11.1.0/db_1/dbs/initora10g.ora';
    
    File created.
    
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area  606806016 bytes
    Fixed Size                  1338196 bytes
    Variable Size             201327788 bytes
    Database Buffers          398458880 bytes
    Redo Buffers                5681152 bytes
    Database mounted.
    Database opened.
    SQL> 
    

    Post-Upgrade Status tool (utlu111s.sql)

    Now run the post upgrade tool to verify the status of the upgrade.
    SQL> spool post_upgrade.log
    SQL> @utlu111s.sql
    .
    Oracle Database 11.1 Post-Upgrade Status Tool           07-28-2010 20:29:10
    .
    Component                                Status         Version  HH:MM:SS
    .
    Oracle Server
    .                                         VALID      11.1.0.6.0  00:17:33
    JServer JAVA Virtual Machine
    .                                         VALID      11.1.0.6.0  00:09:05
    Oracle Workspace Manager
    .                                         VALID      10.2.0.4.3  00:00:01
    OLAP Analytic Workspace
    .                                         VALID      11.1.0.6.0  00:00:24
    OLAP Catalog
    .                                         VALID      11.1.0.6.0  00:00:55
    Oracle OLAP API
    .                                         VALID      11.1.0.6.0  00:00:24
    Oracle Enterprise Manager
    .   ORA-06550: line 5, column 35:
    .   PL/SQL: ORA-00942: table or view does not exist
    .   ORA-06550: line 5, column 1:
    .   PL/SQL: SQL Statement ignored
    .   ORA-00001: unique constraint (SYSMAN.PARAMETERS_PRIMARY_KEY) violated
    .   ORA-06512: at "SYSMAN.MGMT_TIME_SYNC", line 108
    .   ORA-06512: at "SYSMAN.MGMT_TIME_SYNC", line 166
    .   ORA-06512: at line 2
    .                                         VALID      11.1.0.6.0  00:08:48
    Oracle XDK
    .                                         VALID      11.1.0.6.0  00:00:41
    Oracle Text
    .                                         VALID      11.1.0.6.0  00:00:50
    Oracle XML Database
    .                                         VALID      11.1.0.6.0  00:03:48
    Oracle Database Java Packages
    .                                         VALID      11.1.0.6.0  00:00:17
    Oracle Multimedia
    .                                         VALID      11.1.0.6.0  00:03:20
    Spatial
    .                                         VALID      11.1.0.6.0  00:04:13
    Oracle Expression Filter
    .                                         VALID      11.1.0.6.0  00:00:11
    Oracle Rule Manager
    .                                         VALID      11.1.0.6.0  00:00:09
    Gathering Statistics
    .                                                                00:03:59
    Total Upgrade Time: 00:54:50
    
    PL/SQL procedure successfully completed.
    
    SQL> SPOOL OFF
    The following errors will arise if you are upgrading from Oracle 10.2.0.4:
    . ORA-06550: line 5, column 35:
    . PL/SQL: ORA-00942: table or view does not exist
    . ORA-06550: line 5, column 1:
    . PL/SQL: SQL Statement ignored
    . ORA-00001: unique constraint (SYSMAN.PARAMETERS_PRIMARY_KEY) violated
    . ORA-06512: at "SYSMAN.MGMT_TIME_SYNC", line 108
    . ORA-06512: at "SYSMAN.MGMT_TIME_SYNC", line 166
    . ORA-06512: at line 2
    These errors do not result in any data loss. Therefore, you can ignore these errors.
    This issue is tracked with Oracle bug 6705429.
    See Metalink Note: 559255.1
    If the Post-Upgrade Status Tool returns and other errors or shows components that are not VALID or not the most recent release, then see:
    Troubleshoot the Upgrade
    There are some further actions that need to be done, but they do not require the database to be in upgrade mode. Now is the time to perform those action via catuppst.sql script.
    SQL> SPOOL catuppst.log
    SQL> @catuppst.sql
    TIMESTAMP
    --------------------------------------------------------------------------------
    COMP_TIMESTAMP POSTUP_BGN 2010-07-28 20:44:04
    
    
    PL/SQL procedure successfully completed.
    
    
    This script will migrate the Baseline data on a pre-11g database
    to the 11g database.
    .
    [output trimmed]
    ...                                       ...
    ... Completed Moving the Baseline Data    ...
    ...                                       ...
    ... If there are no Move BL Data messages ...
    ... above, then there are no renamed      ...
    ... baseline tables in the system.        ...
    ...                                       ...
    [output trimmed]
    ...                                       ...
    ... Completed the Dropping of the         ...
    ... Renamed Baseline Tables               ...
    ...                                       ...
    ... If there are no Drop Table messages   ...
    ... above, then there are no renamed      ...
    ... baseline tables in the system.        ...
    ...                                       ...
    
    PL/SQL procedure successfully completed.
    
    
    
    
    
    
    TIMESTAMP
    --------------------------------------------------------------------------------
    COMP_TIMESTAMP POSTUP_END 2010-07-28 20:44:11
    
    SQL> SPOOL OFF
    Now run the utlrp.sql script to compile the objects which were invalidated during the upgrade.
    SQL> SPOOL utlrp.log
    SQL> @utlrp.sql
    
    TIMESTAMP
    --------------------------------------------------------------------------------
    COMP_TIMESTAMP UTLRP_BGN  2010-07-28 20:46:23
    .
    .
    [output trimmed]
    .
    .
    PL/SQL procedure successfully completed.
    
    
    TIMESTAMP
    --------------------------------------------------------------------------------
    COMP_TIMESTAMP UTLRP_END  2010-07-28 20:51:09
    
    
    PL/SQL procedure successfully completed.
    
    DOC> The following query reports the number of objects that have compiled
    DOC> with errors (objects that compile with errors have status set to 3 in
    DOC> obj$). If the number is higher than expected, please examine the error
    DOC> messages reported with each object (using SHOW ERRORS) to see if they
    DOC> point to system misconfiguration or resource constraints that must be
    DOC> fixed before attempting to recompile these objects.
    DOC>#
    
    OBJECTS WITH ERRORS
    -------------------
                      1
    
    DOC> The following query reports the number of errors caught during
    DOC> recompilation. If this number is non-zero, please query the error
    DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
    DOC> are due to misconfiguration or resource constraints that must be
    DOC> fixed before objects can compile successfully.
    DOC>#
    
    ERRORS DURING RECOMPILATION
    ---------------------------
                              0
    
    
    PL/SQL procedure successfully completed.
    
    
    PL/SQL procedure successfully completed.
    
    SQL> SPOOL OFF
    
    SQL> SELECT count(*) FROM dba_invalid_objects;
    
      COUNT(*)
    ----------
             1
    
    SQL> select owner , object_name FROM dba_invalid_objects;
    
    OWNER     OBJECT_NAME
    --------- ---------------------------
    SH        FWEEK_PSCAT_SALES_MV
    
    /* 
       Even after running utlrp.sql if you see objects invalid in dba_invalid_objects, then
       review those objects and see why they are invalid and try to fix them.
       In my case this is a materialized view in SH schema that is invalid. Since SH is not 
       a schema used by my application and is an Oracle sample schema so I don't care
       about it.
    */
    The upgrade is now done. Now is the time to fix the Miscellaneous Warnings that were suggested by the Pre-Upgrade tool as to be done after the upgrade. In my case I need to fix the following:
    WARNING: --> Database contains schemas with objects dependent on network
    Refer to the article Oracle 11g Release 1 Pre Upgrade tool utlu111i.sql to see how to fix these.
    Now change the compatible initialization parameter to 11.1.0.6.0 to use all the features of Oracle 11g Release 1.
    SQL> alter system set compatible='11.1.0.6.0' scope=spfile;
    
    System altered.
    
    SQL> shutdown immediate
    
    SQL> startup
    
    SQL> show parameter compatible
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    compatible                           string      11.1.0.6.0

    Configure Listener for New Oracle 11g Database in 11g ORACLE_HOME

    Copy the 10g ORACLE_HOME/network/admin/listener.ora to 11g ORACLE_HOME/network/admin, once copied change the ORACLE_HOME in the file to point to 11g HOME whereever required.
    This is how the listener.ora should look like under the 11g ORACLE_HOME/network/admin directory.
    # listener.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PLSExtProc)
          (ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
          (PROGRAM = extproc)
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
          (ADDRESS = (PROTOCOL = TCP)(HOST = ora11gR1.home.com)(PORT = 1521))
        )
      )
    Once listener is setup just start the listener.
    $ lsnrctl start
    
    TNSLSNR for Linux: Version 11.1.0.6.0 - Production
    System parameter file is /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
    Log messages written to /u01/app/oracle/diag/tnslsnr/ora11gR1/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11gR1.home.com)(PORT=1521)))
    
    .
    [output trimmed]
    .
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11gR1.home.com)(PORT=1521)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
      Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    The listener is just started and shortly it will register the SID ora10g.
    $ lsnrctl status
    
    Copyright (c) 1991, 2007, Oracle.  All rights reserved.
    .
    [output trimmed]
    .
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11gR1.home.com)(PORT=1521)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
      Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "ora10g.home.com" has 1 instance(s).
      Instance "ora10g", status READY, has 1 handler(s) for this service...
    Service "ora10gXDB.home.com" has 1 instance(s).
      Instance "ora10g", status READY, has 1 handler(s) for this service...
    Service "ora10g_XPT.home.com" has 1 instance(s).
      Instance "ora10g", status READY, has 1 handler(s) for this service...
    The command completed successfully
    ora10g which is an upgraded database is now registered with the LISTENER.

    Upgrade Enterprise Manager Repository to 11g

    The enterprise manager is unusable yet. You will have to upgrade it too from 10g to 11g and then you may use it.
    $ export ORACLE_UNQNAME=ora10g
    [oracle@ora11gR1 admin]$ emctl start dbconsole
    OC4J Configuration issue. 
    /u01/app/oracle/product/11.1.0/db_1/oc4j/j2ee/OC4J_DBConsole_ora11gR1.home.com_ora10g 
    not found. 
    
    -- As you see the dbconsole cannot start.
    
    $ emca -upgrade db
    
    STARTED EMCA at Jul 28, 2010 9:14:23 PM
    EM Configuration Assistant, Version 11.1.0.5.0 Production
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    
    Enter the following information:
    Jul 28, 2010 9:14:23 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngine
    SEVERE: No SID specified
    ORACLE_HOME for the database to be upgraded: /u01/app/oracle/product/10.2.0/db_1
    Database SID: ora10g
    Listener port number: 1521              
    Password for SYS user:  
    Do you wish to continue? [yes(Y)/no(N)]: Y
    Jul 28, 2010 9:15:01 PM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ora10g/emca_2010_07_28_21_14_23.log.
    Jul 28, 2010 9:15:01 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
    INFO: Stopping Database Control (this may take a while) ...
    Jul 28, 2010 9:15:13 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
    INFO: Uploading configuration data to EM repository (this may take a while) ...
    Jul 28, 2010 9:16:09 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Uploaded configuration data successfully
    Jul 28, 2010 9:16:32 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
    INFO: Software library configured successfully.
    Jul 28, 2010 9:16:32 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
    INFO: Deploying Provisioning archives ...
    Jul 28, 2010 9:17:12 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
    INFO: Provisioning archives deployed successfully.
    Jul 28, 2010 9:17:12 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Securing Database Control (this may take a while) ...
    Jul 28, 2010 9:17:25 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Database Control secured successfully.
    Jul 28, 2010 9:17:25 PM oracle.sysman.emcp.util.DBControlUtil startOMS
    INFO: Starting Database Control (this may take a while) ...
    Jul 28, 2010 9:19:04 PM oracle.sysman.emcp.EMDBPostConfig performUpgrade
    INFO: Database Control started successfully
    Jul 28, 2010 9:19:08 PM oracle.sysman.emcp.EMDBPostConfig performUpgrade
    INFO: >>>>>>>>>>> The Database Control URL is https://ora11gR1.home.com:1158/em <<<<<<<<<<<
    Jul 28, 2010 9:19:08 PM oracle.sysman.emcp.EMDBPostConfig invoke
    WARNING: 
    ************************  WARNING  ************************
    
    Management Repository has been placed in secure mode wherein Enterprise Manager data 
    will be encrypted.  The encryption key has been placed in the file: 
    /u01/app/oracle/product/11.1.0/db_1/ora11gR1.home.com_ora10g/sysman/config/emkey.ora.
    Please ensure this file is backed up as the encrypted data will become unusable if this
    file is lost. 
    
    ***********************************************************
    Enterprise Manager configuration completed successfully
    FINISHED EMCA at Jul 28, 2010 9:19:08 PM
    Lets now check the status of the dbconsole.
    $ emctl status dbconsole
    Oracle Enterprise Manager 11g Database Control Release 11.1.0.6.0 
    Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
    Oracle Enterprise Manager 11g is running. 
    ------------------------------------------------------------------
    Logs are generated in directory /u01/app/oracle/product/11.1.0/db_1/ora11gR1.home.com_ora10g
    /sysman/log$ 
    At last lets check the status of the oracle components upgraded.
    SQL> column comp_name format a40
    SQL> column version format a15
    SQL> column status format a7
    SQL> select comp_name , version , status from dba_registry;
    
    COMP_NAME                                VERSION         STATUS
    ---------------------------------------- --------------- -------
    Oracle Enterprise Manager                11.1.0.6.0      VALID
    OLAP Catalog                             11.1.0.6.0      VALID
    Spatial                                  11.1.0.6.0      VALID
    Oracle Multimedia                        11.1.0.6.0      VALID
    Oracle XML Database                      11.1.0.6.0      VALID
    Oracle Text                              11.1.0.6.0      VALID
    Oracle Data Mining                       11.1.0.6.0      VALID
    Oracle Expression Filter                 11.1.0.6.0      VALID
    Oracle Rule Manager                      11.1.0.6.0      VALID
    Oracle Workspace Manager                 10.2.0.4.3      VALID
    Oracle Database Catalog Views            11.1.0.6.0      VALID
    Oracle Database Packages and Types       11.1.0.6.0      VALID
    JServer JAVA Virtual Machine             11.1.0.6.0      VALID
    Oracle XDK                               11.1.0.6.0      VALID
    Oracle Database Java Packages            11.1.0.6.0      VALID
    OLAP Analytic Workspace                  11.1.0.6.0      VALID
    Oracle OLAP API                          11.1.0.6.0      VALID
    
    17 rows selected.
    
    If they are all VALID with 11.1.0.xxx, the upgrade was successful.

    Upgrade Oracle 10g Release 2 from 10201 to 10204

    Upgrade Oracle 10g Release 2 from 10201 to 10204

    Posted by Zahid on July 3, 2010.

    This post demonstrate a step by step guide to apply oracle patchset 10.2.0.4 (patch number 6810189) on 10.2.0.1 database. My current environment is Oracle 10gR2 (10.2.0.1) installed on Redhat Enterprise Linux 5 update 4 32-bit.

    Preparing for the upgrade to 10.2.0.4

    Stop all oracle components running like LISTENER, EM , ISQLPLUS and DB itself etc.
    /* Stop the isqlplus if running */
    $ isqlplusctl stop
    iSQL*Plus 10.2.0.1.0
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Stopping iSQL*Plus ...
    iSQL*Plus stopped.
    
    /* Stop the EM dbconsole */
    
    $ emctl stop dbconsole
    TZ set to US/Eastern
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0  
    Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
    http://ora10.home.com:1158/em/console/aboutApplication
    Stopping Oracle Enterprise Manager 10g Database Control ... 
     ...  Stopped. 
    
    /* Stop the listener */
    
    $ lsnrctl stop
    
    Copyright (c) 1991, 2005, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    The command completed successfully
    
    /* Shutdown the database itself */
    
    $ sqlplus / as sysdba
    
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> 

    Take a backup of Oracle Home and Database

    Once the oracle database is shutdown, take a cold backup of your database and a backup of your ORACLE_HOME.
    $cd /u01/apps/oracle/oradata/
    
    /*
     All my data files , control files and log files are in a directory ora10g
     at the location /u01/apps/oracle/oradata/.
     I am going to make a tar archive of ora10g directory. If these files
     are at separate locations then add all those locations into the tar archive.
     And since this is just a test database and is very small in size so tar archive
     works much better then every thing else. But if it would be a production db and 
     is big in size then I would consider other faster ways to take a cold backup of
     my data files.
    */
    
    $ tar czf /home/oracle/ora10g.tar.gz ora10g
    
    $ echo $ORACLE_HOME
    /u01/apps/oracle/product/10.2.0/db_1
    
    /*
     This is my ORACLE_HOME so I would make a tar archive of "db_1" directory.
    */
    
    $ cd /u01/apps/oracle/product/10.2.0/
    $ tar czf /home/oracle/oraHomeBackup.tar.gz db_1

    Manage your data with TimeZone before upgrade

     
    (Only perform this step if you have data or Scheduler jobs with TZ info)
    From 9i onwards Oracle has 2 datatypes that may have data stored affected by a update of the RDBMS DST (Daylight Saving Time) definitions, those are TIMESTAMP WITH LOCAL TIME ZONE (TSLTZ) and TIMESTAMP WITH TIME ZONE (TSTZ). If you have TZ data stored in your database you need to go through the following steps to ensure the integrity of your data while the database upgrade.
    Check which TIMEZONE version file you are currently using.
    SQL> select version from v$timezone_file;
    
       VERSION
    ----------
             2
    If this gives 4 then you may simply proceed with the upgrade even if you have TZ data.
    If this gives higher then 4, look at the meta link note: Note 553812.1
    If this gives lower then 4, perform the following steps:
    Download utltzpv4.sql and run it.
    SQL> @utltzpv4.sql    
    DROP TABLE sys.sys_tzuv2_temptab CASCADE CONSTRAINTS
                   *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    
    
    Table created.
    
    DROP TABLE sys.sys_tzuv2_affected_regions CASCADE CONSTRAINTS
                   *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    
    
    Table created.
    
    Your current timezone version is 2!
    .
    Do a select * from sys.sys_tzuv2_temptab; to see if any TIMEZONE
    data is affected by version 4 transition rules.
    .
    Any table with YES in the nested_tab column (last column) needs
    a manual check as these are nested tables.
    
    PL/SQL procedure successfully completed.
    
    
    Commit complete.
    
    SQL> 
    
    /* Once the script finishes successfully execute the following query */
    
    column table_owner format a4
    column column_name format a18
    select * from sys_tzuv2_temptab;
    
    TABL TABLE_NAME                     COLUMN_NAME          ROWCOUNT NES
    ---- ------------------------------ ------------------ ---------- ---
    SYS  SCHEDULER$_JOB                 LAST_ENABLED_TIME           3
    SYS  SCHEDULER$_JOB                 LAST_END_DATE               1
    SYS  SCHEDULER$_JOB                 LAST_START_DATE             1
    SYS  SCHEDULER$_JOB                 NEXT_RUN_DATE               1
    SYS  SCHEDULER$_JOB                 START_DATE                  1
    SYS  SCHEDULER$_JOB_RUN_DETAILS     REQ_START_DATE              1
    SYS  SCHEDULER$_JOB_RUN_DETAILS     START_DATE                  1
    SYS  SCHEDULER$_WINDOW              LAST_START_DATE             2
    SYS  SCHEDULER$_WINDOW              NEXT_START_DATE             2
    
    9 rows selected.
    If it returns no rows, there is nothing that needs to be done. Just proceed with the upgrade.
    If it retunrs the detail of columns that contain TZ data which may be affected by the upgrade, see metalink note: Note 553812.1
    The Note 553812.1 states that if you see SYS owned SCHEDULER objects then it is safe to ignore them and proceed with the upgrade. But if you see user data or user created jobs here then you need to take a backup of data before upgrade and restore it back after the upgrade. Remove any user created jobs and re-create them after the upgrade.

    Download Oracle Patchset 10.2.0.4 (6810189)

    Now is the time to prepare the oracle 10.2.0.4 patchset installer.
    You can download the patchset from

    For Linux x86 (32-bit):

    10.2.0.4 for Linux x86

    For Linux x86-64 (64-bit):

    10.2.0.4 for Linux x86-64
    Once downloaded login as root in another console and execute following:
    # xhost +SI:localuser:oracle

    Install the patchset 10.2.0.4

    Now come back to the oracle user console and move to the directory where you downloaded the patch and unzip the file.
    $ cd /home/oracle
    $ unzip p6810189_10204_Linux-x86.zip
    $ cd Disk1/
    $ ./runInstaller
    The first screen is welcome screen.
    Oracle patchset 10.2.0.4 Installer Welcome page
    Provide the Oracle home details here (The oracle 10.2.0.1 home).
    Oracle patchset 10.2.0.4 Installer Orale Home Details
    The installer will perform prerequisite checks on this screen. Make sure you see the message "The overall result of this check is passed" in the output.
    Oracle patchset 10.2.0.4 Installer Prerequisites Checks
    Oracle configuration Manager allows you to associate your configuration with your metalink support account. You may skip this.
    Oracle patchset 10.2.0.4 Installer Configuration Manager
    Installation Summary.
    Oracle patchset 10.2.0.4 Installer Summary
    Installation progress.
    Oracle patchset 10.2.0.4 Installer Progress
    Once progress shows 100%, you will be asked to perform some root specific actions.
    Oracle patchset 10.2.0.4 Installer Root specific
    Login as root
    # which dbhome
    /usr/local/bin/dbhome
    /* 
       this shows the location of dbhome, oraenv and coraenv files
       rename them for 10.2.0.1 as the root.sh create new ones for 
       10.2.0.4
    */
    # cd /usr/local/bin/
    # mv dbhome dbhome_10201
    # mv oraenv oraenv_10201
    # mv coraenv coraenv_10201
    
    /* Now execute the script suggested by the installer. */
    
    # /u01/apps/oracle/product/10.2.0/db_1/root.sh
    Running Oracle10 root.sh script...
    
    The following environment variables are set as:
        ORACLE_OWNER= oracle
        ORACLE_HOME=  /u01/apps/oracle/product/10.2.0/db_1
    
    Enter the full pathname of the local bin directory: [/usr/local/bin]: 
       Copying dbhome to /usr/local/bin ...
       Copying oraenv to /usr/local/bin ...
       Copying coraenv to /usr/local/bin ...
    
    Entries will be added to the /etc/oratab file as needed by
    Database Configuration Assistant when a database is created
    Finished running generic part of root.sh script.
    Now product-specific root actions will be performed.
    When root.sh finishes successfully come back to installer and press ok. Then you should see the End of Installation page as below.
    Welcome Oracle patchset 10.2.0.4 Installer End of Installation
    Press exit and your ORACLE_HOME is patched with 10.2.0.4 patchset. All your db's working under this ORACLE_HOME will become unusable unless you upgrade your database to 10.2.04 as well.
    $ sqlplus / as sysdba
    
    Connected to an idle instance.
    
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area  608174080 bytes
    Fixed Size                  1268896 bytes
    Variable Size             171967328 bytes
    Database Buffers          427819008 bytes
    Redo Buffers                7118848 bytes
    Database mounted.
    ORA-01092: ORACLE instance terminated. Disconnection forced
    
    SQL> exit
    As you can see the database is unable to open and throwing the error ORA-01092. Lets look at the alert log file to know what actually happened.
    $ tail -f /u01/apps/oracle/admin/ora10g/bdump/alert_ora10g.log 
    SMON: enabling cache recovery
    Fri Jul  2 15:30:15 2010
    Errors in file /u01/apps/oracle/admin/ora10g/udump/ora10g_ora_12856.trc:
    ORA-00704: bootstrap process failure
    ORA-39700: database must be opened with UPGRADE option
    Fri Jul  2 15:30:15 2010
    Error 704 happened during db open, shutting down database
    USER: terminating instance due to error 704
    Instance terminated by USER, pid = 12856
    ORA-1092 signalled during: ALTER DATABASE OPEN...
    $
    The alert log states that the database has to be upgraded first using UPGRADE option to be able to OPEN normally.

    Upgrade the database from 10.2.0.1 to 10.2.0.4

    Now startup the database with upgrade option and run the pre-upgrade information tool to see if the database is okay for the upgrade and if there is some thing to be changed before starting the upgrade.
    $ cd $ORACLE_HOME/rdbms/admin
    $ sqlplus / as sysdba
    
    SQL> startup upgrade
    
    SQL> spool pre_upgrade.log
    
    SQL> @utlu102i.sql
    Oracle Database 10.2 Upgrade Information Utility    07-02-2010 17:39:25
    .
    **********************************************************************
    Database:
    **********************************************************************
    --> name:       ORA10G
    --> version:    10.2.0.1.0
    --> compatible: 10.2.0.1.0
    --> blocksize:  8192
    .
    **********************************************************************
    Tablespaces: [make adjustments in the current environment]
    **********************************************************************
    --> SYSTEM tablespace is adequate for the upgrade.
    .... minimum required size: 488 MB
    .... AUTOEXTEND additional space required: 8 MB
    --> UNDOTBS1 tablespace is adequate for the upgrade.
    .... minimum required size: 400 MB
    .... AUTOEXTEND additional space required: 370 MB
    --> SYSAUX tablespace is adequate for the upgrade.
    .... minimum required size: 245 MB
    .... AUTOEXTEND additional space required: 15 MB
    --> TEMP tablespace is adequate for the upgrade.
    .... minimum required size: 58 MB
    .... AUTOEXTEND additional space required: 38 MB
    --> EXAMPLE tablespace is adequate for the upgrade.
    .... minimum required size: 69 MB
    .
    **********************************************************************
    Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]
    **********************************************************************
    -- No update parameter changes are required.
    .
    **********************************************************************
    Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]
    **********************************************************************
    -- No renamed parameters found. No changes are required.
    .
    **********************************************************************
    Obsolete/Deprecated Parameters: [Update Oracle Database 10.2 init.ora or spfile]
    **********************************************************************
    -- No obsolete parameters found. No changes are required
    .
    **********************************************************************
    Components: [The following database components will be upgraded or installed]
    **********************************************************************
    --> Oracle Catalog Views         [upgrade]  VALID
    --> Oracle Packages and Types    [upgrade]  VALID
    --> JServer JAVA Virtual Machine [upgrade]  VALID
    --> Oracle XDK for Java          [upgrade]  VALID
    --> Oracle Java Packages         [upgrade]  VALID
    --> Oracle Text                  [upgrade]  VALID
    --> Oracle XML Database          [upgrade]  VALID
    --> Oracle Workspace Manager     [upgrade]  VALID
    --> Oracle Data Mining           [upgrade]  VALID
    --> OLAP Analytic Workspace      [upgrade]  VALID
    --> OLAP Catalog                 [upgrade]  VALID
    --> Oracle OLAP API              [upgrade]  VALID
    --> Oracle interMedia            [upgrade]  VALID
    --> Spatial                      [upgrade]  VALID
    --> Expression Filter            [upgrade]  VALID
    --> EM Repository                [upgrade]  VALID
    --> Rule Manager                 [upgrade]  VALID
    .
    
    PL/SQL procedure successfully completed.
    
    SQL> spool off
    The output from utlu102i.sql shows that every thing is fine, no changes are required and the database is ready for upgrade.
    Lets start the upgrade process.
    SQL> spool upgrade.log
    SQL> @catupgrd.sql
    .
    .
    .
    [output trimmed]
    .
    .
    .
    Oracle Database 10.2 Upgrade Status Utility           07-02-2010 18:13:40
    .
    Component                                Status         Version  HH:MM:SS
    Oracle Database Server                    VALID      10.2.0.4.0  00:09:32
    JServer JAVA Virtual Machine              VALID      10.2.0.4.0  00:03:34
    Oracle XDK                                VALID      10.2.0.4.0  00:00:29
    Oracle Database Java Packages             VALID      10.2.0.4.0  00:00:39
    Oracle Text                               VALID      10.2.0.4.0  00:00:20
    Oracle XML Database                       VALID      10.2.0.4.0  00:01:29
    Oracle Workspace Manager                  VALID      10.2.0.4.3  00:00:39
    Oracle Data Mining                        VALID      10.2.0.4.0  00:00:18
    OLAP Analytic Workspace                   VALID      10.2.0.4.0  00:00:19
    OLAP Catalog                              VALID      10.2.0.4.0  00:00:50
    Oracle OLAP API                           VALID      10.2.0.4.0  00:00:45
    Oracle interMedia                         VALID      10.2.0.4.0  00:03:48
    Spatial                                   VALID      10.2.0.4.0  00:01:29
    Oracle Expression Filter                  VALID      10.2.0.4.0  00:00:09
    Oracle Enterprise Manager                 VALID      10.2.0.4.0  00:01:16
    Oracle Rule Manager                       VALID      10.2.0.4.0  00:00:07
    .
    Total Upgrade Time: 00:25:52
    DOC>#######################################################################
    DOC>#######################################################################
    DOC>
    DOC>   The above PL/SQL lists the SERVER components in the upgraded
    DOC>   database, along with their current version and status.
    DOC>
    DOC>   Please review the status and version columns and look for
    DOC>   any errors in the spool log file.  If there are errors in the spool
    DOC>   file, or any components are not VALID or not the current version,
    DOC>   consult the Oracle Database Upgrade Guide for troubleshooting
    DOC>   recommendations.
    DOC>
    DOC>   Next shutdown immediate, restart for normal operation, and then
    DOC>   run utlrp.sql to recompile any invalid application objects.
    DOC>
    DOC>#######################################################################
    DOC>#######################################################################
    DOC>#
    SQL> spool off
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> 
    When the upgrade script catupgrd.sql finishes shutdown the database and open the spool of the upgrade process and try to find out if any thing failed. If you see something failed try to fix it and re-run the upgrade process.
    The upgrade process may leave many objects invalid in the database. Perform a normal startup and run the utlrp.sql script to recompile any invalid objects.
    $ sqlplus / as sysdba
    
    Connected to an idle instance.
    
    SQL> startup
    
    SQL> spool recompile.log
    
    SQL> @utlrp.sql
    
    TIMESTAMP
    --------------------------------------------------------------------------------
    COMP_TIMESTAMP UTLRP_BGN  2010-07-02 18:23:16
    
    DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
    DOC>   objects in the database. Recompilation time is proportional to the
    DOC>   number of invalid objects in the database, so this command may take
    DOC>   a long time to execute on a database with a large number of invalid
    DOC>   objects.
    DOC>
    DOC>   Use the following queries to track recompilation progress:
    DOC>
    DOC>   1. Query returning the number of invalid objects remaining. This
    DOC>      number should decrease with time.
    DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
    DOC>
    DOC>   2. Query returning the number of objects compiled so far. This number
    DOC>      should increase with time.
    DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
    DOC>
    DOC>   This script automatically chooses serial or parallel recompilation
    DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
    DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
    DOC>   On RAC, this number is added across all RAC nodes.
    DOC>
    DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
    DOC>   recompilation. Jobs are created without instance affinity so that they
    DOC>   can migrate across RAC nodes. Use the following queries to verify
    DOC>   whether UTL_RECOMP jobs are being created and run correctly:
    DOC>
    DOC>   1. Query showing jobs created by UTL_RECOMP
    DOC>         SELECT job_name FROM dba_scheduler_jobs
    DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
    DOC>
    DOC>   2. Query showing UTL_RECOMP jobs that are running
    DOC>         SELECT job_name FROM dba_scheduler_running_jobs
    DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
    DOC>#
    
    PL/SQL procedure successfully completed.
    
    
    TIMESTAMP
    --------------------------------------------------------------------------------
    COMP_TIMESTAMP UTLRP_END  2010-07-02 18:23:50
    
    
    PL/SQL procedure successfully completed.
    
    DOC> The following query reports the number of objects that have compiled
    DOC> with errors (objects that compile with errors have status set to 3 in
    DOC> obj$). If the number is higher than expected, please examine the error
    DOC> messages reported with each object (using SHOW ERRORS) to see if they
    DOC> point to system misconfiguration or resource constraints that must be
    DOC> fixed before attempting to recompile these objects.
    DOC>#
    
    OBJECTS WITH ERRORS
    -------------------
                      0
    
    DOC> The following query reports the number of errors caught during
    DOC> recompilation. If this number is non-zero, please query the error
    DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
    DOC> are due to misconfiguration or resource constraints that must be
    DOC> fixed before objects can compile successfully.
    DOC>#
    
    ERRORS DURING RECOMPILATION
    ---------------------------
                              0
    
    
    PL/SQL procedure successfully completed.
    
    SQL> spool off
    
    /*
      When the script utlrp.sql completes go ahead and verify if all the components are 
      upgraded to 10.2.0.4
    */
    set lines 10000
    set pages 1000
    column comp_name format a40
    column version format a12
    column status format a6
    select comp_name, version, status from sys.dba_registry;
    
    COMP_NAME                                VERSION      STATUS
    ---------------------------------------- ------------ ------
    Oracle Database Catalog Views            10.2.0.4.0   VALID
    Oracle Database Packages and Types       10.2.0.4.0   VALID
    Oracle Workspace Manager                 10.2.0.4.3   VALID
    JServer JAVA Virtual Machine             10.2.0.4.0   VALID
    Oracle XDK                               10.2.0.4.0   VALID
    Oracle Database Java Packages            10.2.0.4.0   VALID
    Oracle Expression Filter                 10.2.0.4.0   VALID
    Oracle Data Mining                       10.2.0.4.0   VALID
    Oracle Text                              10.2.0.4.0   VALID
    Oracle XML Database                      10.2.0.4.0   VALID
    Oracle Rule Manager                      10.2.0.4.0   VALID
    Oracle interMedia                        10.2.0.4.0   VALID
    OLAP Analytic Workspace                  10.2.0.4.0   VALID
    Oracle OLAP API                          10.2.0.4.0   VALID
    OLAP Catalog                             10.2.0.4.0   VALID
    Spatial                                  10.2.0.4.0   VALID
    Oracle Enterprise Manager                10.2.0.4.0   VALID
    
    17 rows selected.
    The above query shows that the database components are at 10.2.0.4 version now.

    Restore the database back to 10.2.0.1 if any thing failed

    Let's suppse the upgrade process fails, then you can always go back to 10.2.0.1 level be restoring the backup we took at the beginning of the process and start over the upgrade.
    Just shutdown the database and restore the backups as follows:
    $ echo $ORACLE_HOME
    /u01/apps/oracle/product/10.2.0/db_1
    
    $ cd /u01/apps/oracle/product/10.2.0/
    $ rm -fr db_1
    $ tar xzf /home/oracle/oraHomeBackup.tar.gz *
    
    /* This will restore the old ORACLE_HOME */
    
    $ cd /u01/apps/oracle/oradata/
    $ rm -fr ora10g
    $ tar xzf /home/oracle/ora10g.tar.gz *
    
    /* This will restore a consistent copy of datafiles, controlfiles and redo log files */
    
    Now start the database and see which version is it?
    $ sqlplus / as sysdba
    
    Connected to an idle instance.
    
    SQL> startup
    
    set lines 10000
    set pages 1000
    column comp_name format a40
    column version format a12
    column status format a6
    select comp_name, version, status from sys.dba_registry;
    
    COMP_NAME                                VERSION      STATUS
    ---------------------------------------- ------------ ------
    Oracle Database Catalog Views            10.2.0.1.0   VALID
    Oracle Database Packages and Types       10.2.0.1.0   VALID
    Oracle Workspace Manager                 10.2.0.1.0   VALID
    JServer JAVA Virtual Machine             10.2.0.1.0   VALID
    Oracle XDK                               10.2.0.1.0   VALID
    Oracle Database Java Packages            10.2.0.1.0   VALID
    Oracle Expression Filter                 10.2.0.1.0   VALID
    Oracle Data Mining                       10.2.0.1.0   VALID
    Oracle Text                              10.2.0.1.0   VALID
    Oracle XML Database                      10.2.0.1.0   VALID
    Oracle Rules Manager                     10.2.0.1.0   VALID
    Oracle interMedia                        10.2.0.1.0   VALID
    OLAP Analytic Workspace                  10.2.0.1.0   VALID
    Oracle OLAP API                          10.2.0.1.0   VALID
    OLAP Catalog                             10.2.0.1.0   VALID
    Spatial                                  10.2.0.1.0   VALID
    Oracle Enterprise Manager                10.2.0.1.0   VALID
    
    17 rows selected.
    
    We are back again from where we started.