You are on page 1of 9

Database Upgrade: 8i to 9i

NOTE:

1. Database upgrade activity has to be tested in a Test environment


before the same is done in Production
2. Any third party application running on the upgraded database has to
have the required Vendor certification for the upgraded database
3. All Functional testing / certification of the application to be run on the
upgraded database has to be carried out by the Customer / Vendor
Application team
4. All test reports to be documented and published by the respective
teams
5. Unzip utility should be available on server.

Following are the steps to be followed for the upgrade:

Pre-Upgrade

 Perform a full COLD BACKUP with ORACLE_HOME partition

 Ensure plenty of free space in the SYSTEM tablespace - minimum 300MB

 Ensure sufficient free space is available in ROLLBACK tablespace. There has to be at


least 1 rollback segment of 70 MB if the number of objects in the database exceeds
5000.

 List all objects that are not VALID before the upgrade.

Select substr(owner,1,12) owner,


substr(object_name,1,30) object,
Substr(object_type,1,30) type,
status
from dba_objects
where status <>'VALID';

select distinct OWNER, TABLE_NAME


from DBA_TAB_COLUMNS
where DATA_TYPE in ('NCHAR','NVARCHAR2', 'NCLOB')
and OWNER not in ('SYS','SYSTEM');

The above statement should returns no rows.

 Check for corruption in the dictionary. Use the following commands in sqlplus.

Set verify off


Set feedback off
Set pages 1000
Spool analyze.sql
Select 'Analyze ' || object_type ||' '|| object_name ||'
validate structure;' from dba_objects
where owner='SYS' and object_type in ('INDEX', 'TABLE',
'CLUSTER');
spool off

This creates a script called analyze.sql. Run this script.


 Ensure that all Snapshot refreshes are successfully completed and replication is
stopped.

Select distinct(trunc(last_refresh))
from dba_snapshot_refresh_times;

 Stop the listener for the database

lsnrctl stop

 Ensure no files need media recovery and also are in backup mode. Following
commands should return no rows.

Select * from v$recover_file;

Select * from v$backup where status != 'NOT ACTIVE';

 Resolve any outstanding unresolved distributed transactions.

Select * from dba_2pc_pending;

If this returns rows you should do the following:

Select local_tran_id from dba_2pc_pending;

Execute dbms_transaction.purge_lost_db_entry ('<LOCAL_TRAN_ID>');

Commit;

 Disable all batch and cron jobs.

 Ensure the users sys and system have 'SYSTEM' as their default tablespace.

Select username, default_tablespace from dba_users


where username in ('SYS','SYSTEM');

If you have to modify use the following SQL:

Alter user sys default tablespace SYSTEM;


Alter user system default tablespace SYSTEM;

 Optionally ensure the aud$ is in the system tablespace when auditing is enabled.

Select tablespace_name from dba_tables where table_name='AUD$';

 Note down where all control files are located.

Select * from v$controlfile;

 Note down all sysdba users.

Select * from v$pwfile_users;

 If a passwordfile is used copy it to the new location. On unix the default is

$ORACLE_HOME/dbs/orapw<SID>.
 Shutdown the database

$ sqlplus “/ as sysdba”
SQL> Shutdown immediate

 Make following changes in init.ora file (make a backup of the init.ora file before doing
these changes)

o Verify that the parameter DB_DOMAIN is set properly.

o Ensure there is a value for DB_BLOCK_SIZE

o Comment out the JOB_QUEUE_PROCESSES parameter

o Comment out the AQ_TM_PROCESSES parameter

o If archiving is enabled set LOG_ARCHIVE_START=TRUE

o Ensure that the USER_DUMP_DEST, BACKGROUND_DUMP_DEST and the


CORE_DUMP_DEST are set to an explicit directory

o Set the parameter _SYSTEM_TRIG_ENABLED explicitly to FALSE during the


upgrade

o Set the parameter OPTIMIZER_MODE to CHOOSE during the upgrade

o Comment out SNAPSHOT_REFRESH_XX parameters

o Either leave COMPATIBLE unset in your initialization parameter file or set


COMPATIBLE to 8.1.x (setting this parameter to a lower or a higher value than
8.1.X results in an error during the upgrade)

o If you are using a passwordfile set the parameter


REMOTE_LOGIN_PASSWORDFILE=NONE

o If you have set the parameter:


NLS_LENGTH_SEMANTICS to CHAR,
change the value to BYTE during the upgrade.

o If you are using a cluster database, set the parameter


CLUSTER_DATABASE=FALSE during the upgrade

o If the parameter RESOURCE_MANAGER_PLAN is set, comment it out.

o Check MAX_ENABLED_ROLES parameter value. Increase it if the number of


roles in the Database is close to its value. When upgrading to higher versions,
new roles might be added. If the Database already contains high number of
roles, upgrade scripts can fail with error ORA-01925.

o Ensure that the shared_pool_size and the large_pool_size are at least 150 MB

o Comment out obsolete parameters (list in appendix A)

 Check for adequate freespace on archive log destination file systems.

 If required copy the listener.ora and the tnsnames.ora to the new location
Update the oratab entry to set the new ORACLE_HOME and disable automatic startup:

<SID>:<new ORACLE_HOME>:N

 Update the environment variables like ORACLE_HOME and PATH using .profile file.

 For HP-UX systems verify the SHLIB_PATH parameter points to the new release
directories.

$ env | grep ORACLE_HOME


$ env | grep PATH
$ env | grep ORA_NLS33
$ env | grep ORACLE_BASE
$ env | grep LD_LIBRARY_PATH
$ env | grep ORACLE_PATH

HP-UX: $ env | grep SHLIB_PATH

 Change the permissions of all the database files, if you are using new o/s user for
upgrade.

Select ‘chown oracle:dba ‘ || name from v$datafile;


Select ‘chown oracle:dba ‘ || name from v$tempfile;
Select ‘chown oracle:dba ‘ || name from v$controlfile;
Select ‘chown oracle:dba ‘ || member from v$logfile;

Upgrade Process

 Run the upgrade script:

$ cd $ORACLE_HOME/rdbms/admin
Sqlplus /nolog
SQL> Connect / as sysdba

Use Startup MIGRATE when you are upgrading to Oracle 9.2:

SQL> Startup Migrate

 Spool the output so you can take a look at possible errors after the upgrade:

SQL> Spool Upgrade.log

 Run the appropriate script for your version.

From To Script to Run


8.1.7 9.2 u0801070.sql

 Display the contents of the component registry to determine which components need
to be upgraded:

SQL> Select comp_name, version, status from dba_registry;


 Run the script cmpdbmig.sql to upgrade the components, which can be upgrade with
the SYSDBA privilege:

SQL> @cmpdbmig.sql

The components upgraded by this script are:

o Jserver JAVAVM
o Oracle XDK for Java
o Oracle 9i RAC
o Oracle Data Mining
o OLAP analytical Workspace
o Oracle 9i Java Packages
o Messaging Gateway
o Oracle Workspace Manager
o OLAP Catalog
o Oracle Label Security.

Display the components, which were upgraded:

SQL> Select comp_name, version, status from dba_registry;

 End the spool of the upgrade:

SQL> Spool Off

Post Upgrade

 Restart the database:

SQL> Shutdown Immediate (DO NOT USE SHUTDOWN ABORT!!!!!)


SQL> Startup restrict

 Run script to recompile invalid pl/sql modules

SQL> @utlrp

If there are still objects that are not valid after running the script run the following:
spool invalid_post.lst

Select substr (owner,1,12) owner,


Substr(object_name,1,30) object,
Substr(object_type,1,30) type, status
from dba_objects where status <>'VALID';

spool off

 Now compare the invalid objects in the above created file 'invalid_post.lst' with the
invalid objects before the database was upgraded (page 1, point 4)

There should be no dictionary objects invalid.


 Edit init.ora file:

o Leave the parameter JOB_QUEUE_PROCESSES=0

o Leave the parameter AQ_TM_PROCESSES=0

o Remove the parameter _system_trig_enabled from the init.ora file (this


parameter was explicitly set to false during the upgrade)

o Modify the parameter log_archive_dest (specify only the path) Make sure it
ends with a '/' (remove the format)

e.g. log_archive_dest = /path/arch into


log_archive_dest=/path/

o Modify the parameter log_archive_format and add the format that was
previously removed from the log_archive_dest
E.g log_archive_format = arch%t_SID_%s.log

o If you are using a password file set the REMOTE_LOGIN_PASSWORDFILE


parameter to the value used before migration.

Shutdown and startup the database.

$ sqlplus /nolog

SQL> Connect sys/passwd_for_sys as sysdba

SQL> Shutdown

SQL> Startup restrict

 Create a server parameter file with initialization parameter file

SQL> Create spfile from pfile;

This will create a spfile as a copy of the init.ora file located in the
$ORACLE_HOME/dbs directory.

 Modify the listener.ora file to change ORACLE_HOME, port etc. parameters.

 For the upgraded intstance modify the ORACLE_HOME parameter to point to the new
ORACLE_HOME.

 Start the listener

$ lsnrctl
LSNRCTL> start <listenername>

 Enable cron and batch jobs

 Change oratab entry to use automatic startup


SID:ORACLE_HOME:Y

 Check the rollback segments that are online to take then offline and drop.

select 'alter rollback segment ' || segment_name || '


offline;' from dba_rollback_segs
where status='ONLINE' and segment_name<>'SYSTEM';

select 'drop rollback segment ' || segment_name || ';' from


dba_rollback_segs
where segment_name<>'SYSTEM';

 Drop the current rollback tablespace.

 Create new undo tablespace and add sufficient space.

Create undo tablespace undotbs ‘<path>’ size 2000M;

 Add following entries in init.ora file of undo tablespace.

NAME VALUE
------------------------------------ ---------
undo_management AUTO
undo_retention 9600
undo_suppress_errors TRUE
undo_tablespace UNDOTBS

 To use the new features in 9i, change the compatible parameter to the new release.

When everything is well tested, update the compatible parameter in the init.ora and
restart the database with the new release number.

COMPATIBLE=9.0.X

Where x is the release number

 Remove all the hidden parameters from pfile/spfile and bounce the database.

The “_system_trig_enabled” parameter was set previously, which should be


removed.
SQL> Shutdown immediate
SQL> Startup

 Following parameters can be introduce/removed to use Oracle9i new features.

Parameters to remove –

Sort_area_size
sort_area_retained_size

Parameter to add –

workarea_size_policy
pga_aggregate_target

Appendix A: Obsolete parameters in 9i

_average_dirties_half_life
_lm_statistics
allow_partial_sn_results
always_anti_join
always_semi_join
arch_io_slaves
b_tree_bitmap_plans
backup_disk_io_slaves
cache_size_threshold
cleanup_rollback_entries
close_cached_open_cursors
compatible_no_recovery
complex_view_merging
cpu_count
db_block_checkpoint_batch
db_block_lru_extended_statisti
db_block_lru_latches
db_block_lru_statistics
db_block_max_dirty_target
db_file_simultaneous_writes
delayed_logging_block_cleanout
discrete_transactions_enabled
distributed_lock_timeout
distributed_recovery_connectio
distributed_transactions
fast_full_scan_enabled
freeze_DB_for_fast_instance_re
gc_defer_time
gc_latches
gc_lck_procs
gc_releasable_locks
gc_rollback_locks
hash_multiblock_io_count
instance_nodeset
job_queue_interval
job_queue_keep_connections
large_pool_min_alloc
lgwr_io_slaves
lm_locks
lm_procs
lm_procs
lm_ress
lock_sga_areas
log_block_checksum
log_files
log_simultaneous_copies
log_small_entry_max_size
ogms_home
ops_admin_group
ops_interconnects
optimizer_percent_parallel
optimizer_search_limit
parallel_default_max_instances
parallel_min_message_pool
parallel_server_idle_time
parallel_transaction_resource_
push_join_predicate
row_cache_cursors
sequence_cache_entries
sequence_cache_hash_buckets
shared_pool_reserved_min_alloc
snapshot_refresh_interval
snapshot_refresh_keep_connecti
snapshot_refresh_processes
sort_direct_writes
sort_multiblock_read_count
sort_read_fac
sort_spacemap_size
sort_write_buffer_size
sort_write_buffers
spin_count
temporary_table_locks
text_enable
use_ism
dblink_encrypt_login
log_archive_buffers
log_archive_buffer_size

Deprecated parameters:

DRS_START replaced by DG_BROKER_START


MTS_CIRCUITS replaced by CIRCUITS
MTS_DISPATCHERS replaced by DISPATCHERS
MTS_MAX_DISPATCHERS replaced by MAX_DISPATCHERS
MTS_MAX_SERVERS replaced by MAX_SHARED_SERVERS
MTS_SERVERS replaced by SHARED_SERVERS
MTS_SESSIONS replaced by SHARED_SERVER_SESSIONS
PARALLEL_SERVER replaced by CLUSTER_DATABASE
PARALLEL_SERVER_INSTANCES replaced by CLUSTER_DATABASE_INSTANCES