Beruflich Dokumente
Kultur Dokumente
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 ?
Upgrade means the process of changing the data dictionary contents of a database to reflect
particular release.
Generally peoples are using MANUAL & DBUA method. But I would prefer to use DBUA method.
CONSIDERATION
DBUA automates the upgrade process by performing all of the tasks which are performed manually.
Some steps which can be performed when the database is running. If these steps can be done manually
before upgrading using DBUA, the downtime can be minimized.
ABOUT DBUA
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.
# First unzip file1 then unzip 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.
SANITY OPERATONS
...
SYS> @?/rdbms/admin/utlrp.sql;
...
Make sure no files need media recovery as well as nothing is in backup mode.
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. This procedure gather statistics for dictionary schemas SYS, SYSTEM, etc..
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.
SYS> @$ORACLE_HOME/rdbms/admin/utlvalid.sql;
SYS> spool analyze.log
SYS> @analyze.sql;
SYS> spool off;
$ vi dblink.sql
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.
PARAMETER VALUE
---------------------- ---------------
You may ignore this action. After upgraded to 11g, suppose you decide to downgrade from 11g to 10g
then direct downgrade of EM 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 870877.1.
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.
$ . ./db10g.env
$ echo $ORACLE_HOME
/u02/app/oracle/product/10.2.0/db_home
$ cd /u01/app/oracle/product/11.2.0/db_home/rdbms/admin
$ cp utlu112i.sql /tmp
$ cd /tmp
$ 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: DEVDB
--> version: 10.2.0.5.0
--> compatible: 10.2.0.1.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: 747 MB
.... AUTOEXTEND additional space required: 247 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 10 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 456 MB
.... AUTOEXTEND additional space required: 216 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 61 MB
**********************************************************************
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
.... SYSMAN
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.
.... 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.
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;
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('SYS',options=>'GATHER',estimate_percent =>
DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
# ADJUST JAVA_POOL_SIZE
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.
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.
$ vi db11.env
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
$ echo $ORACLE_HOME
/u02/app/oracle/product/10.2.0/db_home/
$ cd /u02/app/oracle/product/10.2.0/db_home/dbs
$ cp initdevdb.ora /u01/app/oracle/product/11.2.0/db_home/dbs/
$ cp orapwdevdb /u01/app/oracle/product/11.2.0/db_home/dbs/
$ isqlplusctl stop
...
# TO STOP LISTENER
$ cd /u02/app/oracle/product/10.2.0/
$ tar –czf /u04/bkp/orclhomebkp.tar.gz db_home
$ cd /u02/app/oracle/oradata
$ tar –czf /u04/bkp/devdb.tar.gz devdb
If you wish to take backup, take backup listener.ora, tnsnames.ora, sqlnet.ora file. But I would
configure new listener. Step by step details for setting listener for 11g $ORACLE_HOME.
$ . ./db11.env
$ netca
https://www.scribd.com/doc/131516826/Registering-Database-Service-With-Listener
https://www.scribd.com/doc/131514434/Oracle-Network-Configuration
5) Choose port number, Default Port number is 1521, but I am using 1598 (Non Default Port).
When you create a listener on a NON DEFAULT PORT, PMON tries to register the database service(s)
with this listener. PMON utilizes TNSENTRY naming method for this. PMON will look in tnsnames.ora
file for the value it found in LOCAL_LISTENER. If it does not find this entry in the tnsnames.ora
file, it will throw error. (Before start DBUA, you must add LOCAL_LISTENER entry in tnsnames.ora.
Click on NEXT
$ . ./db11g.env
$ cd /u01/app/oracle/product/11.2.0/db_home/bin
$ dbua
Click on NEXT
2) Select the database which you want to upgrade
Click on NEXT
Click on NEXT
DBUA shows some warnings that were not solved after running Pre-Upgrade (utlu112i.sql) script
Already DEVDB Database has been backed up, so I do not want take back up again.
Whether you want to move the datafiles while upgrade, though the "move datafile" check-box was not
highlighted when I upgraded.
CONNECT TO DEVDB
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
COUNT(*)
----------
0
# SET COMPITIBLE=11.2.0.1.0
SYS> startup;
...
POINTS TO NOTE :
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 running DBUA you
must add proper entry in 11g $ORACLE_HOME tnsnames.ora – (If you request to configure/upgrade EM).
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora
LISTENER_DEVDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = DEVSERVER)(PORT = 1598))
DEVDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DEVSERVER)(PORT = 1598))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = devdb)
)
)
$ vi listener.ora
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 = devdb)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_home)
)
)
devdb.__db_cache_size=620756992
devdb.__java_pool_size=67108864
devdb.__large_pool_size=4194304
devdb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
devdb.__pga_aggregate_target=322961408
devdb.__sga_target=964689920
devdb.__shared_io_pool_size=0
devdb.__shared_pool_size=264241152
devdb.__streams_pool_size=0
*.audit_file_dest='/u02/app/oracle/admin/devdb/adump'
*.compatible='11.2.0.1.0'
*.control_files='/u02/app/oracle/oradata/devdb/control01.ctl','/u02/app/oracle/oradata/devdb/
control02.ctl','/u02/app/oracle/oradata/devdb/control03.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='devdb'
*.db_recovery_file_dest_size=5242880000
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVDBXDB)'
*.event=''
*.java_pool_size=67108864
*.job_queue_processes=10
*.local_listener='LISTENER_DEVDB'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=320864256
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=964689920
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
background_dump_dest
core_dump_dest
user_dump_dest