Sunday 19 May 2013

Applying oracle patchset to upgrade from oracle 10.2.0.1 to 10.2.0.2

Applying oracle patch set to upgrade from 10.2.0.1 to 10.2.0.2

Database to be upgraded


SQL>select comp_name, version, status from sys.dba_registry;SQL> SQL> SQL> SQL> SQL> 

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.

SQL> 


Stop the dbconsole


[oracle@test1 ~]$ emctl stop dbconsole
TZ set to Asia/Calcutta
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0  
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://test1.localdomain:5500/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ... 
 ...  Stopped. 

Stop the listener


[oracle@test1 ~]$ lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAY-2013 22:22:55

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
[oracle@test1 ~]$ 

Backup the ORACLE_HOME and database files


Here I have copied the oracle_home and database files as compressed tar files as shown below. All the database files are stored in the same location.

[oracle@test1 oradata]$ pwd
/u01/app/oracle/oradata
[oracle@test1 oradata]$ tar -czf /home/oracle/manudb.tar.gz manudb
[oracle@test1 oradata]$ 


[oracle@test1 oradata]$ cd /u01/app/oracle/product/10.2.0/
[oracle@test1 10.2.0]$ ls
db_1
[oracle@test1 10.2.0]$ tar czf /home/oracle/ora10ghome.tar.gz db_1
[oracle@test1 10.2.0]$ 

Download the oracle pathset and install


Download the oracle patchset p4547817_10202_LINUX.zip and unzip it. The folder named Disk1 will be created.

[oracle@test1 Desktop]$ unzip p4547817_10202_LINUX.zip
[oracle@test1 Desktop]$cd Disk1/
[oracle@test1 Disk1]$./runInstaller

Click next




Check the oracle_home details and click next



Verify the summary details and click on install



Installation in progress



A popup window to run root.sh script will appear. Open a new terminal and log in as root user and execute the root.sh script. After completed the execution, click ok.


Take a backup of dbhome, oraenv and coraenv directories as executing root.sh script will override the files in those directories.

[oracle@test1 Disk1]$ cd $ORACLE_HOME/bin
[oracle@test1 bin]$ mv dbhome dbhome_10201
[oracle@test1 bin]$ mv oraenv oraenv_10201
[oracle@test1 bin]$ mv coraenv coraenv_10201
[oracle@test1 bin]$ 

[root@test1 ~]# /u01/app/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/app/oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory: [/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.
[root@test1 ~]# 



End of installation, click exit button



Now we have applied the patch set to ORACLE_HOME and then we need to upgrade the databases as well.

Start the database in upgrade mode.


SQL> startup upgrade;
ORACLE instance started.

Total System Global Area  436207616 bytes
Fixed Size                  1261284 bytes
Variable Size             130023708 bytes
Database Buffers          301989888 bytes
Redo Buffers                2932736 bytes
Database mounted.
Database opened.
SQL> 


Run the preupgrade script


Run the utlu102i.sql script to check whether the database is good for upgrade. Do the recommended changes before upgrading the database.
SQL> @?/rdbms/admin/utlu102i.sql
Oracle Database 10.2 Upgrade Information Utility    05-16-2013 23:17:55
.
**********************************************************************
Database:
**********************************************************************
--> name:       MANUDB
--> 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
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 230 MB
.... AUTOEXTEND additional space required: 0 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 58 MB
.... AUTOEXTEND additional space required: 38 MB
.
**********************************************************************
Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
WARNING: --> "streams_pool_size" needs to be increased to at least 50331648
WARNING: --> "session_max_open_files" needs to be increased to at least 20
.
**********************************************************************
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
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database contains INVALID objects prior to upgrade.
.... USER PUBLIC has 26 INVALID objects.
.... USER SYSMAN has 1 INVALID objects.
.... USER SYS has 10 INVALID objects.
.... USER WMSYS has 5 INVALID objects.
.

PL/SQL procedure successfully completed.

SQL> spool off
SQL> 


Run the upgrade script


SQL> @?/rdbms/admin/catupgrd.sql
.
.
.
.
.
.
.

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP RUL        2013-05-17 00:08:03
DBUA_TIMESTAMP RUL        VALID       2013-05-17 00:08:03


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UPGRD_END  2013-05-17 00:08:03
.
Oracle Database 10.2 Upgrade Status Utility           05-17-2013 00:08:03
.
Component                                Status         Version  HH:MM:SS
Oracle Database Server                    VALID      10.2.0.2.0  00:17:54
JServer JAVA Virtual Machine              VALID      10.2.0.2.0  00:06:28
Oracle XDK                                VALID      10.2.0.2.0  00:00:45
Oracle Database Java Packages             VALID      10.2.0.2.0  00:00:32
Oracle Text                               VALID      10.2.0.2.0  00:00:24
Oracle XML Database                       VALID      10.2.0.2.0  00:00:58
Oracle Data Mining                        VALID      10.2.0.2.0  00:00:26
OLAP Analytic Workspace                   VALID      10.2.0.2.0  00:00:34
OLAP Catalog                              VALID      10.2.0.2.0  00:01:11
Oracle OLAP API                           VALID      10.2.0.2.0  00:01:35
Oracle interMedia                         VALID      10.2.0.2.0  00:03:39
Spatial                                   VALID      10.2.0.2.0  00:00:53
Oracle Expression Filter                  VALID      10.2.0.2.0  00:00:18
Oracle Enterprise Manager                 VALID      10.2.0.2.0  00:01:02
Oracle Rule Manager                       VALID      10.2.0.2.0  00:00:11
.
Total Upgrade Time: 00:36:58
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> 


Run the post upgrade script.


The invalid objects after upgradation needs to be compiled.  Run the utlrp.sql script for recompiling the invalid objects.

First shutdown the database, startup in normal mode and execute the utlrp.sql script.


SQL> @?/rdbms/admin/utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2013-05-17 00:13:58
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>#

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2013-05-17 00:14:58
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



Now the whole database and  the oracle software is upgraded to 10.2.0.2 .


SQL>select comp_name, version, status from sys.dba_registry;
SQL> SQL> SQL> SQL> SQL> 
COMP_NAME                                VERSION      STATUS
---------------------------------------- ------------ ------
Oracle Database Catalog Views            10.2.0.2.0   VALID
Oracle Database Packages and Types       10.2.0.2.0   VALID
Oracle Workspace Manager                 10.2.0.1.0   VALID
JServer JAVA Virtual Machine             10.2.0.2.0   VALID
Oracle XDK                               10.2.0.2.0   VALID
Oracle Database Java Packages            10.2.0.2.0   VALID
Oracle Expression Filter                 10.2.0.2.0   VALID
Oracle Data Mining                       10.2.0.2.0   VALID
Oracle Text                              10.2.0.2.0   VALID
Oracle XML Database                      10.2.0.2.0   VALID
Oracle Rule Manager                      10.2.0.2.0   VALID
Oracle interMedia                        10.2.0.2.0   VALID
OLAP Analytic Workspace                  10.2.0.2.0   VALID
Oracle OLAP API                          10.2.0.2.0   VALID
OLAP Catalog                             10.2.0.2.0   VALID
Spatial                                  10.2.0.2.0   VALID
Oracle Enterprise Manager                10.2.0.2.0   VALID
SQL> 



No comments:

Post a Comment