Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

Pre-Upgrade Steps

=================

1) Copy the Pre-Upgrade Information Tool (utlu112i.sql) from the Oracle Database
11g Release 2 (11.2) ORACLE_HOME/rdbms/admin directory to a directory outside
of the Oracle Home, such as the temporary directory on your system. /tmp/upgrade

SELECT TO_NUMBER('MUST_BE_SAME_TIMEZONE_FILE_VERSION')
FROM registry$database
WHERE tz_version != (SELECT version from v$timezone_file);

2) Change to the directory where utlu112i.sql had been copied in the previous step.

cd /tmp/upgrade

sqlplus '/ as sysdba'


EXECUTE dbms_stats.gather_dictionary_stats;
@$ORACLE_HOME/rdbms/admin/utlrp.sql
alter system set job_queue_processes=100 scope=both;
PURGE DBA_RECYCLEBIN;

spool upgrade_info.log
@utlu112i.sql
spool off

3) Check the spool file and examine the output of the Upgrade Information Tool.

Preparing Database for Upgrade


==============================
Note 556610.1 Script to Collect DB Upgrade/Migrate Diagnostic Information
(dbupgdiag.sql)

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', 'EXFSYS', 'SYSMAN', 'MDDATA',
'SI_INFORMTN_SCHEMA', 'XDB', 'ODM');

SELECT GRANTEE, PRIVILEGE


FROM DBA_SYS_PRIVS
WHERE GRANTEE ='CONNECT';

SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10)


||DECODE(U.NAME,'PUBLIC',Null, 'SYS','',U.NAME||'.')|| L.NAME||chr(10)
||'CONNECT TO ' || L.USERID || ' IDENTIFIED BY "'||L.PASSWORD||'" USING
'''||L.HOST||''''
||chr(10)||';' TEXT
FROM SYS.LINK$ L, SYS.USER$ U
WHERE L.OWNER# = U.USER#;

Note 1358166.1 : Actions For DST Updates When Upgrading To Or Applying The 11.2.0.3
Patchset
select TZ_VERSION from registry$database;

select value from NLS_DATABASE_PARAMETERS where parameter =


'NLS_NCHAR_CHARACTERSET';
Note 276914.1 The National Character Set in Oracle 9i and 10g.

Note 870877.1 How To Save Oracle Enterprise Manager Database Control Data Before
Upgrading The Single Instance Database To Other Release?
$ emdwgrd -save -cluster -sid old_SID -path save_directory

Set verify off


Set space 0
Set line 120
Set heading off
Set feedback off
Set pages 1000

Spool analyze.sql

SELECT 'Analyze table "'||table_name||'" validate structure cascade;'


FROM dba_tables
WHERE owner='SYS'
AND partitioned='NO'
AND (iot_type='IOT' OR iot_type is NULL)
UNION
SELECT 'Analyze table "'||table_name||'" validate structure cascade into
invalid_rows;'
FROM dba_tables
WHERE owner='SYS'
AND partitioned='YES';

spool off

@analyze.sql

select distinct(trunc(last_refresh)) from dba_snapshot_refresh_times; -- sin datos

SQL> select
s.obj#,o.obj#,s.containerobj#,lastrefreshdate,pflags,xpflags,o.name,o.owner#,
bitand(s.mflags, 8)
from obj$ o, sum$ s
where o.obj# = s.obj# and o.type# = 42 AND bitand(s.mflags, 8) = 8; -- sin datos

SELECT * FROM v$recover_file; -- sin datos


SELECT * FROM v$backup WHERE status != 'NOT ACTIVE'; -- sin datos

select * from dba_2pc_pending;

SELECT local_tran_id
FROM dba_2pc_pending;
EXECUTE dbms_transaction.purge_lost_db_entry('');
COMMIT;

-- Disable all batch and cron jobs.

SELECT owner,tablespace_name
FROM dba_tables
WHERE table_name='AUD$';
SQL> SELECT name FROM v$controlfile;
SQL> SELECT file_name FROM dba_data_files;
SQL> SELECT group#, member FROM v$logfile;

lsnrctl stop

$ emctl stop dbconsole


$ isqlplusctl stop

Perform Cold Backup


Take a backup using RMAN

Make a backup of the init<SID>.ora file

$ export ORACLE_HOME=<location of Oracle 11.2>


$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_BASE=<Oracle_Base set during installation>

Sample /etc/oratab

#orcl:/opt/oracle/product/10.2/db_1:N
orcl:/opt/oracle/product/11.2/db_1:N

Upgrading Database to 11gR2


===========================

$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus "/ as sysdba"
SQL> startup UPGRADE

SQL> set echo on


SQL> SPOOL upgrade.log
SQL> @catupgrd.sql
SQL> spool off
SQL> exit;

$ sqlplus "/as sysdba"


SQL> STARTUP
SQL> @utlu112s.sql

SQL> @catuppst.sql

SQL> @$ORACLE_HOME/ctx/admin/ctxf102.sql -- Upgrade Oracle Text


SQL> SELECT COMP_NAME, VERSION, STATUS FROM DBA_REGISTRY;
SQL> @catbundle cpu apply
SQL> @utlrp.sql

Note 556610.1 Script to Collect DB Upgrade/Migrate Diagnostic Information


(dbupgdiag.sql)

Post Upgrade Steps


==================

Make sure the following environment variables point to the Oracle 11g Release 2
(11.2) directories:
- ORACLE_BASE
- ORACLE_HOME
- PATH, LD_LIBRARY_PATH, SHLIB_PATH and LIBPATH (for AIX)
- Check that your oratab file

SQL> conn / as sysdba


Connected.
SQL>SELECT version FROM v$timezone_file;

SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value


FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

SQL> exec DBMS_DST.BEGIN_PREPARE(14);

SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value


FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

SQL> TRUNCATE TABLE SYS.DST$TRIGGER_TABLE;


Table truncated.

SQL> TRUNCATE TABLE sys.dst$affected_tables;


Table truncated.

SQL> TRUNCATE TABLE sys.dst$error_table;


Table truncated.

SQL> BEGIN
DBMS_DST.FIND_AFFECTED_TABLES
(affected_tables => 'sys.dst$affected_tables',
log_errors => TRUE,
log_errors_table => 'sys.dst$error_table');
END;
/
PL/SQL procedure successfully completed.

SQL> SELECT * FROM sys.dst$affected_tables;

SQL> EXEC DBMS_DST.END_PREPARE;


A prepare window has been successfully ended.
PL/SQL procedure successfully completed.

SQL> shut immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 1090519944 bytes
Database Buffers 3170893824 bytes
Redo Buffers 12107776 bytes
Database mounted.
Database opened.
SQL> spool DST_upgrade.log
SQL> EXEC DBMS_DST.BEGIN_UPGRADE(14);
PL/SQL procedure successfully completed.

SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value


FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

SQL> shut immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 4275781632 bytes


Fixed Size 2260088 bytes
Variable Size 1090519944 bytes
Database Buffers 3170893824 bytes
Redo Buffers 12107776 bytes
Database mounted.
Database opened.

SQL> SELECT version FROM v$timezone_file;

EXECUTE DBMS_STATS.UPGRADE_STAT_TABLE('SYS','dictstattab');

SELECT name FROM v$parameter WHERE isdeprecated = 'TRUE';

create spfile from pfile;

You might also like