Downgrading from Oracle Database11g to Oracle Database 10g at CLI [Command Line Interface]

I would like to share the downgrade process of Oracle Database 11gR2 to 10gR2.


11GR2 ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
10GR2 ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1

Step: Checking the current instance details on current database

SYS@OTRANS 29-DEC-10> select instance_name from v$instance;
INSTANCE_NAME
----------------
otrans


Step: This is important, make sure you have set the compatible parameter to the version in which you would like to downgrade to, in this example its 10.2.0.3.0
SYS@OTRANS 29-DEC-10> show parameter compatible
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 10.2.0.3.0

SYS@OTRANS 29-DEC-10> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
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

Step: Prepare Oracle database for downgrade (11g Home)
SYS@OTRANS 29-DEC-10> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@OTRANS 29-DEC-10> STARTUP DOWNGRADE
ORACLE instance started.

Total System Global Area 939495424 bytes
Fixed Size 2232088 bytes
Variable Size 251658472 bytes
Database Buffers 679477248 bytes
Redo Buffers 6127616 bytes
Database mounted.
Database opened.


Step: Run catdwgrd.sql to downgrade --- this script is used from downgrading from the current release you have installed to the release in which you have upgraded from.

SYS@OTRANS 29-DEC-10> SPOOL downgrade-1023g.log
SYS@OTRANS 29-DEC-10> @?/rdbms/admin/catdwgrd.sql

SYS@OTRANS 29-DEC-10> Rem ***********************************************************************
SYS@OTRANS 29-DEC-10> Rem END catdwgrd.sql
SYS@OTRANS 29-DEC-10> Rem ***********************************************************************

SYS@OTRANS 29-DEC-10> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

Step: Define the ORACLE_HOME environment variable for SQLPLUS usage

$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
$ /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus /nolog

SYS@OTRANS 29-DEC-10> connect / as sysdba
Connected to an idle instance.

SYS@OTRANS 29-DEC-10> STARTUP UPGRADE
ORACLE instance started.

Total System Global Area 734003200 bytes
Fixed Size 2099136 bytes
Variable Size 192940096 bytes
Database Buffers 532676608 bytes
Redo Buffers 6287360 bytes
Database mounted.
Database opened.


Step: Execute catrelod.sql to reload all of the database components with their current versions in the downgraded database
SYS@OTRANS 29-DEC-10> SPOOL reload1023.log

SYS@OTRANS 29-DEC-10> @?/rdbms/admin/catrelod.sql


COMP_NAME STATUS VERSION
----------------------------------- ----------- ----------
Oracle Database Packages and Types VALID 10.2.0.3.0
Oracle Database Catalog Views VALID 10.2.0.3.0
JServer JAVA Virtual Machine VALID 10.2.0.3.0
Oracle XDK VALID 10.2.0.3.0
Oracle Database Java Packages VALID 10.2.0.3.0
Oracle Text VALID 10.2.0.3.0
Oracle XML Database VALID 10.2.0.3.0
Oracle Workspace Manager VALID 10.2.0.3.0
Oracle Data Mining VALID 10.2.0.3.0
OLAP Analytic Workspace VALID 10.2.0.3.0
OLAP Catalog VALID 10.2.0.3.0
Oracle OLAP API VALID 10.2.0.3.0
Oracle interMedia VALID 10.2.0.3.0

SYS@OTRANS 29-DEC-10> SPOOL OFF

Step: You have to make sure to Shutdown and Startup database then recompile all objects of the Database

SYS@OTRANS 29-DEC-10> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@OTRANS 29-DEC-10> startup
ORACLE instance started.

Total System Global Area 734003200 bytes
Fixed Size 2099136 bytes
Variable Size 247466048 bytes
Database Buffers 478150656 bytes
Redo Buffers 6287360 bytes
Database mounted.
Database opened.

SYS@OTRANS 29-DEC-10> @?/rdbms/admin/utlrp.sql

SYS@OTRANS 29-DEC-10> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

SYS@OTRANS 29-DEC-10> show parameter compatible

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 10.2.0.3.0

Now, my database was downgraded to 10.2.0.3, Please correct me if am missing something above. Looking forward for your views.

No comments:

Post a Comment