You are on page 1of 20

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

UPGRADE DATABASE FROM 10.2.0.5 TO 11.2.0.1


This article is intended as a brief guide to upgrade Oracle Database from 10.2.0.5 to 11.2.0.1 on
LINUX OS for Self Practice. I explain step by step how to upgrade database from 10g to 11g. The
purpose of this article to minimize the downtime while upgrading the database using DBUA.
WHY UPGRADE ?

Several Bugs that are causing outages and/or business impacts?


Upgrade your database because numerous Bugs fixed.
Several new features deployed with higher versions.
Improved Performance and Scalability for latest versions rather than previous versions.
Already Thousands of customers upgraded their database from lower versions to recent versions.
Extended support fee can be avoided; no bug fixes unless you pay extra fee to get extended support.
Upgrade means the process of changing the data dictionary contents of a database to reflect
particular release.
Upgrading from 10.2.X to 11.2.X is a major release upgrade.
Ex: 10.2.0.5.0 to 11.2.0.1.0
Upgrading from 10.2.0.X to 10.2.0.X is a patch set upgrade.
EX: 10.2.0.1 to 10.2.0.5

IMPORTANT POINTS BEFORE YOU START 11G UPGRADE

1. Read Chapter 1, 2 & 3 of Database Upgrade Guide here


2. Read 11g Installation Guide for your operating system from here
DIFFERENT WAYS TO UPGRADE AN ORACLE DATABASE.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

Generally peoples are using MANUAL & DBUA method. But I would prefer to use DBUA method.
DBUA

Database Upgrade Assistant Recommended by Oracle.

MANUAL Using SQL scripts and utilities.


In this article, we are going to use MANUAL option. We can learn many more when we do it manually.
When you perform upgrade process using manual option, we can re-run catupgrd.sql as many times.

MANUAL UPGRADE PROCESS

SECTION 1 falls under Pre-Upgrade.


SECTION 2 falls under actual Database Upgrade.
SECTION 3 falls under Post-Upgrade.
To perform Pre-Upgrade steps that you do NOT require down time, you must be finished before
downtime starts. Before start upgrade process finish 11g installation on preferred mount point.

INSTALL 11g ORACLE DATABASE SOFTWARE

Download 11g Software from here.

Transfer files to target server and unzip those files.

Install only 11g s/w in separate location.

Step by step 11g installation on OEL explained here.

UNZIP DOWNLOADED FILES

# FIRST UNZIP 1st FILE THEN 2nd FILE. DO NOT UNZIP PARALLELLY BOTH FILES.
$ cd /u04/software
$ unzip linux_11gR2_database_1of2.zip
$ unzip linux_11gR2_database_2of2.zip
Once you unzip both files, you will get database directory; then need to change the ownership of
that s/w or else set the appropriate permissions to oracle user to install the database s/w.
EXAMPLE FOR 11g $ORACLE_HOME LOCATION

$ mkdir p /u01/app/oracle/product/11.2.0/db_home

WHY SEPARATE $ORACLE_HOME FOR 11g

We cannot upgrade existing 10g $ORACLE_HOME for 11g database.


11g is NOT a Patchset. We have to install 11g $ORACLE_HOME separately.
To upgrade existing database into 11g, install only Oracle 11g Server software into new location.

$ORACLE_HOME for 10g : /u02/app/oracle/product/10.2.0/db_home


$ORACLE_HOME for 11g : /u01/app/oracle/product/11.2.0/db_home
Ensure that all database components/objects provided by Oracle are VALID in the source database
prior to starting upgrade. Lets start the process.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

CONNECT TO THE DATABASE & FIX DUPLICATE OBJECTS

Check for duplicate objects in SYS and SYSTEM schemas.


Ensure that you do NOT have duplicate objects in the SYS and SYSTEM schema.
# FIND DUPLICATE OBJECTS FROM SYS AND SYSTEM
SYS> select OBJECT_NAME, OBJECT_TYPE from DBA_OBJECTS
where OBJECT_NAME||OBJECT_TYPE in
(select OBJECT_NAME||OBJECT_TYPE from DBA_OBJECTS
where OWNER='SYS') and OWNER='SYSTEM';
OBJECT_NAME

OBJECT_TYPE

---------------------- ------------------AQ$_SCHEDULES

TABLE

AQ$_SCHEDULES_PRIMARY

INDEX

DBMS_REPCAT_AUTH

PACKAGE

DBMS_REPCAT_AUTH

PACKAGE BODY

Please refer 1030426.6 How to clean up duplicate objects owned by SYS & SYSTEM schema. I would not
be clean anything from SYS & SYSTEM schema. IMO, it is safe to leave above items as it is.
CHECK INTEGRITY OF THE SOURCE DATABASE AND SANITY OPERATONS

# PURGE THE RECYCLEBIN


SYS> purge dba_recyclebin;
# VERIFY INSTALLED COMPNENTS, VERSION AND STATUS
SYS> select comp_name, version, status from sys.dba_registry;
...
# FIX ALL INVALID OBJECTS BEFORE UPGRADE PROCESS
SYS> select object_name, object_type, owner FROM dba_objects where status='INVALID';
...
# IF YOU FIND ANY INVALID OBJECTS, EXECUTE FOLLOWING SCRIPT
SYS> @?/rdbms/admin/utlrp.sql;
...
Should be NO invalid objects from SYS and SYSTEM schema.
Recompile all invalid objects using utlrp.sql before upgrade process.

CHECK ANY FILES IN MEDIA RECOVERY/BACKUP MODE

SYS> select * from v$recover_file;


no rows selected.
SYS> select * from v$backup where status != 'NOT ACTIVE';
no rows selected.
Make sure no files need media recovery as well as nothing is in backup mode.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

GATHER DICTIONARY STATS

In order to reduce the amount of downtime, you can collect statistics prior to perform actual
database upgrade. As of 10g Oracle Database, Oracle recommends to use DBMS_STATS procedure to
gather statistics. Following procedure gather statistics for dictionary schemas SYS, SYSTEM, etc.
# STATISTICS FOR ALL DICTIONARY OBJECTS
SYS> EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;
...
If you ignore to keep stats up to date on data dictionary, then updating itself time taking process.
Oracle recommends collect stats on you dictionary as part of pre-upgrade task prior to downtime.
CHECK ANY CORRUPTION IN THE DICTIONARY

# EXECUTE AS SYS SCHEMA


SYS> spool analyze.sql;
SYS> SELECT 'Analyze cluster "'||cluster_name||'" validate structure cascade;'
FROM dba_clusters WHERE owner='SYS' UNION
SELECT 'Analyze table "'||table_name||'" validate structure cascade;'
FROM dba_tables WHERE owner='SYS'
AND partitioned='NO'
AND (iot_type='IOT' OR iot_type is NULL)
UNION
SELECT 'Analyze table "'||table_name||'" validate structure cascade into invalid_rows;'
FROM dba_tables
WHERE owner='SYS' AND partitioned='YES';
SYS> spool off;
# TO FIND ANY LOGICAL CORRUPTION, EXECUTE FOLLOWING SCRIPTS
SYS> @$ORACLE_HOME/rdbms/admin/utlvalid.sql;
SYS> spool analyze.log
SYS> @analyze.sql;
SYS> spool off;
Should not return any error.
ORACLE DATABASE VAULT

If you have enabled Oracle Database vault option in your current home, you must disable it. If you
do not disable it, DBUA will return an error to disable prior to upgrade.
# CHECK ORACLE DATABASE VAULT IS ENABLED OR NOT
SYS> select * from v$option where parameter='Oracle Database Vault';
PARAMETER

VALUE

---------------------- --------------Oracle Database Vault FALSE


Please refer NOTE:453903.1 Enabling and disabling Oracle Database Vault in UNIX.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

SCRIPT TO TRACK FOR DATABASE LINKS

# DBLINK BACKUP (In case the database has to be downgraded again)


$ vi dblink.sql
SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10)
||DECODE(U.NAME,'PUBLIC',Null, 'SYS','',U.NAME||'.')|| L.NAME||chr(10)
||'CONNECT TO ' || L.USERID || ' IDENTIFIED BY "'||L.PASSWORD||'" USING
'''||L.HOST||''''
||chr(10)||';' TEXT
FROM SYS.LINK$ L, SYS.USER$ U
WHERE L.OWNER# = U.USER#;
SYS> spool dblink.log
SYS> @dblink.sql;
SYS> spool off;

BACK UP ENTERPRISE MANAGER DATABASE CONTROL DATA

You may ignore this action. After upgraded to 11g, suppose you decide to downgrade from 11g to 10g
then direct downgrade of Enterprise Manager is not supported. So it is better to save the EM data
and restore it back. The utility emdwgrd can be used to keep a copy of database control files and
data before upgrading your database. It resides in $ORACLE_HOME/bin directory.
Please refer NOTE 870877.1 How to save Oracle Enterprise Manager Database control data before
upgrading single instance database to other release?
RUN PRE-UPGRADE INFORMATION TOOL

Copy the Pre-Upgrade information script (utlu112i.sql) from 11g $ORACLE_HOME/rdbms/admin/ into
/tmp directory and start SQL*Plus. Execute the script. This script checks the database (which you
want to upgrade to 11g R2) and reports any changes need to be done before the upgrade process.
# SET 10G DATABASE ENV
$ . ./db10g.env
$ echo $ORACLE_HOME
/u02/app/oracle/product/10.2.0/db_home
# COPY utlu112i.sql SCRIPT

TO /tmp FROM

$ORACLE_HOME/rdbms/admin LOCATION.

$ cd /u01/app/oracle/product/11.2.0/db_home/rdbms/admin
$ cp utlu112i.sql /tmp
$ cd /tmp
# EXECUTE utlu112i.sql SCRIPT IN SOURCE DATABASE
SYS> spool pre_upgrade_11201_info.log
SYS> @/tmp/utlu112i.sql;
SYS> spool off;
SYS> exit

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

REVIEW PRE UPGRADE SCRIPT OUTPUT

$ cat pre_upgrade_11201_info.log
SQL> @/tmp/utlu112i.sql;
Oracle Database 11.2 Pre-Upgrade Information Tool

10-03-2015 23:05:57

.
**********************************************************************
Database:
**********************************************************************
--> name:

ORCL

--> version:

10.2.0.5.0

--> compatible:

10.2.0.5.0

--> blocksize:

8192

--> platform:

Linux IA (32-bit)

--> timezone file: V4


.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 693 MB
.... AUTOEXTEND additional space required: 243 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 474 MB
.... AUTOEXTEND additional space required: 449 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 453 MB
.... AUTOEXTEND additional space required: 213 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
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
WARNING: --> "java_pool_size" needs to be increased to at least 64 MB
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
--> background_dump_dest

11.1

DEPRECATED

replaced by "diagnostic_dest"

--> user_dump_dest

11.1

DEPRECATED

replaced by "diagnostic_dest"

--> core_dump_dest

11.1

DEPRECATED

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 is using a timezone file older than version 11.
WARNING: --> Database is using a timezone file older than version 11.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 10.2.0.5.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> Database contains schemas with stale optimizer statistics.
.... Refer to the Upgrade Guide for instructions to update
.... schema statistics prior to upgrading the database.
.... Component Schemas with stale statistics:
....

SYS

....

OLAPSYS

....

CTXSYS

....

XDB

WARNING: --> Database contains INVALID objects prior to upgrade.


.... The list of invalid SYS/SYSTEM objects was written to
.... registry$sys_inv_objs.
.... The list of non-SYS/SYSTEM objects was written to
.... registry$nonsys_inv_objs.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

.... Use utluiobj.sql after the upgrade to identify any new invalid
.... objects due to the 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 Upgrade Guide for instructions to configure Network ACLs.
.... USER ORACLE_OCM has dependent objects.
WARNING: --> EM Database Control Repository exists in the database.
.... Direct downgrade of EM Database Control is not supported. Refer to the
.... Upgrade Guide for instructions to save the EM data prior to upgrade.
WARNING:--> recycle bin in use.
.... Your recycle bin is turned on and it contains
.... 18 object(s).

It is REQUIRED

.... that the recycle bin is empty prior to upgrading


.... your database.
.... The command:

PURGE DBA_RECYCLEBIN

.... must be executed immediately prior to executing your upgrade.


.
PL/SQL procedure successfully completed.
Fix the warnings reported by the utlu112i.sql script.
I have fixed following warnings prior to upgrade with help of oracle docs.

FIX THE WARNINGS REPORTED BY PRE-UPGRADED TOOL

If the current database contains objects with stale optimizer statistics, then it would be better
to collect the statistics before upgrade process. If we ignore upgrade process will be slower
depending upon number of objects with stale optimizer statistics

$ vi statistics_gather.sql;
grant analyze any to SYS;
exec dbms_stats.gather_dictionary_stats;
exec dbms_stats.gather_schema_stats('WMSYS',options=>'GATHER',estimate_percent
=>DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
exec dbms_stats.gather_schema_stats('XDB',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
exec dbms_stats.gather_schema_stats('OUTLN',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
exec dbms_stats.gather_schema_stats('DBSNMP',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
exec dbms_stats.gather_schema_stats('SYSTEM',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
exec dbms_stats.gather_schema_stats('CTXSYS',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
exec dbms_stats.gather_schema_stats('OLAPSYS',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

exec dbms_stats.gather_schema_stats('SYS',options=>'GATHER',estimate_percent =>


DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
SYS> spool statistics_gather.log;
SYS> @statistics_gather.sql;
SYS> spool off;

# FIX DEPRECATED PARAMETERS FOR 11G DATABASE


SYS> alter system set background_dump_dest= '*' scope=spfile;
System altered.
SYS> alter system set core_dump_dest= '*' scope=spfile;
System altered.
SYS> alter system set user_dump_dest= '*' scope=spfile;
System altered.

# ADJUST JAVA_POOL_SIZE
SYS> alter system set java_pool_size=65m scope=spfile;
System altered.

# PRE-UPGRADED TOOL REPORTED WARNINGS FROM TABLESPACES SECTION


SYS> select tablespace_name from dba_data_files where autoextensible= 'YES';
...
Pre upgraded scrip reported some tablespaces need adequate space for upgrade process; they can
automatically extend by itself, if auto extendable option is enabled for those tablespaces. Using
above SQL statement you can verify which tablespaces have auto extend option.
If auto extend clause is not enabled, you can resize the tablespace at command line.
As per warnings, you need to resize required tablespaces to set sufficient space.

SQL> select file_name, file_id, tablespace_name from dba_data_files;


...
SYS> alter database datafile 1 resize 700m;
...
SYS> alter database datafile 2 resize 500m;
...
SYS> alter database datafile 3 resize 500m;
...

MISCELLANEOUS WARINGS

You can see bunch of various warnings about the current database. Even you ignore them, they may
make the upgrade to run slower and may effect some of Oracle features that you use. You need to
take care some warnings prior to upgrade and some after the upgrade.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

CREATE GUARANTEED RESTORE POINT

Its better to create GUARANTEED RESTORE POINT before to execute catupgrd.sql script. It uses
db_file_recovery_dest to keep the changed blocks, even if flashback logging is NOT enabled.
To create first guaranteed restore point when flashback off, you first start the database in mount
state after a consistent shut down. After opening in mount state you can create your first
guaranteed restore point. Set following parameter before you shut down the database.

SYS> show parameter db_recovery_file_dest;


NAME

TYPE

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

-----------

VALUE
------------------------------

db_recovery_file_dest

string

/u02/app/oracle/flash_recovery_area

db_recovery_file_dest_size

big integer

10G

SYS> create restore point grpt guarantee flashback database;


CREATE RESTORE POINT grpt GUARANTEE FLASHBACK DATABASE
*
ERROR at line 1:
ORA-38784: Cannot create restore point 'grpt'.
ORA-38787: Creating the first guaranteed restore point requires mount mode when flashback
database is off.
SYS> shut immediate;
...
SYS> startup mount;
...
SYS> create restore point GRPT guarantee flashback database;
...
SYS> SELECT NAME, SCN, TIME, DATABASE_INCARNATION# DI, GUARANTEE_FLASHBACK_DATABASE,
STORAGE_SIZE FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE='YES';
NAME

SCN TIME

DI GUA STORAGE_SIZE

---------- ---------- -------------------------------- ---------- --- -----------GRPT

546817 13-OCT-15 11.02.44.000000000 PM

2 YES

8192000

A guaranteed restore point ensures that you can use Flashback Database to rewind a database to its
state at the restore point SCN, even if the generation of flashback logs is disabled. Guaranteed
restore points never age out of the control file. They remain until they are explicitly dropped.

CREATE PFILE FROM SPFILE

# CREATE PFILE FROM SPFILE


SYS> create pfile from spfile;
File created.
SYS> shutdown immediate;
...

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

# COPY NEWLY CREATED PFILE FROM 10g $ORACLE_HOME/dbs to 11g $ORACLE_HOME/dbs


# COPY ORACLE PASSWORDFILE FROM 10g $ORACLE_HOME/dbs to 11g $ORACLE_HOME/dbs
$ echo $ORACLE_HOME
/u02/app/oracle/product/10.2.0/db_home/
$ cd /u02/app/oracle/product/10.2.0/db_home/dbs
$ cp initorcl.ora

/u01/app/oracle/product/11.2.0/db_home/dbs/

$ cp orapworcl

/u01/app/oracle/product/11.2.0/db_home/dbs/

Now adjust initialization parameters specific to 11g version of an Oracle Database.


1) Remove/comment deprecated parameters (background_dump_dest, core_dump_dest, user_dump_dest).
2) Set value of compatible parameter to 11.2.0.1.0
3) Add diagnostic_dest parameter to 11g $ORACLE_BASE
# REMOVE DEPRECATED PARAMETERS
*.background_dump_dest
*.core_dump_dest
*.user_dump_dest
# CHANGE COMPATIBLE;
*.compatible=11.2.0.1.0
# SET 11g $ORACLE_BASE
*.diagnostic_dest='/u01/app/oracle/'
Once you change value of COMPATIBLE to 11.2.0, the database subsequently cannot be downgraded.
CONFIGURE ENV FILE FOR 11G DATABASE

$ vi db11.env
# ENV SETUP FOR 11G DATABASE
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_home
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export EDITOR=vi
#. oraenv

NETWORK CONFIGURATION FOR 11G

When you create a listener on a NON-DEFAULT PORT, PMON will look for the value of LOCAL_LISTENER
in tnsnames.ora file. If it does NOT find this entry, it will throw error. Before you startup the
database using upgrade option, you must add proper entry in 11g $ORACLE_HOME tnsnames.ora file.
For 10g database, Listener configured port number: 1522
For 11g database, Listener configured port number: 1598
So I am adding LISTENER_ORCL in tnsnames.ora at 11g $ORACLE_HOME/network/admin

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

NETWOTK FILES

# LISTENER.ORA FILE CONFIGURATION


$ cd $ORACLE_HOME/network/admin
$ vi listener.ora
# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/db_home/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER11G =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DEVSERVER)(PORT = 1598))
)
)
ADR_BASE_LISTENER11G = /u01/app/oracle
SID_LIST_LISTENER11G =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_home)
)
)
# TNSSNAMES.ORA CONFIURATION
$ vi tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/db_home/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP) (HOST = devserver.com) (PORT = 1598))
ORCLDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = devserver.com)(PORT = 1598))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID_NAME = orcl)
(SERVICE_NAME = orcl)
)
)
If you ignore to add an entry, you face following error when startup your database.

ORA-00119: invalid specification for system parameter LOCAL_LISTENER


ORA-00132: syntax error or unresolved network name 'LISTENER_ORCL'

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

STOP 10g DATABASE COMPONENTS

# TO STOP ISQLPLUS (if it is running)


$ isqlplusctl stop
...
# TO STOP ENTERPRISE MANAGER DBCONSOLE
$ emctl stop dbconsole
...
# TO STOP LISTENER (10g & 11g)
$ lsnrctl stop listener_name
...
# BACKUP 10G $ORACLE_HOME
$ cd /u02/app/oracle/product/10.2.0/
$ tar czf /u04/bkp/orclhomebkp.tar.gz

db_home

I maintain all physical files at /u02/app/oracle/oradata/devdb/


I would prefer to take cold backup because I have downtime.

# BACKUP DATABASE PHYSICAL FILES CONTROLFILES, DATAFILES AND LOGFILES


$ cd /u02/app/oracle/oradata
$ tar czf /u04/bkp/orcl.tar.gz orcl

SET ENV VARIABLES & STARTUP THE DATABASE

Make environment variables ($ORACLE_HOME, $PATH) point to 11g $ORACLE_HOME


# SET YOUR ENVVIRONMENT VARIABLES TO 11G DATBASE
$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_SID=orcl
$ cd /u01/app/oracle/product/11.2.0/db_home/
$ rlsqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 14 00:35:42 2015
Copyright (c) 1982, 2009, Oracle.

All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS> startup upgrade;
...
SYS> set echo on;
SYS> spool upgrade.log

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

# EXECUTE THE UPGRADE SCRIPT


SYS> @?/rdbms/admin/catupgrd.sql;
SQL> Rem
SQL> Rem $Header: catupgrd.sql 29-mar-2007.12:50:24 cdilling Exp $
..
...
PL/SQL procedure successfully completed.
SQL>
SQL>
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> Rem Set errorlogging off
SQL> SET ERRORLOGGING OFF;
SQL>
SQL> Rem *********************************************************************
SQL> Rem END catupgrd.sql
SQL> Rem *********************************************************************
SYS> spool off;
SYS> exit
...
We can see once the upgrade completed, the database automatically shutdown.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

STARTUP THE DATABASE

$ sqlplus / as sysdba
...
SYS> startup;
...
SYS> select * from v$version;
BANNER
-------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE

11.2.0.1.0

Production

TNS for Linux: Version 11.2.0.1.0 - Production


NLSRTL Version 11.2.0.1.0 - Production
SYS> show parameter compatible;
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------compatible
string
11.2.0.1.0

CHECK THE UPGRADE SUMMARY

# EXECUTE POST UPGRADE SCRIPT.


# IF ANY INVALID COMPONENTS, THEN FIX IT MANUALLY
SYS> @?/rdbms/admin/utlu112s.sql;
.
Oracle Database 11.2 Post-Upgrade Status Tool
.
Component
Status
.
Oracle Server
.
VALID
JServer JAVA Virtual Machine
.
VALID
Oracle Workspace Manager
.
VALID
OLAP Analytic Workspace
.
VALID
OLAP Catalog
.
VALID
Oracle OLAP API
.
VALID
Oracle Enterprise Manager
.
VALID
Oracle XDK
.
VALID
Oracle Text
.
VALID
Oracle XML Database
.
VALID
Oracle Database Java Packages
.
VALID
Oracle Multimedia

10-14-2015 02:49:53
Version

HH:MM:SS

11.2.0.1.0

00:16:56

11.2.0.1.0

00:02:52

11.2.0.1.0

00:00:26

11.2.0.1.0

00:00:52

11.2.0.1.0

00:00:50

11.2.0.1.0

00:00:25

11.2.0.1.0

00:08:30

11.2.0.1.0

00:01:46

11.2.0.1.0

00:00:31

11.2.0.1.0

00:02:23

11.2.0.1.0

00:00:16

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

.
Spatial
.
Oracle Expression Filter
.
Oracle Rules Manager
.
Gathering Statistics
.
Total Upgrade Time: 00:48:22

VALID

11.2.0.1.0

00:03:55

VALID

11.2.0.1.0

00:04:13

VALID

11.2.0.1.0

00:00:07

VALID

11.2.0.1.0

00:00:10
00:04:02

PL/SQL procedure successfully completed.


# TO PERFORM UPGRADE ACTIONS THAT CHANGES THE DATABASE FROM UPGRADE MODE TO NORMAL MODE
SYS> @?/rdbms/admin/cauppst.sql;
...
# VERIFY UPGRADED COMPONENTS, VERSION AND STATUS
SQL> select comp_name,version, status from dba_registry;
COMP_NAME

VERSION

STATUS

---------------------------------------- ------------------------------ ----------Oracle Enterprise Manager

11.2.0.1.0

VALID

OLAP Catalog

11.2.0.1.0

VALID

Spatial

11.2.0.1.0

VALID

Oracle Multimedia

11.2.0.1.0

VALID

Oracle XML Database

11.2.0.1.0

VALID

Oracle Text

11.2.0.1.0

VALID

Oracle Data Mining

11.2.0.1.0

VALID

Oracle Expression Filter

11.2.0.1.0

VALID

Oracle Rules Manager

11.2.0.1.0

VALID

Oracle Workspace Manager

11.2.0.1.0

VALID

Oracle Database Catalog Views

11.2.0.1.0

VALID

Oracle Database Packages and Types

11.2.0.1.0

VALID

JServer JAVA Virtual Machine

11.2.0.1.0

VALID

Oracle XDK

11.2.0.1.0

VALID

Oracle Database Java Packages

11.2.0.1.0

VALID

OLAP Analytic Workspace

11.2.0.1.0

VALID

Oracle OLAP API

11.2.0.1.0

VALID

# FIND INVALID OBJECTS COUNT


SYS> select count(*) from dba_objects where status=INVALID;
...
# EXECUTE UTLRP.SQL SCRIPT TO MAKE OBJECTS AS VALID
SYS> @?/rdbms/admin/utlrp.sql;
...
# VERIFY ANY INVALID OBJECTS IS EXISTING OR NOT
SYS> select distinct object_name FROM dba_invalid_objects;
...

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

# GENERATE FIXED OBJECT STATS


SYS> exec dbms_stats.gather_fixed_objects_stats;
...
EXECUTE UTLUIOBJ.SQL SCRIPT

Once the upgrade is complete execute the script utluiobj.sql at 11g $ORACLE_HOME/rdbms/admin to
check if the upgrade caused any other objects to be invalid. Make sure there is nothing reported
by this script.
SQL> @?/rdbms/admin/utluiobj.sql
.
Oracle Database 11.1 Post-Upgrade Invalid Objects Tool 10-14-2015 03:22:07
.
This tool lists post-upgrade invalid objects that were not invalid
prior to upgrade (it ignores pre-existing pre-upgrade invalid objects).
.
Owner

Object Name

Object Type

.
PL/SQL procedure successfully completed.

UPGRADE TIMEZONE FILE VERSION

Oracle 11g provides a built in package DBMS_DST that can be used to evaluate the current timezone.
# EXECUTE DBMS_DST PACKAGE TO UPGRADE THE TIMEZONE FILE VERSION
SQL> select * from v$timezone_file;
FILENAME

VERSION

-------------------- ---------timezlrg_4.dat

SYS> shutdown immediate;


...
SYS> startup upgrade;
...
SYS> ELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME LIKE 'DST_%'
ORDER BY PROPERTY_NAME;
PROPERTY_NAME

VALUE

------------------------------ -----------------------------DST_PRIMARY_TT_VERSION

DST_SECONDARY_TT_VERSION

DST_UPGRADE_STATE

none

** Primary timezone file version is now 4 and secondary is 0. The upgrade state is NONE.**

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

SYS> exec DBMS_DST.BEGIN_UPGRADE(11);


PL/SQL procedure successfully completed.
SYS> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME LIKE 'DST_%'
ORDER BY PROPERTY_NAME;
PROPERTY_NAME

VALUE

------------------------------ -----------------------------DST_PRIMARY_TT_VERSION

11

DST_SECONDARY_TT_VERSION

DST_UPGRADE_STATE

UPGRADE

** Primary timezone file version is now 11 and secondary is 4. The upgrade state is UPGRADE.**
SYS> shutdown immediate;
...
SYS> startup;
...
SYS> set serveroutput on
VAR numfail number
BEGIN
DBMS_DST.UPGRADE_DATABASE(:numfail,
parallel

=> TRUE,

log_errors

=> TRUE,

log_errors_table

=> 'SYS.DST$ERROR_TABLE',

log_triggers_table

=> 'SYS.DST$TRIGGER_TABLE',

error_on_overlap_time

=> TRUE,

error_on_nonexisting_time => TRUE);


DBMS_OUTPUT.PUT_LINE('Failures:'|| :numfail);
END;
/
Table list: SYSMAN.MGMT_PROV_SUITE_INST_MEMBERS
Number of failures: 0
Table list: SYSMAN.MGMT_PROV_STAGING_DIRS
Number of failures: 0
Table list: SYSMAN.MGMT_PROV_RPM_REP
Number of failures: 0
..
...
Failures:0
PL/SQL procedure successfully completed.
SQL> print :numfail
NUMFAIL
---------0

/* If numfail is greater then 0 DBMS_DST.END_UPGRADE will fail. */

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

SYS> BEGIN
DBMS_DST.END_UPGRADE(:numfail);
END;
/
An upgrade window has been successfully ended.
PL/SQL procedure successfully completed.
SYS> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME LIKE 'DST_%'
ORDER BY PROPERTY_NAME;
PROPERTY_NAME

VALUE

------------------------------ -----------------------------DST_PRIMARY_TT_VERSION

11

DST_SECONDARY_TT_VERSION

DST_UPGRADE_STATE

NONE

SYS> select * from v$timezone_file;


FILENAME

VERSION

-------------------- ---------timezlrg_11.dat

11

The timezone file version is upgraded to 11 now.

# DROP GUARANTEED RESTORE POINT


SYS> drop restore point grpt;
...
# CREATE SPFILE FROM PFILE
SYS> create spfile from pfile;
...
SYS> shut immediate;
...
SYS> startup;
...
SYS> show parameter dump_dest;
NAME

TYPE

VALUE

---------------------------- ----------- -----------------------------background_dump_dest

string

/u01/app/oracle/diag/rdbms/orcl/orcl/trace

core_dump_dest

string

/u01/app/oracle/diag/rdbms/orcl/orcl/cdump

user_dump_dest

string

/u01/app/oracle/diag/rdbms/orcl/orcl/trace

SQL> show parameter diagnostic_dest;


NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------diagnostic_dest

string

/u01/app/oracle

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

UPGRADE ORACLE DATABASE FROM 10g TO 11g - MANUAL

SYS> show parameter local_listener;


NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------local_listener

string

LISTENER_ORCL

# UPDATE $ORACLE_HOME PATH IN ORATAB FILE


# vi /etc/oratab
..
...
orcl:/u02/app/oracle/product/10.2.0/db_home:N

# Remove an old entry

orcl:/u01/app/oracle/product/11.2.0/db_home:N

# Add a new entry

START THE LISTENER

$ lsnrctl start LISTENER11G


...
$ lsnrctl status LISTENER11G
...

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

You might also like