10G ORACLE

11
10G ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1 11G ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1 Step: Upgrade Oracle Database 10.2.0.5 to 11.2.0.2 SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- orcl - Check "compatible" parameter SQL> show parameter compatible NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ compatible string 10.2.0.5.0 - Check Oracle Version SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 PL/SQL Release 10.2.0.5.0 - Production CORE 10.2.0.5.0 Production TNS for Linux: Version 10.2.0.5.0 - Production NLSRTL Version 10.2.0.5.0 - Production - Check by pre-upgrade script SQL> @utlu112i.sql Oracle Database 11.2 Pre-Upgrade Information Tool 12-29-2010 17:29:14 Script Version: 11.2.0.2.0 Build: 001. ********************************************************************** Database: ********************************************************************** --> name: ORCL

Transcript of 10G ORACLE

Page 1: 10G ORACLE

10G ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_111G ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1

Step: Upgrade Oracle Database 10.2.0.5 to 11.2.0.2SQL> select instance_name from v$instance;

INSTANCE_NAME----------------orcl

- Check "compatible" parameterSQL> show parameter compatible

NAME TYPE VALUE------------------------------------ ----------- ------------------------------compatible string 10.2.0.5.0

- Check Oracle VersionSQL> select * from v$version;

BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.5.0PL/SQL Release 10.2.0.5.0 - ProductionCORE 10.2.0.5.0 ProductionTNS for Linux: Version 10.2.0.5.0 - ProductionNLSRTL Version 10.2.0.5.0 - Production

- Check by pre-upgrade scriptSQL> @utlu112i.sqlOracle Database 11.2 Pre-Upgrade Information Tool 12-29-2010 17:29:14Script Version: 11.2.0.2.0 Build: 001.**********************************************************************Database:**********************************************************************--> name: ORCL--> version: 10.2.0.5.0--> compatible: 10.2.0.5.0--> blocksize: 8192--> platform: Linux x86 64-bit--> timezone file: V4....--> Oracle Catalog Views [upgrade] VALID

Page 2: 10G ORACLE

--> Oracle Packages and Types [upgrade] VALID--> JServer JAVA Virtual Machine [upgrade] VALID--> Oracle XDK for Java [upgrade] VALID--> Oracle Workspace Manager [upgrade] VALID--> OLAP Analytic Workspace [upgrade] VALID--> OLAP Catalog [upgrade] VALID--> EM Repository [upgrade] VALID--> Oracle Text [upgrade] VALID--> Oracle XML Database [upgrade] VALID--> Oracle Java Packages [upgrade] VALID--> Oracle interMedia [upgrade] VALID--> Spatial [upgrade] VALID--> Data Mining [upgrade] VALID--> Expression Filter [upgrade] VALID--> Rule Manager [upgrade] VALID--> Oracle OLAP API [upgrade] VALID...**********************************************************************Recommendations**********************************************************************Oracle recommends gathering dictionary statistics prior toupgrading the database.To gather dictionary statistics execute the following commandwhile connected as SYSDBA:

EXECUTE dbms_stats.gather_dictionary_stats;

**********************************************************************Oracle recommends reviewing any defined events prior to upgrading.

To view existing non-default events execute the following commandswhile connected AS SYSDBA:Events:SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'

Trace Events:SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'

Changes will need to be made in the init.ora or spfile.**********************************************************************- Gather stats and truncate AUD$ tableSQL> EXECUTE dbms_stats.gather_dictionary_stats;

SQL> truncate table SYS.AUD$ drop storage;

Page 3: 10G ORACLE

- Start to upgrade by "catupgrd.sql" scriptSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

$ cp /u01/app/oracle/product/10.2.0/db_1/dbs/orapworcl /u01/app/oracle/product/11.2.0/dbhome_1/dbs/$ cp /u01/app/oracle/product/10.2.0/db_1/dbs/spfileorcl.ora /u01/app/oracle/product/11.2.0/dbhome_1/dbs/$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1$ /u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog

SQL> connect / as sysdbaConnected to an idle instance.SQL>> startup upgrade;ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instanceORACLE instance started.

Total System Global Area 730714112 bytesFixed Size 2230080 bytesVariable Size 205523136 bytesDatabase Buffers 515899392 bytesRedo Buffers 7061504 bytesDatabase mounted.Database opened.

SQL> spool upgrade.logSQL> set echo onSQL> set termout onSQL> @?/rdbms/admin/catupgrd.sql...SQL> Rem Set errorlogging offSQL> SET ERRORLOGGING OFF;SQL>SQL> Rem *********************************************************************SQL> Rem END catupgrd.sqlSQL> Rem *********************************************************************After run "catupgrd.sql", Instance should shutdown

- Step to run "catuppst.sql" script(This is post upgrade script: only necessary when upgrading from ≥ 10.1)SQL> startupORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instanceORACLE instance started.

Page 4: 10G ORACLE

Total System Global Area 730714112 bytesFixed Size 2230080 bytesVariable Size 360712384 bytesDatabase Buffers 360710144 bytesRedo Buffers 7061504 bytesDatabase mounted.Database opened.

SQL> show parameter compatible

NAME TYPE VALUE------------------------------------ ----------- ------------------------------compatible string 10.2.0.5.0

SQL> select * from v$version;

BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.2.0PL/SQL Release 11.2.0.2.0 - ProductionCORE 11.2.0.2.0 ProductionTNS for Linux: Version 11.2.0.2.0 - ProductionNLSRTL Version 11.2.0.2.0 - Production

SQL> @?/rdbms/admin/catuppst.sql

- Generate fixed object statsSQL> exec dbms_stats.gather_fixed_objects_stats;

PL/SQL procedure successfully completed.

- RecompileSQL> @?/rdbms/admin/utlrp.sql

- Run post-Upgrade scriptSQL> @?/rdbms/admin/utlu112s.sql

- Compare invalid objects scriptsSQL> @?/rdbms/admin/utluiobj.sql

- Adjust time zone dataSQL> shutdownDatabase closed.Database dismounted.

Page 5: 10G ORACLE

ORACLE instance shut down.

SQL> startup upgradeORACLE instance started.

Total System Global Area 939495424 bytesFixed Size 2232088 bytesVariable Size 251658472 bytesDatabase Buffers 679477248 bytesRedo Buffers 6127616 bytesDatabase mounted.Database opened.

SQL> exec dbms_dst.begin_upgrade(new_version => 11);

PL/SQL procedure successfully completed.

SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

SQL> startupORACLE instance started.

Total System Global Area 939495424 bytesFixed Size 2232088 bytesVariable Size 251658472 bytesDatabase Buffers 679477248 bytesRedo Buffers 6127616 bytesDatabase mounted.Database opened.

SQL> declare num_of_failures number;begindbms_dst.upgrade_database(num_of_failures);dbms_output.put_line(num_of_failures);dbms_dst.end_upgrade(num_of_failures);dbms_output.put_line(num_of_failures);end;/- Check Oracle database after UpgradeSQL> select * from v$version;

BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.2.0PL/SQL Release 11.2.0.2.0 - ProductionCORE 11.2.0.2.0 ProductionTNS for Linux: Version 11.2.0.2.0 - Production

Page 6: 10G ORACLE

NLSRTL Version 11.2.0.2.0 - Production

SQL> show parameter compatible

NAME TYPE VALUE------------------------------------ ----------- ------------------------------compatible string 10.2.0.5.0

Need to Downgrade !!! Don't change "compatible" parameter

Step: Downgrade Oracle Database 11.2.0.2 to 10.2.0.5

- Check Oracle version and "compatible" parameterSQL> select * from v$version;

BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.2.0PL/SQL Release 11.2.0.2.0 - ProductionCORE 11.2.0.2.0 ProductionTNS for Linux: Version 11.2.0.2.0 - ProductionNLSRTL Version 11.2.0.2.0 - Production

SQL> show parameter compatible

NAME TYPE VALUE------------------------------------ ----------- ------------------------------compatible string 10.2.0.5.0

-- Make sure "compatible" parameter is not changed.

- Start Oracle database for downgrade (11gR2 Home)SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

SQL> STARTUP DOWNGRADEORACLE instance started.

Total System Global Area 939495424 bytesFixed Size 2232088 bytesVariable Size 251658472 bytesDatabase Buffers 679477248 bytesRedo Buffers 6127616 bytes

Page 7: 10G ORACLE

Database mounted.Database opened.

- If use EM, then drop EM userSQL> DROP USER sysman CASCADE;

User dropped.

- Run "catdwgrd.sql" script to downgradeSQL> SPOOL downgrade.logSQL> @?/rdbms/admin/catdwgrd.sql...SQL> Rem ***********************************************************************SQL> Rem END catdwgrd.sqlSQL> Rem ***********************************************************************- Shutdown databaseSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

- Start Oracle database from 10gR2 Home and use "sqlplus" from 10gR2$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1$ /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus /nolog

SQL> connect / as sysdbaConnected to an idle instance.

SQL> STARTUP UPGRADEORACLE instance started.

Total System Global Area 734003200 bytesFixed Size 2099136 bytesVariable Size 192940096 bytesDatabase Buffers 532676608 bytesRedo Buffers 6287360 bytesDatabase mounted.Database opened.

- Run "catrelod.sql" script reloads the appropriate version of all of the database components in the downgraded databaseSQL> SPOOL reload.log

Page 8: 10G ORACLE

SQL> @?/rdbms/admin/catrelod.sql...COMP_NAME STATUS VERSION----------------------------------- ----------- ----------Oracle Database Packages and Types VALID 10.2.0.5.0Oracle Database Catalog Views VALID 10.2.0.5.0JServer JAVA Virtual Machine VALID 10.2.0.5.0Oracle XDK VALID 10.2.0.5.0Oracle Database Java Packages VALID 10.2.0.5.0Oracle Text VALID 10.2.0.5.0Oracle XML Database VALID 10.2.0.5.0Oracle Workspace Manager VALID 10.2.0.5.0Oracle Data Mining VALID 10.2.0.5.0OLAP Analytic Workspace VALID 10.2.0.5.0OLAP Catalog VALID 10.2.0.5.0Oracle OLAP API VALID 10.2.0.5.0Oracle interMedia VALID 10.2.0.5.0...

SQL> SPOOL OFF

- Shutdown & Startup database and then recompileSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

SQL> startupORACLE instance started.

Total System Global Area 734003200 bytesFixed Size 2099136 bytesVariable Size 247466048 bytesDatabase Buffers 478150656 bytesRedo Buffers 6287360 bytesDatabase mounted.Database opened.

SQL> @?/rdbms/admin/utlrp.sql

- Check Oracle versionSQL> select * from v$version;

BANNER

Page 9: 10G ORACLE

----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.5.0PL/SQL Release 10.2.0.5.0 - ProductionCORE 10.2.0.5.0 ProductionTNS for Linux: Version 10.2.0.5.0 - ProductionNLSRTL Version 10.2.0.5.0 - Production

SQL> show parameter compatible

NAME TYPE VALUE------------------------------------ ----------- ------------------------------compatible string 10.2.0.5.0