17
By: Rahul Gupta Path InfoTech Limited Client : L.G.Electronics /* Hi All , Kindly find the doc containing all the information about 10g Upgradation. This docs is based on the setup of “L.G. Electronics”. For further references, refer To the doc 316889.1 . More suggestion / modification on this are highly appreciated */ Prerequisites and recommendations : Install Oracle 10g Release-2 / Release-3 in a new Oracle Home. Kindly refer to the 10g installation guide for the same Install the 10g Companion CD for the base ORACLE 10g version. Compatibility Matrix a) Minimum Version of the database that can be directly upgraded 10gR2/10gr3 b) The following database version will require an indirect upgrade path. 7.3.3 (or lower) > 7.3.4 > 8.1.7 > 8.1.7.4 > 10.2.X.X.X 7.3.4 > 8.1.7 > 8.1.7.4 > 10.2.X.X.X 8.0.n > 8.1.7 > 8.1.7.4 > 10.2.X.X.X 8.1.n > 8.1.7 > 8.1.7.4 > 10.2.X.X.X NOTE : BEFORE UPGRADATION ACTIVITY TAKE THE COLD BACKUP OF DATABASE AND ORACLE_HOME 8.1.7.4 -> 10.2.X.X.X 9.0.1.4 or 9.0.1.5 -> 10.2.X.X.X 9.2.0.4 or higher -> 10.2.X.X.X 10.1.0.2 or higher -> 10.2.X.X.X Upgradation from 9i to 10g ( OS : AIX 5.3 ) NOTE : Before Starting the activity take the COLD Backup of Database and ORACLE_HOME

9i to 10g UpGradation

Embed Size (px)

Citation preview

Page 1: 9i to 10g UpGradation

By: Rahul Gupta Path InfoTech Limited Client : L.G.Electronics /* Hi All , Kindly find the doc containing all t he information about 10g Upgradation. This docs is based on the setup of “L.G. Electro nics”. For further references, refer To the doc 316889.1 . More suggestion / modification on this are highly appreciated */

���� Prerequisites and recommendations :

� Install Oracle 10g Release-2 / Release-3 in a new Oracle Home. Kindly refer to the 10g installation guide for the same

� Install the 10g Companion CD for the base ORACLE 10g version. � Compatibility Matrix

a) Minimum Version of the database that can be directl y upgraded 10gR2/10gr3

b) The following database version will require an indi rect upgrade path.

7.3.3 (or lower) > 7.3.4 > 8.1.7 > 8.1.7.4 > 10.2.X.X.X

7.3.4 > 8.1.7 > 8.1.7.4 > 10.2.X.X.X

8.0.n > 8.1.7 > 8.1.7.4 > 10.2.X.X.X

8.1.n > 8.1.7 > 8.1.7.4 > 10.2.X.X.X

NOTE : BEFORE UPGRADATION ACTIVITY TAKE THE COLD BA CKUP OF DATABASE AND ORACLE_HOME

8.1.7.4 -> 10.2.X.X.X

9.0.1.4 or 9.0.1.5 -> 10.2.X.X.X

9.2.0.4 or higher -> 10.2.X.X.X

10.1.0.2 or higher -> 10.2.X.X.X

Upgradation from 9i to 10g ( OS : AIX 5.3 )

NOTE : Before Starting the activity take the COLD Backup of Database and ORACLE_HOME

Page 2: 9i to 10g UpGradation

================ Upgradation Activity ===================================== Step 1 : Run the “utlu102i.sql” Copy the following files from the 10gR2 ORACLE_HOME /rdbms/admin directory to a directory outside of the Oracle home, such as the /tmp direct ory on your system sqlplus '/as sysdba' SQL> spool Database_Info.log SQL> @utlu102i.sql SQL> spool off --- ----- ------ ------ ------ -------- WARNING: --> DRSYS tablespace is not large enough f or the upgrade alter tablespace size of DRSYS tablespace need to be increased ---> atleast to 50 MB ====> WARNING: --> "streams_pool_size" is not currently d efined and needs a value of at least 50331648 WARNING: --> "session_max_open_files" needs to be i ncreased to at least 20 streams_pool_size=50331648 session_max_open_files=20 =======> --> "hash_join_enabled" --> "log_archive_start" Remove this parameter from the pfile of 9i ===> ...The 'JServer JAVA Virtual Machine' JAccelerator (NCOMP) is required to be installed from the 10g Co mpanion CD. ...The 'Oracle interMedia Image Accelerator' is req uired to be installed from the 10g Companion CD ====> WARNING: --> Passwords exist in some database links . .... Passwords will be encrypted during the upgrade . .... Downgrade of database links with passwords is not supported. WARNING: --> Deprecated CONNECT role granted to som e user/roles. .... CONNECT role after upgrade has only CREATE SES SION privilege. WARNING: --> Database contains stale optimizer stat istics. .... Refer to the 10g Upgrade Guide for instruction s to update .... statistics prior to upgrading the database. .... Component Schemas with stale statistics: .... SYS .... XDB .... OLAPSYS .... MDSYS WARNING: --> Database contains INVALID objects prio r to upgrade. .... USER ORAEQUS has 8 INVALID objects. ===>

Page 3: 9i to 10g UpGradation

--> New "SYSAUX" tablespace ....minimum required size for database upgrade: 500 MB

----- ------ -------- ---------- --- ################################################### ###################################### Step 2 : Take the backup sys.link$ and create a script of a ll the bd links . ===> DB_links password will be encrypted in ORACLE1 0g , So ,in case of downgrade password

will no be available . So, Please take the backup o f database link Create table db_link_backup as select * from sys.li nk$; select 'create database link '||name||'connect to'| |userid||'identified by '||password||';' from sys.link$; ################################################### ####################################### Step 3 : Check for the deprecated CONNECT Role User that contains CONNECT --> SELECT grantee FROM dba_role_privs WHERE granted_role = 'CONNECT' and grantee NOT IN ( 'SYS', 'OUTLN', 'SYSTEM', 'CTXSYS', 'DBSNMP', 'LOGSTDBY_ADMINISTRATOR', 'ORDSYS', 'ORDPLUGINS', 'OEM_MONITOR', 'WKSYS', 'WKPROXY', 'WK_TEST', 'WKUSER', 'MDSYS', 'LBACSYS', 'DMSYS', 'WMSYS', 'OLAPDBA', 'OLAPSVR', 'OLAP_USER', 'OLAPSYS', 'EXFSYS', 'SYSMAN', 'MDDATA', 'SI_INFORMTN_SCHEMA', 'XDB', 'ODM'); ===> grant them all priviliges , other than "CONNEC T" select 'CREATE VIEW, CREATE TABLE, ALTER SESSION,CR EATE CLUSTER,CREATE SESSION,CREATE SYNONYM,CREATE SEQUENCE,CREATE DATABASE LINK to '||grantee||';' from dba_role_privs WHERE granted_role = 'CONNECT' and grantee NOT IN ( 'SYS', 'OUTLN', 'SYSTEM', 'CTXSYS', 'DBSNMP', 'LOGSTDBY_ADMINISTRATOR', 'ORDSYS', 'ORDPLUGINS', 'OEM_MONITOR', 'WKSYS', 'WKPROXY', 'WK_TEST', 'WKUSER', 'MDSYS', 'LBACSYS', 'DMSYS', 'WMSYS', 'OLAPDBA', 'OLAPSVR', 'OLAP_USER', 'OLAPSYS', 'EXFSYS', 'SYSMAN', 'MDDATA', 'SI_INFORMTN_SCHEMA', 'XDB', 'ODM'); ################################################### ####################################### ( There is no table on our site , that required thi s step ) Step 4 : Data of table with "TIMESTAMP WITH TIMEZONE" can be affected . Thus to avoid

this .. Copy the files , to the temp location .. T hen the scripts need to be run

Page 4: 9i to 10g UpGradation

$ sqlplus '/as sysdba' SQL> spool TimeZone_Info.log SQL> @utltzuv2.sql SQL> spool off Scripts mentioned below will show you the column wi th "TIMESTAMP WITH TIMEZONE" .then back up the data in character format before you upgrade the database. After the upgrade, you must update the tables to ensure that the data is stored based on the new rules --------------------------------------------------- ------------------------------ SQL> @utltzuv2.sql DROP TABLE sys.sys_tzuv2_temptab * ERROR at line 1: ORA-00942: table or view does not exist Table created. Query sys.sys_tzuv2_temptab Table to see if any TIM EZONE data is affected by version 2 transition rules PL/SQL procedure successfully completed. Commit complete. SQL> spool off [ilomsdb01:ora9equs] /tmp> sysdba SQL*Plus: Release 9.2.0.8.0 - Production on Wed Jun 25 10:34:04 2008 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64b it Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.8.0 - Production SQL> select * from sys.sys_tzuv2_temptab; no rows selected --------------------------------------------------- ------------------------------------

OR : Suppose if there is any table SQL> desc test_table x number primary key y timestamp with time zone Now ,take the backup of this table SQL> create table test_table_backup as select * fro m test_table where 1=2; SQL> insert into test_table_backup select x,to_char (y, 'YYYY-MM-DD HH24.MI.SSXFF TZR') from test_table ; After the upgrade , run the update command to updat e the data according to new transition rule update test_table t set t.y = (select to_timestamp_ tz(t1.y,'YYYY-MM-DD HH24.MI.SSXFF TZR') from test_t able_backup t1 where t.x=t1.x);

################################################### ####################################### Step 5 : Starting in Oracle 9i the National Characterset (NL S_NCHAR_CHARACTERSET) will be

limited to UTF8 and AL16UTF16. Any other NLS_NCHAR _CHARACTERSET will no longer be supported. Basicaly N-datatype used this NLS-Charac terset conversion

NOTE: If you are upgrading from Oracle9i to 10g, Th en no NLS Characterset conversion is required

Page 5: 9i to 10g UpGradation

+------------+---------+-----------------+ | Charset | RDBMS | Unicode version | +------------+---------+-----------------+ | AL24UTFFSS | 7.2-8.1 | 1.1 | | | | | | UTF8 | 8.0-11g | 2.1 (8.0-8.1.6) | | | | 3.0 (8.1.7-11g) | | | | | | UTFE | 8.0-11g | 2.1 (8.0-8.1.6) | | | | 3.0 (8.1.7-11g) | | | | | | AL32UTF8 | 9.0-11g | 3.0 (9.0) | | | | 3.1 (9.2) | | | | 3.2 (10.1) | | | | 4.01(10.2) | | | | 5.0 (11.1) | | | | | | AL16UTF16 | 9.0-10g | 3.0 (9.0) | | | | 3.1 (9.2) | | | | 3.2 (10.1) | | | | 4.01(10.2) | | | | 5.0 (11.1) | +------------+---------+-----------------+ ---------------- Internal Use ---------- -------------- SQL> select distinct OWNER, TABLE_NAME from DBA_TAB _COLUMNS where DATA_TYPE in ('NCHAR','NVARCHAR2', ' NCLOB') and OWNER not in ('SYS','SYSTEM','XDB'); OWNER TABLE_NAME ------------------------------ -------------------- ---------- OE BOMBAY_INVENTORY OE PRODUCTS OE PRODUCT_DESCRIPTIONS OE SYDNEY_INVENTORY OE TORONTO_INVENTORY PM PRINT_MEDIA 6 rows selected. SQL> select * from nls_database_parameters where pa rameter ='NLS_NCHAR_CHARACTERSET'; PARAMETER VALUE ------------------------- ------------ NLS_NCHAR_CHARACTERSET AL16UTF16 = = = == == === == == == === For 8i to 10g upgradaion = = = = = = == == == == === == == = = = select distinct OWNER, TABLE_NAME from DBA_TAB_COL UMNS where DATA_TYPE in ('NCHAR','NVARCHAR2', 'NCLO B') and OWNER not in ('SYS','SYSTEM','XDB'); If no rows are returned it should mean that the da tabase is not using N-type columns for user data, s o simply go to the next step. SQL> select * from nls_database_parameters where p arameter ='NLS_NCHAR_CHARACTERSET'; If you are using N-type columns AND your National C haracterset is UTF8 or is in the following list: JA16SJISFIXED , JA16EUCFIXED , JA16DBCSFIXED , ZHT3 2TRISFIXED KO16KSC5601FIXED , KO16DBCSFIXED , US16TSTFIXED , Z HS16CGB231280FIXED ZHS16GBKFIXED , ZHS16DBCSFIXED , ZHT16DBCSFIXED , Z HT16BIG5FIXED ZHT32EUCFIXED

Page 6: 9i to 10g UpGradation

then also simply go to point next step. Otherwise --: * change the tables to use CHAR, VARCHAR2 or C LOB instead the N-type or * use export/import the table(s) containing N-t ype column and truncate those tables before migrati ng to 10g The recommended NLS_LANG during export is simply th e NLS_CHARACTERSET, not the NLS_NCHAR_CHARACTERSET ========= ========= ============== NLS Conversion f or 8i ====== ====== ====== = = = = = === ======== ===

################################################### ###################################### Step 6 : Stats Gathering When upgrading to Oracle Database 10g, optimizer st atistics are collected for dictionary tables that lack statistics. This statistics collec tion can be time consuming for databases with a large number of dictionary tables, but stat istics gathering only occurs for those tables that lack statistics or are significantly c hanged during the upgrade.

( A) --> First take the backup of existing stats .... $ sqlplus '/as sysdba' SQL>spool sdict SQL>grant analyze any to sys; SQL>exec dbms_stats.create_stat_table('SYS','dictst attab'); --- It'll create a new stat table

Note : It’s better if you take the backup of all the schemas of your database . Instead of the existing of that mentioned in the below … To take the backup of all the existing schema , use the steps given below .

$ sqlplus '/as sysdba' set echo off set feedback off set heading off spool stats_backup.sql Select 'exec dbms_stats.export_schema_stats('''||username||''',' ''||'dictstattab'||''',statown => '''||'SYS'||''');' from dba_users; spool off Now , remove all the unimportant lines from the st ats_backup.sql After this .., $ Sqlplus '/as sysdba' SQL>spool sdict SQL>grant analyze any to sys; SQL>@ stats_backup.sql SQL>spool off After this skip the step (A) and follow the step (B)

Page 7: 9i to 10g UpGradation

SQL>exec dbms_stats.export_schema_stats('WMSYS','di ctstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('MDSYS','di ctstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('CTXSYS','d ictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('XDB','dict stattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('WKSYS','di ctstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('LBACSYS',' dictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('OLAPSYS',' dictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('DMSYS','di ctstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('ODM','dict stattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('ORDSYS','d ictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('ORDPLUGINS ','dictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('SI_INFORMT N_SCHEMA','dictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('OUTLN','di ctstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('DBSNMP','d ictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('SYSTEM','d ictstattab',statown => 'SYS'); SQL>exec dbms_stats.export_schema_stats('SYS','dict stattab',statown => 'SYS'); SQL>spool off OR .., Run the sql "stats_exp_backup.sql" $ sqlplus " /as sysdba" SQL>@stats_exp_backup.sql ( B ) ---> Now , Gather the new statistics . This will al so reduce the downtime $ sqlplus '/as sysdba' SQL>spool gdict_stats.txt SQL>grant analyze any to sys; SQL>exec dbms_stats.gather_schema_stats('WMSYS',opt ions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('MDSYS',opt ions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('CTXSYS',op tions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('XDB',optio ns=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('WKSYS',opt ions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('LBACSYS',o ptions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('OLAPSYS',o ptions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('DMSYS',opt ions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('ODM',optio ns=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('ORDSYS',op tions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('ORDPLUGINS ',options=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('SI_INFORMTN_SCHEMA' ,options=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);

Page 8: 9i to 10g UpGradation

SQL>exec dbms_stats.gather_schema_stats('OUTLN',opt ions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('DBSNMP',op tions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('SYSTEM',op tions=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>exec dbms_stats.gather_schema_stats('SYS',optio ns=>'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE); SQL>spool off OR , Use the sql "gather_stats_9i.sql" $ sqlplus " /as sysdba" SQL>@gather_stats_9i.sql ################################################### ###################################### Step 7 : Invalid Count and compile the invalid Take a list of all the invalids object before upgrading spool invalid_pre.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='INVALID '; spool off After taking the list of invalids object , Now com pile the invalids .. % sqlplus '/as sysdba' SQL> @?/rdbms/admin/utlrp.sql OR $ sqlplus " /as sysdba" SQL> exec utl_recomp,parallel(4); -- Something like this . Refer to shift log regarding this ################################################### ######################################== Step 8 : Dictionary Conrruption check Check for corruption in the dictionary, use the fo llowing commands in sqlplus connected as sys: Set verify off Set space 0 Set line 120 Set heading off Set feedback off Set pages 1000 Spool analyze.sql Select 'Analyze cluster "'||cluster_name||'" valida te structure cascade;' from dba_clusters where owner='SYS' union Select 'Analyze table "'||table_name||'" validate s tructure cascade;' from dba_tables where owner='SYS' and partitioned='NO' and (iot_type='I OT' or iot_type is NULL)

Page 9: 9i to 10g UpGradation

union Select 'Analyze table "'||table_name||'" validate s tructure cascade into invalid_rows;' from dba_tables where owner='SYS' and partitioned='YES'; spool off This creates a script called analyze.sql. Now execute the following steps. $ sqlplus '/as sysdba' SQL> @$ORACLE_HOME/rdbms/admin/utlvalid.sql SQL> @analyze.sql This script (analyze.sql) should not return any err ors. ################################################### ######################################== Step 9 : Ensure that all Snapshot refreshes are successfully completed, and that replication is stopped. $ sqlplus '/ as sysdba' SQL> select distinct(trunc(last_refresh)) from dba_snapshot_refresh_times;

----------- ----------------- --------------------- ---------------------- SQL> select distinct(trunc(last_refresh)) from dba_ snapshot_refresh_times; (TRUNC(LA --------- 13-MAY-02 --------------------------------------------------- ----------------------

################################################### ######################################== Step 10 : Stop the listener and confirm that , there should be no file in recovery/backup mode Stop the listener for the database: $ lsnrctl LSNRCTL> stop Ensure no files need media recovery: $ sqlplus '/ as sysdba' SQL> select * from v$recover_file; ---- Ensure no f iles are in revovery mode: This should return no rows. SQL> select * from v$backup where status!='NOT ACTI VE'; --Ensure no files are in backup mode: This should return no row ################################################### ######################################== Step 11 : Check for Distributed transaction : Resolve any out standing unresolved

distributed transaction SQL> select * from dba_2pc_pending;

Page 10: 9i to 10g UpGradation

If this returns rows you should do the following: SQL> select local_tran_id from dba_2pc_pending; SQL> execute dbms_transaction.purge_lost_db_entry(' '); SQL> commit; ====>> Now disable , all the batch and cron jobs. Crontab –l > cronbackup Now , Hash all the program in the crontab ################################################### ######################################

Step 12: sys , system and table "aud$" should be there in sy stem tablespace : Otherwise change the default tablespace to system ..

SQL> select username, default_tablespace from dba_u sers where username in ('SYS','SYSTEM'); Ensure that the aud$ is in the system tablespace wh en auditing is enabled. SQL> select tablespace_name from dba_tables where t able_name='AUD$'; ################################################### ###################################### Step 13: ===> Drop table XDB.MIGR9202STATUS if it exist in t he databse ################################################### ###################################### Step 14: Note down where all control files are located. SQL> select * from v$controlfile; ################################################### ###################################### Step 15: NOW SHUTDOWN the database and take a full cold back up including ORACLE_HOME ( for security purpose ) OR take the RMAN online full bac kup [ No need to take the backup , As already taken ea rlier .. ] ------------------------------------------------ ------------------------ Issue the following RMAN commands: RUN { ALLOCATE CHANNEL chan_name TYPE DISK; BACKUP DATABASE FORMAT 'some_backup_directory%U' TA G before_upgrade; BACKUP CURRENT CONTROLFILE TO 'save_controlfile_loc ation';

} ------------------------------------------------ ------------------------- $ sqlplus '/as sysdba' SQL> shutdown immediate;

Page 11: 9i to 10g UpGradation

=================================================== =================================== ==================== PHASE 2 ================================ =============== Upgrading to the New Oracle Database 10g Release 2 ================= =================================================== =================================== ################################################### ###################################### Step 16: Copy the init file to the new ORACLE_HOME =====> Changes in INIT.ORA file * Comment out obsoleted parameters like hash_join_enabled , ( Please chk it againg also ) * Change all deprecated parameters like “log_archive_start” * Change the value of "COMPATIBLE" parameter : If upgradaing from 8i , Then set the value to 9.2 .0 If upgrading from 9.2.0 or 10.1.0 then leave the CO MPATIBLE parameter set to it's current value until the upgrade has been completed succes sfully .This will avoid any unnecessary ORA-942 errors from being reported in SMON trace files during the upgrade (because the

upgrade is looking for 10.2 objects that have not y et been created) Note : In out case there is no need to change the v alue of COMPATIBLE parameter * If you have the parameter NLS_LENGTH_SEMANTICS cu rrently set to CHAR, change the value

to BYTE during the upgrade .

Note : In our case there is no need to change the v alue as this bug has been resolved in 10.2.0.3

* Verify that the parameter DB_DOMAIN is set proper ly. * PGA_AGGREGATE_TARGET >= 24MB * SHARED_POOL_SIZE and the LARGE_POOL_SIZE should be greater than 150MB * JAVA_POOL_SIZE should be greater than 150MB * Ensure there is a value for DB_BLOCK_SIZE * Change the value of BDUMP ,CDUMP ,UDUMP * Comment AQ_TM_PROCESSES and JOB_QUEUE_PROCESSES parameter Now add .., AQ_TM_PROCESSES=0 JOB_QUEUE_PROCESSES=0 ( This is required for upg rade purpose , That's why hashed above ) * Set the parameter UNDO_MANAGEMENT=AUTO ################################################### ###################################### Step 17: Ensure the NLS_LANG variable is set correctly: $ env | grep $NLS_LANG ################################################### ###################################### Step 18: Copy the Network Configuration/init.ora/password file from old ORACLE_HOME to

new ORACLE_HOME $ cp $OLD_ORACLE_HOME/network/admin/*.ora $NE W_ORACLE_HOME/network/admin $ cp $OLD_ORACLE_HOME/dbs/init<SID>.ora $NEW_ ORACLE_HOME/dbs/ $ cp $OLD_ORACLE_HOME/dbs/orapw<SID> $NEW_ORA CLE_HOME/dbs/ ################################################### ######################################

Page 12: 9i to 10g UpGradation

Step 18: Update the enviorement setting according to new 1 0g enviorment ---> Update the oratab entry, to set the new OR ACLE_HOME and disable automatic startup: SID:ORACLE_HOME:N ---> Update the environment variables like ORAC LE_HOME and PATH $. oraenv ---> Make sure the following environment variab les point to the new release (10g)

directories: - ORACLE_HOME - PATH - ORA_NLS10 - ORACLE_BASE - LD_LIBRARY_PATH - LIBPATH (AIX only) - ORACLE_PATH $ env | grep ORACLE_HOME $ env | grep PATH $ env | grep ORA_NLS10 $ env | grep ORACLE_BASE $ env | grep LD_LIBRARY_PATH $ env | grep ORACLE_PATH $ env | grep LIBPATH ---> Unset ORA_NLS33 and set ORA_NLS10 to point to $ORACLE_HOME/nls/data ################################################### ###################################### Step 19: Datafile movement need to be done As in our case, we have created the different mount points for the database also. Thus file movement is also required . You can skip this step if you’re not changing the location of your database -------- -------- Datafile movement Activity--------------------------- ----------------------- ------------------------- ================ File that need to moved ======================== � datafile -> tempfile -> logfile -> controlfile

Step 1 : Check the oradata folder in the mount points …. /equs10g2/oradata /equs10g3/oradata /equs10g4/oradata Step 2 : Control file location need to be changed in the init.ora Change in init.ora

Page 13: 9i to 10g UpGradation

*.control_files='/equs10g2/oradata/ilequs/control01.ctl','/equs10g3/oradata/ilequs/control02.ctl','/equs10g4/oradata/ilequs/control03.ctl' cp /u06/ilequs/oradata/ilequs/control01.ctl /equs10g2/oradata/ cp /u06/ilequs/oradata/ilequs/control02.ctl /equs10g3/oradata/ cp /u06/ilequs/oradata/ilequs/control03.ctl /equs10g4/oradata/

Step 3 : Copy the files to the esired location Copy datafile to the desired location nohup cp -pr /u06/ilequs/oradata/ilequs/cwmlite01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/odm01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/indx01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/xdb01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/users01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/example01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/drsys01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/rman01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/undotbs02.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/system01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/undotbs01.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/gts_idx01.dat /equs10g2/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsd10.dbf /equs10g2/oradata/ & nohup cp -pr /u08/oradata/ilequs/tools02.dbf /equs10g2/oradata/ & nohup cp -pr /u06/ilequs/oradata/ilequs/tools01.dbf /equs10g2/oradata/ & nohup cp -pr /u07/oradata/ilequs/eaid01.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/eaix01.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/system02.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/ilrbisd01.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsx03.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsx05.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/gts_idx02.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsx01.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsx02.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsx04.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsd01.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsd02.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsd03.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsd04.dbf /equs10g3/oradata/ & nohup cp -pr /u07/oradata/ilequs/equsd05.dbf /equs10g3/oradata/ & nohup cp -pr /u08/oradata/ilequs/ilrbisx01.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsx08.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsx09.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/gts_dat02.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsx06.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsx07.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsx10.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsd06.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsd07.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsd08.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/equsd09.dbf /equs10g4/oradata/ & nohup cp -pr /u08/oradata/ilequs/gts_dat01.dat /equs10g4/oradata/ & ##### Copy Command for redo logfiles ############# cp /u06/ilequs/oradata/ilequs/redo03.log /equs10g2/oradata/redo03.log cp /u06/ilequs/oradata/ilequs/redo02.log /equs10g2/oradata/redo02.log cp /u06/ilequs/oradata/ilequs/redo01.log /equs10g2/oradata/redo01.log cp /u07/oradata/ilequs/redo03b.rdo /equs10g3/oradata/redo03b.rdo cp /u07/oradata/ilequs/redo02b.rdo /equs10g3/oradata/redo02b.rdo cp /u07/oradata/ilequs/redo01b.rdo /equs10g3/oradata/redo01b.rdo ###### Copy Command for the Temp Files ########3 cp /u06/ilequs/oradata/ilequs/temp01.dbf /equs10g2/oradata/

Step 4 : Rename Command Then run the rename command…. alter database rename file '/u06/ilequs/oradata/ilequs/cwmlite01.dbf' to '/equs10g2/oradata/cwmlite01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/odm01.dbf' to '/equs10g2/oradata/odm01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/indx01.dbf' to '/equs10g2/oradata/indx01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/xdb01.dbf' to '/equs10g2/oradata/xdb01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/users01.dbf' to '/equs10g2/oradata/users01.dbf' ;

Page 14: 9i to 10g UpGradation

alter database rename file '/u06/ilequs/oradata/ilequs/example01.dbf' to '/equs10g2/oradata/example01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/drsys01.dbf' to '/equs10g2/oradata/drsys01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/rman01.dbf' to '/equs10g2/oradata/rman01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/undotbs02.dbf' to '/equs10g2/oradata/undotbs02.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/system01.dbf' to '/equs10g2/oradata/system01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/undotbs01.dbf' to '/equs10g2/oradata/undotbs01.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/gts_idx01.dat' to '/equs10g2/oradata/gts_idx01.dat' ; alter database rename file '/u08/oradata/ilequs/equsd10.dbf' to '/equs10g2/oradata/equsd10.dbf' ; alter database rename file '/u08/oradata/ilequs/tools02.dbf' to '/equs10g2/oradata/tools02.dbf' ; alter database rename file '/u06/ilequs/oradata/ilequs/tools01.dbf' to '/equs10g2/oradata/tools01.dbf' ; alter database rename file '/u07/oradata/ilequs/eaid01.dbf' to '/equs10g3/oradata/eaid01.dbf' ; alter database rename file '/u07/oradata/ilequs/eaix01.dbf' to '/equs10g3/oradata/eaix01.dbf' ; alter database rename file '/u07/oradata/ilequs/system02.dbf' to '/equs10g3/oradata/system02.dbf' ; alter database rename file '/u07/oradata/ilequs/ilrbisd01.dbf' to '/equs10g3/oradata/ilrbisd01.dbf' ; alter database rename file '/u07/oradata/ilequs/equsx03.dbf' to '/equs10g3/oradata/equsx03.dbf' ; alter database rename file '/u07/oradata/ilequs/equsx05.dbf' to '/equs10g3/oradata/equsx05.dbf' ; alter database rename file '/u07/oradata/ilequs/gts_idx02.dbf' to '/equs10g3/oradata/gts_idx02.dbf' ; alter database rename file '/u07/oradata/ilequs/equsx01.dbf' to '/equs10g3/oradata/equsx01.dbf' ; alter database rename file '/u07/oradata/ilequs/equsx02.dbf' to '/equs10g3/oradata/equsx02.dbf' ; alter database rename file '/u07/oradata/ilequs/equsx04.dbf' to '/equs10g3/oradata/equsx04.dbf' ; alter database rename file '/u07/oradata/ilequs/equsd01.dbf' to '/equs10g3/oradata/equsd01.dbf' ; alter database rename file '/u07/oradata/ilequs/equsd02.dbf' to '/equs10g3/oradata/equsd02.dbf' ; alter database rename file '/u07/oradata/ilequs/equsd03.dbf' to '/equs10g3/oradata/equsd03.dbf' ; alter database rename file '/u07/oradata/ilequs/equsd04.dbf' to '/equs10g3/oradata/equsd04.dbf' ; alter database rename file '/u07/oradata/ilequs/equsd05.dbf' to '/equs10g3/oradata/equsd05.dbf' ; alter database rename file '/u08/oradata/ilequs/ilrbisx01.dbf' to '/equs10g4/oradata/ilrbisx01.dbf' ; alter database rename file '/u08/oradata/ilequs/equsx08.dbf' to '/equs10g4/oradata/equsx08.dbf' ; alter database rename file '/u08/oradata/ilequs/equsx09.dbf' to '/equs10g4/oradata/gts_dat02.dbf' ; alter database rename file '/u08/oradata/ilequs/gts_dat02.dbf' to '/equs10g4/oradata/equsx09.dbf' ; alter database rename file '/u08/oradata/ilequs/equsx06.dbf' to '/equs10g4/oradata/equsx06.dbf' ; alter database rename file '/u08/oradata/ilequs/equsx07.dbf ' to '/equs10g4/oradata/equsx10.dbf' ; alter database rename file '/u08/oradata/ilequs/equsx10.dbf ' to '/equs10g4/oradata/equsx07.dbf' ; alter database rename file '/u08/oradata/ilequs/equsd06.dbf ' to '/equs10g4/oradata/equsd06.dbf' ; alter database rename file '/u08/oradata/ilequs/equsd07.dbf ' to '/equs10g4/oradata/equsd07.dbf' ; alter database rename file '/u08/oradata/ilequs/equsd08.dbf' to '/equs10g4/oradata/equsd08.dbf' ; alter database rename file '/u08/oradata/ilequs/equsd09.dbf ' to '/equs10g4/oradata/equsd09.dbf' ; alter database rename file '/u08/oradata/ilequs/gts_dat01.dat' to '/equs10g4/oradata/gts_dat01.dat' ; ------ Redo file movement ( Rename Command ) ---------- alter database rename file '/u06/ilequs/oradata/ilequs/redo03.log' to '/equs10g2/oradata/redo03.log'; alter database rename file '/u06/ilequs/oradata/ilequs/redo02.log' to '/equs10g2/oradata/redo02.log'; alter database rename file '/u06/ilequs/oradata/ilequs/redo01.log' to '/equs10g2/oradata/redo01.log'; alter database rename file '/u07/oradata/ilequs/redo03b.rdo' to '/equs10g3/oradata/redo03b.rdo'; alter database rename file '/u07/oradata/ilequs/redo02b.rdo' to '/equs10g3/oradata/redo02b.rdo'; alter database rename file '/u07/oradata/ilequs/redo01b.rdo' to '/equs10g3/oradata/redo01b.rdo'; --------- Temp file movement ( Rename ) --------------------------- alter database rename file '/u06/ilequs/oradata/ilequs/temp01.dbf' to '/equs10g2/oradata/temp01.dbf';

################################################### ###################################### Step 20: Now , start the upgradation of database $ cd $ORACLE_HOME/rdbms/admin $ sqlplus / as sysdba Use Startup with the UPGRADE option: SQL> startup upgrade After this create the SYSAUX tablespace SQL > CREATE TABLESPACE sysaux DATAFILE '/sp04/equs 10g/oradata/sysaux01.dbf' SIZE 1000M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ONLINE; Now , run the "catupgrd.sql" script and also spoole d the output ..

Page 15: 9i to 10g UpGradation

SQL> spool upgrade.log SQL> @catupgrd.sql SQL> SPOOL OFF Note : This script determines which upgrade script s need to be run and then runs each necessary script. The upgrade script creates and al ters certain data dictionary tables . Check the spool file and verify .If there is any er ror , then you can run the errored out scripts again Now , Run the "@utlu102s.sql" to check the upgrade status tool SQL> @utlu102s.sql TEXT This is the Post-upgrade Status Tool displays the s tatus of the database components in the upgraded database. The Upgrade Status Tool displays output similar to the following: ################################################### ###################################### Step 21: Restart the database and do the following SQL> shutdown immediate (DO NOT use "shutdown abort " !!!) SQL> startup restrict Run olstrig.sql to re-create DML triggers SQL> @olstrig.sql Above script will give error. IF [Oracle Label Security VALID 10.2.0.1.0 00:00:14 ] is not installed . Thus you can skip this script Run utlrp.sql and compiled all the invalids object SQL> @utlrp.sql Take the list of invalid now and compare it with ol d list spool invalid_post_new.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 NOTE: If you have upgraded from version 9.2 to vers ion 10.2 and find that the following views are invalid , the views can be safely ignored (or dropped): SYS.V_$KQRPD,SYS.V_$KQRSD,SYS.GV_$KQRPD,SYS. GV_$KQRSD Again restat the database :- % sqlplus '/as sysdba' SQL> shutdown SQL> startup ################################################### ###################################### Step 22: If you changed the value for NLS_LENGTH_SEMANTICS from "CHAR" to "BYTE" prior to

the upgrade set it back to "CHAR" Now revert the init parameters AQ_TM_PROCESSES , JOB_QUEUE_PROCESSES to their old value

Page 16: 9i to 10g UpGradation

Now , start the database and create spfile .. SQL> startup 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. Now ,modify the listener.ora according to the new O RACLE_HOME stttings and then .. $ lsnrctl LSNRCTL> start ################################################### ###################################### Step 23: Enable cron and batch jobs

crontab < cronbackup

################################################### ###################################### Step 24: For more better plan new stats can be gathered , u sing dbms_stats() ; ################################################### ######################################

Step 25 : If your database contains the rman catalog , Then upgrade that also. % rman CATALOG rcat/rcat@oemdb connected to recovery catalog database PL/SQL package rcat.DBMS_RCVCAT version 08.00.04 in RCVCAT database is too old RMAN> UPGRADE CATALOG recovery catalog owner is rcat enter UPGRADE CATALOG command again to confirm cata log upgrade RMAN> UPGRADE CATALOG recovery catalog upgraded to version 10.01.00 DBMS_RCVMAN package upgraded to version 10.01.00 DBMS_RCVCAT package upgraded to version 10.01.00 =================================================== ======================================= =================================================== ======================================= =================================================== ======================================= =================================================== ======================================= =================================================== ======================================= =================================================== =======================================

Page 17: 9i to 10g UpGradation

===================== Suggestion on 10g upgrade == ======================================== If you are applying any CPUs ( Critical Patch Upgra des ) .. then you will have to re-run the catcpu.sql for that particular CPU after upgrading to 10g Also make sure there are no invalid objects after t he 10g upgrade and also after applying the CPU