Sunday 15 February 2015

Upgradation of 11.2.O.2 to 11.2.O.3

            Upgradation of 11.2.O.2 to 11.2.O.3
1.LogIn to the oracle User
[root@standalone ~]# su - oracle
2. Check the version of the present running database
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

3. To Enable the GUI mode open another terminal and run 'xhost+' from root user

[root@standalone ~]# xhost +
access control disabled, clients can connect from any host

4. check the zipped software files specified folder

bash-3.2$ pwd
/upgrade

5.Unzip those softwares from 'Root' User itself

[root@standalone upgrade]# unzip p10404530_112030_Linux-x86-64_1of7.zip
 [root@standalone upgrade]# unzip p10404530_112030_Linux-x86-64_2of7.zip

6. those files are extracted in to a new folder named 'Database' Automatically

bash-3.2$ pwd
/upgrade/database
bash-3.2$ ls -ltr
total 64
-rwxr-xr-x  1 root root  5466 Aug 23  2011 welcome.html
drwxr-xr-x 12 root root  4096 Sep 19  2011 doc
-rwxr-xr-x  1 root root  3226 Sep 22  2011 runInstaller
drwxr-xr-x  2 root root  4096 Sep 22  2011 rpm
drwxr-xr-x  2 root root  4096 Sep 22  2011 response
drwxr-xr-x  4 root root  4096 Sep 22  2011 install
drwxr-xr-x 14 root root  4096 Sep 22  2011 stage
drwxr-xr-x  2 root root  4096 Sep 22  2011 sshsetup
-rwxr-xr-x  1 root root 28122 Sep 22  2011 readme.html


7. run setup file from 'Oracle' User and follow below screen shots
bash-3.2$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 17322 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8001 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-09-04_11-02-09AM. Please wait ...bash-3.2$






Unchek the checkbox to recieve security updates from oracle support
click on Yes  to continue the Installation


click on Yes  
select the option as skip software updates

Select on "Install database software only"

This is creating Single instance Database we can select for "single instance database installation"
Default it is in English language click on Next

select on "Enterprise Edition".


change the software home location to new Oracle Home let say "db_2" here




check the prerequisite here



Run the Following Script here from root user:



After completion of the oracle software installation, Follow the below steps for the upgradation 

8. login to database(11.2.0.2.0){db_1}  as sys user run utlu112i.sql from oracle 11.2.0.3.0{db_2} database software installed location
-bash-3.2$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 4 11:42:38 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

9. Run utlu112i.sql script will perform the pre upgrade checks.
SQL>@/u01/app/oracle/product/11.2.0/db_2/rdbms/admin/utlu112i.sql

Output of the above query is
Oracle Database 11.2 Pre-Upgrade Information Tool 01-24-2015 15:49:31
Script Version: 11.2.0.3.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name:          MYDB
--> version:       11.2.0.2.0
--> compatible:    11.2.0.0.0
--> blocksize:     8192
--> platform:      Linux x86 64-bit
--> timezone file: V14
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 713 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 493 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
--> EXAMPLE tablespace is adequate for the upgrade.
.... minimum required size: 309 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.

--> If Target Oracle is 64-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.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 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
--> Expression Filter            [upgrade]  VALID
--> Rule Manager                 [upgrade]  VALID
--> Oracle Application Express   [upgrade]  VALID
... APEX will only be upgraded if the version of APEX in
... the target Oracle home is higher than the current one.
--> Oracle OLAP API              [upgrade]  VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
        PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> Database contains schemas with objects dependent on DBMS_LDAP package.
.... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
.... USER APEX_030200 has dependent objects.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:

    EXECUTE dbms_stats.gather_dictionary_stats;

**********************************************************************
Oracle recommends reviewing any defined events prior to upgrading.

To view existing non-default events execute the following commands
while connected AS SYSDBA:
  Events:
    SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
      WHERE  UPPER(name) ='EVENT' AND  isdefault='FALSE'

  Trace Events:
    SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
      WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'

Changes will need to be made in the init.ora or spfile.

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

AS we can check are pre-requsites are fine, we can proceed for the upgradation.

10.Follow the Recomendations and warnings
Before that we should purge the DBA_RECYCLE BIN as suggested by above script output.
Also gather dictionary stats

SQL> purge dba_recyclebin;
SQL> EXECUTE dbms_stats.gather_dictionary_stats;
SQL>

11. After completing the above steps, copy the initfile of the database for 11.2.0.2{db_1} home to 11.2.0.3 home{db_2}

-bash-3.2$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
-bash-3.2$ cp initmydb.ora /u01/app/oracle/product/11.2.0/db_2/dbs

12. change the oracle home location in /etc/oratab pointing to new oracle home and change the in the user profile

-bash-3.2$ vi /etc/oratab
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
mydb:/u01/app/oracle/product/11.2.0/db_2:N

13. Log in to the system as the owner of the Oracle Database 11g Release 2 (11.2.0.3) Oracle home directory.
-bash-3.2$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_2
-bash-3.2$ export PATH=$ORACLE_HOME/bin:$PATH
-bash-3.2$ startup upgrade
ORACLE instance started.

Total System Global Area 1720328192 bytes
Fixed Size                  2222200 bytes
Variable Size            1308624776 bytes
Database Buffers          402653184 bytes
Redo Buffers                6828032 bytes
Database mounted.
Database opened.

14. Run the catupgrd.sql  for the $ORACLE_HOME/rdbms/admin location.
catupgrd.sql will actually upgrade the database.
SQL>@/u01/app/oracle/product/11.2.0/db_2/rdbms/admin/catupgrd.sql

After complete of above upgrade step it disconnect  from database
15. After completing the catupgrd.sql, Startup the instance & run utlu112s.sql, the Post-Upgrade Status Tool, which provides a summary of the upgrade at the end of the spool log.

16. Run catuppst.sql, located in the ORACLE_HOME/rdbms/admin directory, to perform upgrade actions that do not require the database to be in UPGRADE mode:

SQL>@/u01/app/oracle/product/11.2.0/db_2/rdbms/admin/catuppst.sql
 TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP POSTUP_BGN 2013-07-02 20:25:40
 PL/SQL procedure successfully completed.
 This script will migrate the Baseline data on a pre-11g database
to the 11g database.
 ...                                       ...
... Completed Moving the Baseline Data    ...
...                                       ...
... If there are no Move BL Data messages ...
... above, then there are no renamed      ...
... baseline tables in the system.        ...
...                                       ...
...                                       ...
... 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.

 0 rows created.

Commit complete.

Table created.

2 rows created.

1 row updated.
2 rows updated.

0 rows updated.

Table dropped.

Commit complete.

0 rows updated.

Commit complete.

0 rows updated.

Commit complete.

0 rows updated.

Commit complete.

0 rows created.

Commit complete.

0 rows created.

Commit complete.

PL/SQL procedure successfully completed.

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP POSTUP_END 2013-07-02 20:25:44

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.
Generating apply and rollback scripts...
Check the following file for errors:
/apps/oracle11g/11.2.0.3/cfgtoollogs/catbundle/catbundle_PSU_ELOQDEV_GENERATE_2013Jul02_20_25_48.log
Apply script: /apps/oracle11g/11.2.0.3/rdbms/admin/catbundle_PSU_ELOQDEV_APPLY.sql
Rollback script: /apps/oracle11g/11.2.0.3/rdbms/admin/catbundle_PSU_ELOQDEV_ROLLBACK.sql

PL/SQL procedure successfully completed.

Executing script file...
SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/apps/oracle11g/11.2.0.3/cfgtoollogs/catbundle/' || 'catbundle_PSU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;
SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')

PL/SQL procedure successfully completed.

SQL> ALTER SESSION SET current_schema = SYS;
 Session altered.
 SQL> PROMPT Updating registry...
Updating registry...
SQL> INSERT INTO registry$history
  2    (action_time, action,
  3     namespace, version, id,
  4     bundle_series, comments)
  5  VALUES
  6    (SYSTIMESTAMP, 'APPLY',
  7     SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),
  8     '11.2.0.3',
  9     0,
 10     'PSU',
 11     'Patchset 11.2.0.2.0');
 1 row created.
 SQL> COMMIT;
 Commit complete.
 SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_MYDB_APPLY_2015Jan23_21_02_10.log

17.After that, Run utlrp.sql to compile the database objects.
SQL> @/u01/app/oracle/product/11.2.0/db_2/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2015-01-23 21:07:43

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  2015-01-23 21:16:35

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

Function created.
  
PL/SQL procedure successfully completed.
  
Function dropped.

PL/SQL procedure successfully completed.

18.Check below commands after completion of upgradation