Você está na página 1de 28

Database upgrade from 10g (10.2.0.1) to 11g (11.2.0.

1)
Introduction: To upgrade the database from 10g (10.2.0.1) to 11g (11.2.0.1), first we need to upgrade the database from 10.2.0.1 to 10.2.0.5. 11.2.0.1 can be achieved from 10.2.0.5 only. Below are the steps: 1) Install the 10g(10.2.0.1)

After the installation of 10.2.0.1 upgrade the database to 10.2.0.5 For upgrading to 10.2.0.5, we have to download patch#8202632 according to platform. Before starting the up gradation shutdown the database, listener, and db-console Select the same oracle home path and name as you have selected for 10.2.0.1 and run the patch#8202632 according to the instructions.

Post Installation Steps: After the installation do the following task: 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 11) 12) 13) 14) 15) 16) 17) 18) 19) 20)
cd $ORACLE_HOME/install sh changePerm.sh

cd $ORACLE_HOME/bin

SQL> STARTUP UPGRADE SQL> SPOOL upgrade_info.log SQL> @/rdbms/admin/utlu102i.sql SQL> SPOOL OFF SQL> SHUTDOWN immediate; SQL> STARTUP NOMOUNT SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile; SQL> SHUTDOWN SQL> STARTUP UPGRADE SQL> SPOOL patch.log SQL> @/rdbms/admin/catupgrd.sql SQL> SPOOL OFF SQL> SHUTDOWN IMMEDIATE SQL> STARTUP SQL> @/rdbms/admin/utlrp.sql SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY; Create pfile from spfile : create pfile='F:\OraHome_2\dbs\pfiletnpldev.ora' from spfile='F:\OraHome_2\dbs\SPFILETNPLDEV.ORA' 21) SQL> SHUTDOWN IMMEDIATE

Now after the Up gradation to 10.2.0.5 is successful we can upgrade our Database to 11.2.0

To upgrade the database from 10.2.0.5, we need to download the Oracle 11g Binaries win32_11gR2_database_1of2_2.zip win32_11gR2_database_2of2.zip Unzip both the files. Before we start the up-gradation do the below steps:
Startup the database and compile all the invalid objects. (Ensure that you do not have the duplicate objects in the SYS and SYSTEM schema) Download the script utlu112i.sql from metalink (884522.1) and keep the file under ORACLE_HOME/rdbms/admin

$ sqlplus / as sysdba SQL> @utlu112i.sql


Oracle Database 11.2 Pre-Upgrade Information Tool 08-16-2010 11:02:02 Script Version: 11.2.0.1.0 Build: 003 . ********************************************************************** Database: ********************************************************************** --> name: EVER --> version: 10.2.0.1.0 --> compatible: 10.2.0.1.0 --> blocksize: 8192 --> platform: Linux 64-bit for AMD --> timezone file: V4 . ********************************************************************** Tablespaces: [make adjustments in the current environment] ********************************************************************** --> SYSTEM tablespace is adequate for the upgrade. .... minimum required size: 257 MB --> SYSAUX tablespace is adequate for the upgrade. .... minimum required size: 72 MB WARNING: --> TEMP tablespace is not large enough for the upgrade. .... currently allocated size: -1 MB .... minimum required size: 61 MB .... increase current size by: 62 MB .... tablespace is NOT AUTOEXTEND ENABLED. . ********************************************************************** Flashback: OFF ********************************************************************** ********************************************************************** Update Parameters: [Update Oracle Database 11.2 init.ora or spfile] Note: Pre-upgrade tool was run on a lower version 64-bit database. ********************************************************************** --> If Target Oracle is 32-Bit, refer here for Update Parameters: -- No update parameter changes are required. . --> If Target Oracle is 64-Bit, refer here for Update Parameters: WARNING: --> "shared_pool_size" needs to be increased to at least 472 MB . ********************************************************************** Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile] ********************************************************************** -- No renamed parameters found. No changes are required. . ********************************************************************** Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile] ********************************************************************** --> background_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest" --> user_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest" . ********************************************************************** Components: [The following database components will be upgraded or installed] ********************************************************************** --> Oracle Catalog Views [upgrade] VALID --> Oracle Packages and Types [upgrade] VALID

. ********************************************************************** Miscellaneous Warnings ********************************************************************** WARNING: --> Database is using a timezone file older than version 11. .... After the release migration, it is recommended that DBMS_DST package .... be used to upgrade the 10.2.0.1.0 database timezone version .... to the latest version which comes with the new release. WARNING: --> Your recycle bin is turned on and currently contains no objects. .... Because it is REQUIRED that the recycle bin be empty prior to upgrading .... and your recycle bin is turned on, you may need to execute the command: PURGE DBA_RECYCLEBIN .... prior to executing your upgrade to confirm the recycle bin is empty. . ********************************************************************** Recommendations ********************************************************************** Oracle recommends gathering dictionary statistics prior to upgrading the database. To gather dictionary statistics execute the following command while connected as SYSDBA: EXECUTE dbms_stats.gather_dictionary_stats; ********************************************************************** Oracle recommends removing all hidden parameters prior to upgrading. To view existing hidden parameters execute the following command while connected AS SYSDBA: SELECT name,description from SYS.V$PARAMETER WHERE name LIKE '\_%' ESCAPE '\' Changes will need to be made in the init.ora or spfile. ********************************************************************** Oracle recommends reviewing any defined events prior to upgrading. To view existing non-default events execute the following commands while connected AS SYSDBA: Events: SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2 WHERE UPPER(name) ='EVENT' AND isdefault='FALSE' Trace Events: SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2 WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE' Changes will need to be made in the init.ora or spfile. **********************************************************************

Change the tablespaces accordingly. Lets take below ORACLE_HOME as 10g home: F:\ORACLE_HOME\10.2.0.1 Create a new 11g Oracle home as F:\ORACLE_HOME\11.2.0.1

Copy the below files from 10g home to 11g home:

1. init/spfile/pfile 2. password file 3. tnsnames.ora

Modify the below parameter of the spfile of 10g after copping that to 11g oracle home: background_dump_dest, user_dump_dest , compatible Below is an example : 10g spfile: *.background_dump_dest='F:\ORACLE_HOME/admin/tnpldemo/bdump' *.user_dump_dest='F:\ORACLE_HOME/admin/tnpldemo/udump' *.compatible='10.2.0.1.0'

11g spfile: *.diagnostc_dest='F:\ORACLE_HOME' *.compatible='11.2.0' Now set the ORACLE_HOME and ORACLE_SID to 11g home. Export ORACLE_HOME= F:\ORACLE_HOME\11.2.0.1 Export the ORACLE_SID=tnpldemo

Now shutdown the database and start the database once again. After that perform the below steps : 1) sqlplus / as sysdba 2) SQL> EXECUTE dbms_stats.gather_dictionary_stats;
3) SQL> PURGE DBA_RECYCLEBIN; 4) select TZ_VERSION from registry$database; 5) SQL> select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET'; (If this is UTF8 or AL16UTF16 then no action is needed.) 6) SQL> @$ORACLE_HOME/rdbms/admin/utlvalid.sql 7) SQL> @analyze.sql 8) SQL> SELECT username, default_tablespace FROM dba_users WHERE username in ('SYS','SYSTEM'); If DEFAULT_TABLESPACE is anything other than SYSTEM tablespace, modify the default tablespace to SYSTEM by using the below command. SQL> ALTER user SYS default tablespace SYSTEM; SQL> ALTER user SYSTEM default tablespace SYSTEM;

9) Ensure that if the aud$ table exists that it is in the sys schema and in the system tablespace. SQL> SELECT owner,tablespace_name FROM dba_tables WHERE table_name='AUD$';

If the AUD$ table is not in SYSTEM tablespace and not owned by the SYS user then before doing the upgrade put is back of the SYSTEM tablespace and it should be owned by SYS . Note :If the AUD$ table exists, and is in use, upgrade performance can be effected depending on the number of records in the table.

Check whether database has any externally authenticated SSL users. SQL> SELECT name FROM sys.user$ WHERE ext_username IS NOT NULL AND password = 'GLOBAL'; Note down the location of datafiles, redo logs, control files. Also take a backup of all configuration files like listener.ora,tnsnames.ora,etc., from $ORACLE_HOME

SQL> SELECT name FROM v$controlfile; SQL> SELECT file_name FROM dba_data_files; SQL> SELECT group#, member FROM v$logfile;

Take a backup of the database before upgrading it. Start the database in upgrade mode and run DBUA ( DataBase Up gradation Assistance) and follow the instructions as directed below.

After completion of DBUA, shutdown the database. And then start it in normal mode.

Run utlu112s.sql script , which gives a summary of the upgradation.

Run : SQL> @catuppst.sql

Run : SQL> @utlrp.sql (recompile any remaining stored PL/SQL and Java code in another session)

Recreate the EM:

Você também pode gostar