Tuesday, February 5, 2013

Upgrade Oracle Patch




Environment
Linux x86 Suse ENT: Server 11
Oracle DB 10.2.0.1.0  TO  Oracle DB 10.2.0.4.0



Preparing for the upgrade to 10.2.0.4


Stop all Oracle Components.
 
oracle@afi-suse-node1:~/app/oracle/oracle/product/10.2.0/db_4/bin> ./emctl stop dbconsole

TZ set to Asia/china

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0

Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.


http://afi-suse-node1:5501/em/console/aboutApplication

Stopping Oracle Enterprise Manager 10g Database Control ...

... Stopped.

oracle@afi-suse-node1:~/app/oracle/oracle/product/10.2.0/db_4/bin> ./isqlplusctl stop

iSQL*Plus 10.2.0.1.0

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

Stopping iSQL*Plus ...

iSQL*Plus stopped.

oracle@afi-suse-node1:~/app/oracle/oracle/product/10.2.0/db_4/bin> ./lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-FEB-2013 13:44:08

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

The command completed successfully

oracle@afi-suse-node1:~/app/oracle/oracle/product/10.2.0/db_4/bin> ./sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 5 13:45:46 2013

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

SQL> conn / as sysdba

Connected.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

------------------------------------------------------------------------------------------------------------------



Backup of Oracle Home and Database


Cold backup of your database and a backup of your ORACLE_HOME.

cd /home/oracle/app/oracle/oradata

/* All my data files
   control files and
   log files

$ tar czf /home/oracle/oracle10g.tar.gz orac1e0g

$ echo $ORACLE_HOME
/home/orace/app/oracle/oracle/product/10.2.0/db_4

/* This is my ORACLE_HOME so I would make a tar archive of "db_1" directory. */

$ cd /home/oracle/apps/oracle/product/10.2.0/
$ tar czf /home/oracle/oraHomeBackup.tar.gz db_4


cd /home/oracle/Desktop
$ unzip p6810189_10204_Linux-x86.zip
$ cd Disk1/

SQL>./runInstaller
 




























































































Upgrade the database from 10.2.0.1 to 10.2.0.4



oracle@afi-suse-node1:~/app/oracle/oracle/product/10.2.0/db_4/bin> ./sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 5 14:24:42 2013

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup upgrade

ORACLE instance started.

Total System Global Area 536870912 bytes

Fixed Size 1268484 bytes

Variable Size 163579132 bytes

Database Buffers 364904448 bytes

Redo Buffers 7118848 bytes

Database mounted.

Database opened.

SQL> spool pre_upgrade.log


SQL> @/home/oracle/app/oracle/oracle/product/10.2.0/db_4/rdbms/admin/utlu102i.sql

Oracle Database 10.2 Upgrade Information Utility 02-05-2013 14:29:11

.

**********************************************************************

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: 499 MB

.... AUTOEXTEND additional space required: 9 MB

--> UNDOTBS1 tablespace is adequate for the upgrade.

.... minimum required size: 402 MB

.... AUTOEXTEND additional space required: 372 MB

--> SYSAUX tablespace is adequate for the upgrade.

.... minimum required size: 313 MB

.... AUTOEXTEND additional space required: 13 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.




 
$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus / as sysdba

SQL> spool upgrade.log
SQL> @catupgrd.sql
.
.
.
[output trimmed]
.
.
.
.

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UPGRD_END  2013-02-05 15:13:16
.
Oracle Database 10.2 Upgrade Status Utility           02-05-2013 15:13:16
.
Component                                Status         Version  HH:MM:SS
Oracle Database Server                    VALID      10.2.0.4.0  00:16:53
JServer JAVA Virtual Machine              VALID      10.2.0.4.0  00:04:04
Oracle XDK                                VALID      10.2.0.4.0  00:00:38
Oracle Database Java Packages             VALID      10.2.0.4.0  00:00:32
Oracle Text                               VALID      10.2.0.4.0  00:00:39
Oracle XML Database                       VALID      10.2.0.4.0  00:02:32
Oracle Workspace Manager                  VALID      10.2.0.4.3  00:00:53
Oracle Data Mining                        VALID      10.2.0.4.0  00:00:28
OLAP Analytic Workspace                   VALID      10.2.0.4.0  00:00:42
OLAP Catalog                              VALID      10.2.0.4.0  00:01:26
Oracle OLAP API                           VALID      10.2.0.4.0  00:01:23
Oracle interMedia                         VALID      10.2.0.4.0  00:05:01
Spatial                                   VALID      10.2.0.4.0  00:02:16
Oracle Expression Filter                  VALID      10.2.0.4.0  00:00:20
Oracle Enterprise Manager                 VALID      10.2.0.4.0  00:01:51
Oracle Rule Manager                       VALID      10.2.0.4.0  00:00:15
.
Total Upgrade Time: 00:40:01
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> exit  
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@afi-suse-node1:~/app/oracle/oracle/product/10.2.0/db_4/bin> ./sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 5 15:17:03 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  536870912 bytes
Fixed Size      1268484 bytes
Variable Size    197133564 bytes
Database Buffers   331350016 bytes
Redo Buffers      7118848 bytes
Database mounted.
Database opened.
SQL>
-----------------------------------------------------------------------------------------------------------------

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.


SQL> @/home/oracle/app/oracle/oracle/product/10.2.0/db_4/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2013-02-05 15:51:10
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>#
1
PL/SQL procedure successfully completed.

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2013-02-05 15:52:42

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> SQL>   1* select COUNT(*) "ERRORS DURING RECOMPILATION" from utl_recomp_errors

------------------------------------------------------------------------------------------------------------------


SQL> set lines 10000
SQL> set pages 1000
SQL> column comp_name format a40
SQL> column version format a12
SQL> column status format a6
SQL> 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.
SQL>