Vous êtes sur la page 1sur 12

Manual Upgrading Oracle Database From 11.2.0.4 to 12.2.0.

A manual upgrade consists of running SQL scripts and utilities from a command
line to upgrade a database to the new Oracle Database release.

Current ORCALE_HOME=/u01/app/oracle/product/11.2.0.4/db_1

New ORACLE_HOME=/u03/app/oracle/product/12.2/db_1

Database Name: Test

1. Run the preupgrade tool:

The preupgrade.jar Pre-Upgrade Information Tool is supplied with Oracle Database


12cR2.
This tool has reside in new oracle home.
/u03/app/oracle/product/12.2/db_1/rdbms/admin/preupgrade.jar

SYNTAX:
/u01/app/oracle/product/11.2.0.4/db_1/jdk/bin/java -jar
/u03/app/oracle/product/12.2/db_1/rdbms/admin/preupgrade.jar FILE DIR /u01/

After run the above tool we will get below sql files.

Run the preupgrade_fixup.sql


A. To remove EM console.

B. Run the below block for refresh the materialized views.

C. We have to increase the number of processes and purge the recycle bin
2. Shutdown the database:

Take full database backup. we should turn on the flashback database and create a
Guaranteed Restore Point which can be used to rollback if upgrade process fails.

select name,database_role,open_mode,flashback_on,log_mode from v$database;

NAME DATABASE_ROLE OPEN_MODE FLASHBACK_ON LOG_MODE


--------- ---------------- -------------------- ------------------ ------------
ORCL PRIMARY READ WRITE NO ARCHIVELOG

11:31:54 SYS@ORCL:1> show parameter recovery

NAME TYPE VALUE


------------------------------ ----------- --------------------------------------
--------------------------------------------------------------
db_recovery_file_dest string D:\oracle\flashback\orcl
db_recovery_file_dest_size big integer 2G
recovery_parallelism integer 0

11:31:56 SYS@ORCL:1> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,


GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE FROM V$RESTORE_POINT WHERE
GUARANTEE_FLASHBACK_DATABASE='YES';

no rows selected

Create Guaranteed restore point.

11:31:58 SYS@ORCL:1> CREATE RESTORE POINT BEFORE_11G_UPGRADE GUARANTEE FLASHBACK


DATABASE;

Restore point created.

11:32:41 SYS@ORCL:1>
11:33:27 SYS@ORCL:1> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE FROM V$RESTORE_POINT WHERE
GUARANTEE_FLASHBACK_DATABASE='YES';

NAME SCN TIME DATABASE_INCARNATION#


GUA STORAGE_SIZE
------------ ---------- ----------------------------------- ---------------------
--- ------------
BEFORE_11G_UPGRADE 1297697 14-JAN-18 11.32.39.000000000 AM
2 YES 52428800
Alert log shows

Mon Jan 14 11:32:39 2013


Starting background process RVWR
Mon Jan 14 11:32:39 2013
RVWR started with pid=25, OS id=7032
Allocated 3981204 bytes in shared pool for flashback generation buffer
Created guaranteed restore point BEFORE_UPGRADE

Note: Below you have to restore the DB if any thing happens.


1. startup nomount
2. FLASHBACK DATABASE TO RESTORE POINT BEFORE_11G_UPGRADE;

3. Copy the parameter and password file from the 11g home to the new 12c home.

4. Set new ORACLE HOME of 12c location:

export ORACLE_HOME=/u01/app/oracle/product/12.2/db_1/

start the database in upgrade mode.


5. Run catctl.pl

catctl.pl is introduce in Oracle Database 12c, Parallel Upgrade Utility replaces


the SQL Upgrade Utility catupgrd.sql. With Parallel Upgrade Utility, we can run
upgrade scripts and processes in parallel. Using this script will increase our
server CPU capacity and reduce the upgrade time.

-n is used for parallelism (new feature on oracle 12c)

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catctl.pl -d
$ORACLE_HOME/rdbms/admin -l /home/oracle/ -n 4 catupgrd.sql
6. Run “postupgrade_fixups.sql” .

A. To fix the manual error related to timezone

For 12cR2, the new timezone is 26. So once the db upgrade is completed, we have
to upgrade the dst timezone from 14 to 26

Download DBMS_DST_scriptsV1.9.zip file from metalink.

Check the timezone version:


Unzip DBMS_DST_scriptsV1.9.zip file we will get below sql files for upgrade the
timezone.

Check the Current Timezone detail:


Apply the New Timezone:

Check the timezone version:

Now it’s changed from 14 to 26.


7. Execute utlu122s.sql:

This tool is supplied with Oracle Database and displays the version and elapsed
upgrade time for each component in DBA_REGISTRY.
8. Execute catuppst.sql:

If an Oracle bundle patch or patch set update (PSU or BP) is installed in the
Oracle home, this script will automatically applies those patch set update to the
database.
9. Execute utlrp.sql script to compile invalid objects.

10. Set COMPATIBALE parameter value for 12.2.0 as well as start the listener
with 12.2 home.
11. Finally to check the component and version using dba_registry view.

--The End--

Vous aimerez peut-être aussi