Professional Documents
Culture Documents
High Level Database Upgrade Steps From 10.2.0.5 To 11.2.0.1 - Manual PDF
High Level Database Upgrade Steps From 10.2.0.5 To 11.2.0.1 - Manual PDF
Generally peoples are using MANUAL & DBUA method. But I would prefer to use DBUA method.
DBUA
# 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
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
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
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
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
$ 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)
**********************************************************************
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
[upgrade]
VALID
VALID
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
--> EM Repository
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
--> Spatial
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
[upgrade]
VALID
[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
.... 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
PURGE DBA_RECYCLEBIN
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);
# ADJUST JAVA_POOL_SIZE
SYS> alter system set java_pool_size=65m scope=spfile;
System altered.
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.
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.
TYPE
------------------------
-----------
VALUE
------------------------------
db_recovery_file_dest
string
/u02/app/oracle/flash_recovery_area
db_recovery_file_dest_size
big integer
10G
SCN TIME
DI GUA STORAGE_SIZE
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.
/u01/app/oracle/product/11.2.0/db_home/dbs/
$ cp orapworcl
/u01/app/oracle/product/11.2.0/db_home/dbs/
$ 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
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
NETWOTK FILES
db_home
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
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>
DOC>
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.
$ 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
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
.
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
VERSION
STATUS
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
11.2.0.1.0
VALID
Oracle Text
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
Oracle XDK
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
11.2.0.1.0
VALID
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.
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
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.**
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,
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
VERSION
-------------------- ---------timezlrg_11.dat
11
TYPE
VALUE
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
TYPE
VALUE
string
/u01/app/oracle
TYPE
VALUE
string
LISTENER_ORCL
orcl:/u01/app/oracle/product/11.2.0/db_home:N