You are on page 1of 5

DOWNGRADE ORACLE DATABASE FROM 11.2.0.1.0 TO 10.2.0.5.

DOWNGRADE DATABASE FROM 11.2.0.1 TO 10.2.0.5

This is just a test scenario downgrade Oracle Database from 11.2.0.1 to 10.2.0.5 on LINUX OS for
Self Practice. In this article I explain step by step how to downgrade database from 11g to 10g.
Oracle database can be downgraded from to the release from which you upgraded.
Database upgraded from 10.2.0.5.0 to 11.2.0.1.0
Its possible only to downgrade to 10.2.0.5.0 and you cannot to downgrade 11.1.X or 10.1.X.
Once you decided to downgrade do NOT change COMPATIBLE parameter.
After upgrade is complete, you can increase the setting of the compatible initialization parameter.
However after you increase COMPATIBLE parameter, the database subsequently cannot be downgraded.
After upgraded to 11g, direct downgrade of EM is not supported. Refer NOTE: 870877.1.
This is test database, in my case, I do not have enterprise manager.
11g $ORACLE_HOME : /u01/app/oracle/product/11.2.0/db_home
10g $ORACLE_HOME : /u02/app/oracle/product/10.2.0/db_home

SQL> 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

TNS for Linux: Version 11.2.0.1.0 - Production


NLSRTL Version 11.2.0.1.0 - Production
SYS> show parameter compatible;
NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------compatible

string

10.2.0.5.0

# STOP LISTENER
$ lsnrctl stop <listener_name>
...
# STOP EM CONSOLE

$ stop emctl dbconsole


...
# SHUT DATABASE
SYS> shut immediate;
...
# STARTUP WITH DOWNGRADE
SYS> startup downgrade;
...

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

DOWNGRADE ORACLE DATABASE FROM 11.2.0.1.0 TO 10.2.0.5.0

# EXECUTE DOWNGRADE SCRIPT


SYS> drop user sysman cascade;
...
SYS> spool downgrade.log
SYS> @?/rdbms/admin/catdwgrd.sql;
..
..
SYS> SELECT 'COMP_TIMESTAMP DWGRD_END ' ||
2

TO_CHAR(SYSTIMESTAMP,'YYYY-MM-DD HH24:MI:SS ')

TO_CHAR(SYSTIMESTAMP,'J SSSSS ')

AS timestamp FROM DUAL;

||

TIMESTAMP
----------------------------------------------------------COMP_TIMESTAMP DWGRD_END 2015-10-10 09:13:50 2457306 33230
1 row selected.
SQL>
SQL> Rem ***********************************************************************
SQL> Rem END catdwgrd.sql
SQL> Rem ***********************************************************************
SYS> spool off;
SYS> shut immediate;
...

# EXPORT 10g $ORACLE_HOME


$ export ORACLE_HOME=/u02/app/oracle/product/10.2.0/db_home
$ /u02/app/oracle/product/10.2.0/db_home/bin/sqlplus /nolog
SQL> conn sys as sysdba
...
SYS> startup upgrade;
...
SYS> spool catrelod.log
SYS> @?/rdbms/admin/catrelod.sql;
..
...
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
TIMESTAMP
------------------------------------------------COMP_TIMESTAMP RELOD_END

2015-10-10 10:04:26

1 row selected.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

DOWNGRADE ORACLE DATABASE FROM 11.2.0.1.0 TO 10.2.0.5.0

COMP_NAME

STATUS

VERSION

----------------------------------- ----------- ---------Oracle Database Packages and Types

VALID

10.2.0.5.0

Oracle Database Catalog Views

VALID

10.2.0.5.0

JServer JAVA Virtual Machine

VALID

10.2.0.5.0

Oracle XDK

VALID

10.2.0.5.0

Oracle Database Java Packages

VALID

10.2.0.5.0

Oracle Text

VALID

10.2.0.5.0

Oracle XML Database

VALID

10.2.0.5.0

Oracle Workspace Manager

VALID

10.2.0.5.0

Oracle Data Mining

VALID

10.2.0.5.0

OLAP Analytic Workspace

VALID

10.2.0.5.0

OLAP Catalog

VALID

10.2.0.5.0

Oracle OLAP API

VALID

10.2.0.5.0

Oracle interMedia

VALID

10.2.0.5.0

Spatial

INVALID

10.2.0.5.0

Oracle Expression Filter

INVALID

10.2.0.5.0

Oracle Rule Manager

INVALID

10.2.0.5.0

16 rows selected.
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC>

The above query lists the SERVER components now loaded in the

DOC>

database, along with their current version and status.

DOC>
DOC>

Please review the status and version columns and look for

DOC>

any errors in the spool log file.

DOC>

file, or any components are not VALID or not the correct 10.1.0

DOC>

patch version, consult the downgrade chapter of the current release

DOC>

Database Upgrade book.

If there are errors in the spool

DOC>
DOC>

Next shutdown immediate, restart for normal operation, and then

DOC>

run utlrp.sql to recompile any invalid application objects.

DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SYS> spool off;
SYS> shutdown immediate;
...
SYS> startup;
...

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

DOWNGRADE ORACLE DATABASE FROM 11.2.0.1.0 TO 10.2.0.5.0

# CHECK INVALID OBJECTS COUNT


SQL> select count(*) from dba_objects where status='INVALID';
COUNT(*)
---------867
1 row selected.

# EXECUTE UTLRP.SQL SCRIPT


SQL> @?/rdbms/admin/utlrp.sql
...
SYS> select count(*) from dba_objects where status='INVALID';
COUNT(*)
---------114
1 row selected.
SYS> select object_name,status, object_type,created from dba_objects where status='INVALID';
OBJECT_NAME

STATUS

OBJECT_TYPE

CREATED

------------------------------------------ ------- ------------------- --------MGMT_TARGET_BLACKOUTS

INVALID SYNONYM

19-APR-10

SETEMVIEWUSERCONTEXT

INVALID SYNONYM

19-APR-10

MGMT$ALERT_CURRENT

INVALID SYNONYM

19-APR-10

MGMT$ALERT_HISTORY

INVALID SYNONYM

19-APR-10

MGMT$AVAILABILITY_CURRENT

INVALID SYNONYM

19-APR-10

MGMT$AVAILABILITY_HISTORY

INVALID SYNONYM

19-APR-10

MGMT$BLACKOUT_HISTORY

INVALID SYNONYM

19-APR-10

MGMT$CLUSTER_INTERCONNECTS

INVALID SYNONYM

19-APR-10

MGMT$CSA_CLIENTS

INVALID SYNONYM

19-APR-10

MGMT$CSA_HOST_COOKIES

INVALID SYNONYM

19-APR-10

MGMT$CSA_HOST_CPUS

INVALID SYNONYM

19-APR-10

MGMT_PAF$PROCEDURES

INVALID SYNONYM

14-OCT-15

MGMT_PAF$INSTANCES

INVALID SYNONYM

14-OCT-15

MGMT_PAF$STATES

INVALID SYNONYM

14-OCT-15

MGMT_PAF$APPLICATIONS

INVALID SYNONYM

14-OCT-15

MGMT$ECM_CONFIG_HISTORY

INVALID SYNONYM

14-OCT-15

MGMT$ECM_CONFIG_HISTORY_KEY1

INVALID SYNONYM

14-OCT-15

MGMT$ECM_CONFIG_HISTORY_KEY2

INVALID SYNONYM

14-OCT-15

..
...

..
...

Basically synonym points to specific an object.


DBA_SYNONYMS lists their names, and to which schema and object they point?
If any objects doesn't exist anymore, they will become invalid.
Any guess, lets check it out.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

DOWNGRADE ORACLE DATABASE FROM 11.2.0.1.0 TO 10.2.0.5.0

SYS> select a.object_name, b.table_owner, b.table_name from dba_objects a , dba_synonyms b


where a.status!='VALID' and a.object_name=b.table_name;
OBJECT_NAME

TABLE_OWNE TABLE_NAME

---------------------------------------- ---------- -----------------------------..


...
MGMT_MESSAGES

SYSMAN

MGMT_MESSAGES

MGMT_PAF_PROCS_LATEST

SYSMAN

MGMT_PAF_PROCS_LATEST

MGMT_PAF_JOBS

SYSMAN

MGMT_PAF_JOBS

MGMT_PAF$PROCEDURES

SYSMAN

MGMT_PAF$PROCEDURES

MGMT_PAF$INSTANCES

SYSMAN

MGMT_PAF$INSTANCES

MGMT_PAF$STATES

SYSMAN

MGMT_PAF$STATES

MGMT_PAF$APPLICATIONS

SYSMAN

MGMT_PAF$APPLICATIONS

MGMT$ECM_CONFIG_HISTORY

SYSMAN

MGMT$ECM_CONFIG_HISTORY

MGMT$ECM_CONFIG_HISTORY_KEY1

SYSMAN

MGMT$ECM_CONFIG_HISTORY_KEY1

MGMT$ECM_CONFIG_HISTORY_KEY2

SYSMAN

MGMT$ECM_CONFIG_HISTORY_KEY2

MGMT$ECM_CONFIG_HISTORY_KEY3

SYSMAN

MGMT$ECM_CONFIG_HISTORY_KEY3

..
...
Already we have dropped SYSMAN schema before to downgrade the database.
Dropping an object does NOT drop their synonyms. So we can drop these synonyms.
SYS> spool invalid_synonym.log;
SYS> select 'drop ' || 'public synonym ' || OBJECT_NAME ||';'
from dba_objects where status ='INVALID';
..
...
SYS> spool off;
SYS> @invalid_synonym.log;
..
...
SYS> select object_name, status, object_type,created from dba_objects where status='INVALID';
no rows selected
SQL> show parameter dump_dest;
NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------background_dump_dest

string

/u02/app/oracle/admin/devdb/bdump

core_dump_dest

string

/u02/app/oracle/admin/devdb/cdump

user_dump_dest

string

/u02/app/oracle/admin/devdb/udump

REF_DOCS

http://docs.oracle.com/cd/E11882_01/server.112/e23633/downgrade.htm#UPGRD12554

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu