BIEE

一.查看DB 相關的信息

 

我們安裝的是64位的DB。

 

[oracle@dave ~]$ sqlplus / as sysdba;

 

SQL*Plus: Release 11.2.0.1.0 Production onWed Sep 28 10:23:51 2011

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

 

SQL> select name from v$database;

 

NAME

———

ANQING

 

查看 Oracle 是32位還是64位的方法

http://blog.csdn.net/tianlesoftware/article/details/6818709

 

 

二.升級的相關說明

2.1 Patchset 的說明

這部分內容copy 自patchset的readme 文檔。

 

Oracle Databasepatch set, release 11.2.0.3(11.2.0.2) is a full installation of the Oracle Database software. This meansthat you do not need to install Oracle Database 11g Release 2 (11.2.0.1)before installing Oracle Database 11g Release 2 (11.2.0.3/11.2.0.2).

       Oracle 11.2.0.2 和 11.2.0.3 的patchset都是完整的安裝包。所以可以直接用來安裝。

 

Note the following changes with the newpatch set packaging:

(1)Newinstallations consist of installing the most recent patch set, rather thaninstalling a base release and then upgrading to a patch release.

(2)Directupgrades from previous releases to the most recent patch set are supported.

(3)Out-of-placepatch set upgrades recommended, in which you install the patch set into a new,separate Oracle home. In-place upgrades are supported, but not recommended.

 

2.1.1 In-Place Upgrade

This feature enablesyou to upgrade an existing installation of Oracle database to Oracle Database11g Release 2 (11.2.0.3) into the same Oracle home directory by replacingthe existing database files. The patch set application requires more downtimeand is not recommended. This upgrade type requires less disk space.

將升級文件安裝到原來的Oracle home 目錄,這樣可以節省磁盤空間,但是需要更多的downtime。 這種並不推薦。

 

2.1.2 Out-of-Place Upgrade

This featureenables you to install Oracle Database 11g Release 2 (11.2.0.3) in a new,separate Oracle home directory. After the installation is complete, the datafrom the database in the old Oracle home directory is migrated to the databasein the new Oracle home directory.

可以將Oracle Database 安裝的新的OracleHome directory,當安裝結束後,舊的database 會遷移到新的Oracle homedirectory。

 

Out-of-placeupgrade process is similar to Oracle database upgrade from one version toanother and is the recommended type. The benefits of this upgrade type is thatthe patch set application requires much less downtime, and is safer when thepatch set application must be aborted. This upgrade type requires more diskspace to accommodate two Oracle home directories simultaneously.

       這種方法是oracle推薦的方式,它可以降低downtime 時間,也相對更安全。但是這種方法需要2倍的地盤空間,不過對與現在白菜價硬盤來說,這點空間也不算什麼了。

 

2.2 升級步驟

Oracle 10g的Readme上有詳細的升級步驟,但是11g的Readme上並沒有詳細的升級說明,需要參考官方文檔。

Oracle 10g upgrade from10.2.0.1 to 10.2.0.4

http://blog.csdn.net/tianlesoftware/article/details/5507762

 

(1)    備份數據庫

(2)    運行patchset,升級oracle 軟件

(3)    準備新的ORACLE_HOME

(4)    運行dbua 或者腳本升級實例

(5)    檢查升級後的版本信息和無效對象

 

官網地址:

Upgrading to theNew Release

http://download.oracle.com/docs/cd/E11882_01/server.112/e23633/upgrade.htm#i1011372

 

我這裏也是一個單實例的升級,相對較簡單,如果是RAC的升級,估計還要費勁一點,11gR2RAC 升級後面會繼續進行測試。

 

 

三.具體升級操作

3.1 備份DB

我這裏是測試環境,就不進行備份,如果是生產環境,切記要先備份,後操作。

如果是In-Place Upgrade,同時備份一下整個ORACLE_HOME目錄。 如果升級有問題,還可以還原回來。

 

重點是如下目錄:

ORACLE_HOME/dbs

ORACLE_HOME/network/admin

ORACLE_HOME/hostname_dbname

ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_hostname_dbname

 

 

3.2 升級Oracle database 軟件

運行Patchset 的runInstaller。

 


 

注意這裏,我們選擇第三個選項,skip software update,因爲我們的patchset已經下載過了,如果選擇第二個選項,會遇到如下錯誤,

 

INS-20704 Thelocation provided is not in the expected directory structure

 

Oracle 給的解決方式是用如下命令來執行:

./runInstaller –downloadUpdates

 

但是這個命令需要收費的Metalink帳號。 MOS 的相關文檔:

How To Download The Latest Updates AndPatches Using 11.2.0.2 OUI [ID 1295074.1]

Error: INS-20704 While Installing 11.2.0.2with "Use pre-downloaded software updates" Option [ID 1265270.1]

 


這裏要注意,我們之前講過11gR2的Patchset 可以直接用來安裝。在這個界面就可以選擇操作類型,這個功能比較方便,從而也導致patchset 越來越大,我們這裏選擇upgrade an existing database。

 




 

注意這裏的安裝位置,我之前的安裝目錄是11.2.0. 這裏我改成了11.2.0.3. 即將oracle 安裝到其他位置,這樣可以減少宕機時間,也是oracle 推薦的方法。

 

 

注意這裏的Inventory directory,這裏用來存放安裝文件的,我們之前安裝過DB,所以這個目錄已經存在,2種解決方法,刪除之前的目錄,二放到其他目錄,我這裏將安裝文件存放到其他目錄。

 

 




 

[root@dave oraInventory]#/u01/app/oraInventory2/orainstRoot.sh

Changing permissions of/u01/app/oraInventory2.

Adding read,write permissions for group.

Removing read,write,execute permissions forworld.

 

Changing groupname of/u01/app/oraInventory2 to oinstall.

The execution of the script is complete.

[root@dave oraInventory]#/u01/app/oracle/product/11.2.0.3/db_1/root.sh

Performing root user operation for Oracle11g

 

The following environment variables are setas:

   ORACLE_OWNER= oracle

   ORACLE_HOME= /u01/app/oracle/product/11.2.0.3/db_1

 

Enter the full pathname of the local bindirectory: [/usr/local/bin]:

  Copying dbhome to /usr/local/bin …

  Copying oraenv to /usr/local/bin …

  Copying coraenv to /usr/local/bin …

 

Entries will be added to the /etc/oratabfile as needed by

Database Configuration Assistant when adatabase is created

Finished running generic part of rootscript.

Now product-specific root actions will beperformed.

Finished product-specific root actions.

 


 


這裏會提示我們配置監聽,因爲監聽之前已經存在,所以這裏取消監聽配置。

 

 

我們點擊下一步時,會提示一些配置失敗,是否繼續,我們點是。 結束Oracle database 軟件的安裝。

 

 

從上面來看,如果沒有錯誤,在監聽配置完畢會,會自動調用DBUA 來升級我們的實例。 這裏我們配置失敗,正好驗證下手工升級實例。

 

3.3 配置新的ORACLE_HOME

這部分工作,主要是準備新的ORACLE_HOME,因爲我們的Oracle database 安裝到了新的位置,所以我們需要配置一下相關的信息。

 

這部分即使在上面自動調用了DBUA,我們也還是需要進行操作的。

 

After backing upthe database to be upgraded, prepare the new Oracle home in a new location. Dothis for any release of Oracle Database for which you are upgrading, whetherthe database is release 11.2 or earlier. Starting with Oracle Database11g Release 2 (11.2.0.2), you install the Oracle Grid Infrastructure andOracle Database software into a new Oracle home instead of applying a patch setto the existing Oracle home.

 

To prepare the new Oracle home:

 

1. Copyconfiguration files from the Oracle home of the database being upgraded to thenew Oracle Database 11g Release 2 (11.2) Oracle home:

(1)If your parameter file resideswithin the old environment's Oracle home, then copy it to the new Oracle home.By default, Oracle looks for the parameter file inthe ORACLE_HOME/dbs directory on Linux or UNIX platforms and inthe ORACLE_HOME\database directory on Windows operating systems. Theparameter file can reside anywhere you wish, but it should not reside in theold environment's Oracle home after you upgrade to Oracle Database11g Release 2 (11.2).

(2)If your parameter file resideswithin an Oracle ASM instance, then back up the parameter file using thefollowing command:

CREATE pfileFROM spfile;

If you must downgrade the database andyour SPFILE resided within Oracle ASM, then the parameter file mustbe restored before the downgrade.

(3)If your parameter file is atext-based initialization parameter file with eitheran IFILE (include file) or a SPFILE (server parameter file)entry, and the file specified in the IFILE or SPFILE entryresides within the old environment's Oracle home, then copy the file specifiedby the IFILE or SPFILE entry to the new Oracle home. Thefile specified in the IFILE or SPFILE entry containsadditional initialization parameters.

(4)If you have a password file thatresides within the old environment's Oracle home, then move or copy thepassword file to the Oracle Database 11g Release 2 (11.2) Oracle home.

The name andlocation of the password file are operating system-specific. On Linux or UNIXplatforms, the default password file is orapwsid, located intheORACLE_HOME/dbs directory. On Windows operating systems, the defaultpassword file is pwdsid.ora, located inthe ORACLE_HOME\database directory. In both cases, sid isyour Oracle instance ID.

(5)If you are upgrading a clusterdatabase and your initdb_name.ora file resides within the oldenvironment's Oracle home, then move or copy theinitdb_name.ora file tothe new Oracle home.

Note:

If you areupgrading a cluster database, then perform this step on all nodes in which thiscluster database has instances configured.

 

2.Adjust your parameterfile in Oracle Database 11g Release 2 (11.2) by completing the followingsteps:

(1)Removeobsolete initialization parameters and adjust deprecated initializationparameters. Certain parameters are obsolete in Oracle Database 11g Release2 (11.2), while other parameters have become deprecated. Remove all obsoleteparameters from any parameter file that starts an Oracle Database11g Release 2 (11.2) instance. Obsolete parameters might cause errors inOracle Database 11g Release 2 (11.2). Also, alter any parameter whosesyntax has changed in the new release.

The Pre-UpgradeInformation Tool displays any deprecated parameters and obsolete parameters itfinds in the Deprecated Parameters and ObsoleteParameters sections, respectively.

(2)Make surethe COMPATIBLE initialization parameter is properly set for OracleDatabase 11g Release 2 (11.2). The Pre-Upgrade Information Tool displays awarning in the Database section if COMPATIBLE is not properly set.

(3)Adjust the values of the initializationparameters to at least the minimum values indicated by the Pre-UpgradeInformation Tool.

(4)Make sure allpath names in the parameter file are fully specified. You should not haverelative path names in the parameter file.

(5)If the parameter file containsan IFILE entry, then change the IFILE entry in theparameter file to point to the new location of the include file that youspecified in Step 1c.Then, edit the file specified in the IFILE entry in the same way thatyou edited the parameter file in Step a throughStep d.

(6)If you are upgrading a clusterdatabase, then modify the initdb_name.ora file in the same way thatyou modified the parameter file.

Make sure yousave all of the files you modified after making these adjustments.

 

3.If you are upgrading acluster database, then set the CLUSTER_DATABASE initializationparameter to false. After the upgrade, you mustset this initialization parameter back to TRUE.

 

4. 修改Oracle的.bash_profile 文件

       我們重新指定了ORACLE_HOME,需要更新到.bash_profile 裏。

 


5. 修改/etc/oratab,該目錄下也有ORACLE_HOME

[oracle@dave db_1]$ cat /etc/oratab

anqing:/u01/app/oracle/product/11.2.0.3/db_1:N



具體操作步驟:

[oracle@dave dbs]$ pwd

/u01/app/oracle/product/11.2.0/db_1/dbs

[oracle@dave dbs]$ cp * /u01/app/oracle/product/11.2.0.3/db_1/dbs/

 

[oracle@dave admin]$ pwd

/u01/app/oracle/product/11.2.0/db_1/network/admin

[oracle@dave admin]$ ls

listener11092710PM3007.bak  samples    sqlnet11092710PM3007.bak tnsnames11092710PM3007.bak

listener.ora                shrept.lst  sqlnet.ora                tnsnames.ora

[oracle@dave admin]$ cp -R * /u01/app/oracle/product/11.2.0.3/db_1/network/admin

 

[oracle@dave admin]$ cat /home/oracle/.bash_profile|grep ORACLE_HOME

ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3/db_1; export ORACLE_HOME

TNS_ADMIN=$ORACLE_HOME/network/admin;exportTNS_ADMIN

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;export CLASSPATH

 

3.4 Pre-Upgrade Information Tool 說明

After you haveinstalled the software for Oracle Database 11g Release 2 (11.2) and anyrequired patches, you should analyze your database before upgrading it to thenew release. This is done by running the Pre-Upgrade Information Tool from theenvironment of the database you are to upgrade. The Pre-Upgrade InformationTool is a SQL script included with Oracle Database 11g Release 2 (11.2)software. This is a required step if you are upgrading manually; otherwise, thecatupgrd.sql script terminates with errors. Running the Pre-UpgradeInformation Tool is also recommended if you are upgrading with DBUA, so thatyou can preview the items that DBUA checks.

 

To run the Pre-Upgrade Information Tool 

1.     Log in to the system as theowner of the environment of the database being upgraded.

Important:

The Pre-UpgradeInformation Tool must be copied to and must be run from the environment of thedatabase being upgraded.

注意,這裏必須調用新的ORACLE_HOME 下腳本。

2.     Start SQL*Plus.

3.     Connect to the databaseinstance as a user with SYSDBA privileges.

4.     Set the system to spool resultsto a log file for later analysis:

SQL> SPOOL upgrade_info.log

5.     Run the Pre-Upgrade InformationTool:

SQL>@$11g_ORACLE_HOME/rdbms/admin/utlu112i.sql

6.     Turn off the spooling of scriptresults to the log file:

SQL> SPOOL OFF

 

腳本運行結果如下:

SQL>@/u01/app/oracle/product/11.2.0.3/db_1/rdbms/admin/utlu112i.sql

Oracle Database 11.2 Pre-UpgradeInformation Tool 09-28-2011 19:32:36

Script Version: 11.2.0.3.0 Build: 001

.

**********************************************************************

Database:

**********************************************************************

–> name:          ANQING

–> version:       11.2.0.1.0

–> compatible:    11.2.0.0.0

–> blocksize:     8192

–> platform:      Linux x86 64-bit

–> timezone file: V11

.

**********************************************************************

Tablespaces: [make adjustments in thecurrent environment]

**********************************************************************

–> SYSTEM tablespace is adequate forthe upgrade.

…. minimum required size: 686 MB

–> SYSAUX tablespace is adequate forthe upgrade.

…. minimum required size: 484 MB

–> UNDOTBS1 tablespace is adequate forthe upgrade.

…. minimum required size: 400 MB

–> TEMP tablespace is adequate for theupgrade.

…. minimum required size: 60 MB

–> EXAMPLE tablespace is adequate forthe upgrade.

…. minimum required size: 78 MB

.

**********************************************************************

Flashback: OFF

**********************************************************************

**********************************************************************

Update Parameters: [Update Oracle Database11.2 init.ora or spfile]

Note: Pre-upgrade tool was run on a lowerversion 64-bit database.

**********************************************************************

–> If Target Oracle is 32-Bit, referhere for Update Parameters:

– No update parameter changes arerequired.

.

 

–> If Target Oracle is 64-Bit, referhere for Update Parameters:

– No update parameter changes arerequired.

.

**********************************************************************

Renamed Parameters: [Update Oracle Database11.2 init.ora or spfile]

**********************************************************************

– No renamed parameters found. No changesare required.

.

**********************************************************************

Obsolete/Deprecated Parameters: [UpdateOracle Database 11.2 init.ora or spfile]

**********************************************************************

– No obsolete parameters found. No changesare required

.

 

**********************************************************************

Components: [The following databasecomponents will be upgraded or installed]

**********************************************************************

–> Oracle Catalog Views         [upgrade]  VALID

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

–> Expression Filter            [upgrade]  VALID

–> Rule Manager                 [upgrade]  VALID

–> Oracle Application Express   [upgrade] VALID

… APEX will only be upgraded if theversion of APEX in

… the target Oracle home is higher thanthe current one.

–> Oracle OLAP API              [upgrade]  VALID

.

**********************************************************************

Miscellaneous Warnings

**********************************************************************

WARNING: –> Database is using atimezone file older than version 14.

…. After the release migration, it isrecommended that DBMS_DST package

…. be used to upgrade the 11.2.0.1.0database timezone version

…. to the latest version which comes withthe new release.

WARNING: –> Your recycle bin is turnedon and currently contains no objects.

…. Because it is REQUIRED that therecycle bin be empty prior to upgrading

…. and your recycle bin is turned on, youmay need to execute the command:

       PURGE DBA_RECYCLEBIN

…. prior to executing your upgrade toconfirm the recycle bin is empty.

WARNING: –> Database contains schemaswith objects dependent on DBMS_LDAP package.

…. Refer to the 11g Upgrade Guide forinstructions to configure Network ACLs.

…. USER APEX_030200 has dependentobjects.

.

*********************************************************************

Recommendations

*********************************************************************

Oracle recommends gathering dictionarystatistics prior to upgrading the database.

To gather dictionary statistics execute thefollowing command while connected as SYSDBA:

 

   EXECUTE dbms_stats.gather_dictionary_stats;

 

*********************************************************************

Oracle recommends reviewing any definedevents prior to upgrading.

 

To view existing non-default events executethe 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 theinit.ora or spfile.

 

*********************************************************************

SQL>

 

關於這個結果的具體含義,官方文檔有詳細的說明。

 

3.5 升級Instance

       升級Instance 有兩種方法,第一種是使用dbua工具,第二種是手工執行腳本。

 

3.5.1 使用DBUA 工具

3.5.1.1 DBUA 工具在升級instance前會檢查如下選項:

(1)       Invalid user accounts or roles

(2)       Invalid data types or invalidobjects

(3)       Desupported character sets

(4)       Adequate resources, includingrollback segments, tablespaces, and free disk space

(5)       Missing SQL scripts needed forthe upgrade

(6)       Listener running (if OracleEnterprise Manager Database Control upgrade or configuration is requested)

(7)       Oracle Database software linkedwith Database Vault option

 

3.5.1.2  DBUA 的一些注意事項

(1)Important: If you terminatethe upgrade, but do not restore the database, then you cannot restart DBUA. Instead,you must continue with a manual (command line) upgrade as described in "ManuallyUpgrading the Database".

(2)DBUA can be used to upgrade from earlierOracle Database 11g patch releases as well as from earlier major OracleDatabase releases on both Oracle RAC databases and Oracle Databasesingle-instance databases. The procedure to upgrade patch releases is nodifferent from the normal upgrade procedure.

(3)You must run the Oracle NetConfiguration Assistant before running DBUA. See "Usingthe Oracle Net Configuration Assistant".

If you are upgradingan existing Oracle Enterprise Manager Database Control or if you areconfiguring a new Oracle Enterprise Manager Database Control for the new OracleDatabase 11g release, then the listener must be running before upgradingOracle Enterprise Manager. If DBUA detects that an Oracle Enterprise Managerupgrade or configuration is requested, and DBUA does not see a listenerrunning, then it prompts you and starts the default listener in either of thesecases.

(4)If you upgrade a cluster databaseusing DBUA, then you must make surethe CLUSTER_DATABASE initialization parameter is set to TRUE.

(5)If the database instance is notrunning, then DBUA tries to start the instance with the default initializationparameter file. If that fails, then DBUA prompts you to provide the name of thecorrect initialization parameter file or to start the instance. If the instanceis up and running, then DBUA connects to it.

(6)If you terminate the upgrade, butdo not restore the database, then you cannot restart DBUA until you start upthe existing database in UPGRADE mode using the new Oracle Database11g server. You cannot Go back to the original server unless you restoreyour database.

For Oracle RAC,you cannot re-run DBUA once you terminate the upgrade. If you need to re-runthe upgrade, then you must run DBUA from the restored backup of the databaseyou are upgrading.

(7)If you restore your databasemanually (not using DBUA), then remove the Welcome_SID.txt file,which is located in the ORACLE_HOME/cfgtoollogs/dbua/logs/ directory,before starting DBUA. The presence of this file indicates to DBUA that this isa re-run operation.

 

DBUA 工具比較簡單,直接下一步的操作。這裏就不多少了。

 

3.5.2 手工使用命令升級實例

 

1.Shut down the instance:

SQL> SHUTDOWNIMMEDIATE

 

2.If your operatingsystem is Windows, then complete the following steps:

(1)Stopthe OracleServiceSID Oracle service of the database you areupgrading, where SID is the instance name. For example, ifyour SID is ORCL, then enter the following at a command prompt:

C:\> NET STOPOracleServiceORCL

(2)Delete the Oracle service at a command prompt using ORADIM.

If your SID is ORCL, thenenter the following command:

C:\> ORADIM-DELETE -SID ORCL

(3)Create the Oracle Database11g Release 2 (11.2) service at a command prompt usingthe ORADIM command of the new Oracle Database release:

C:\> ORADIM-NEW -SID SID -SYSPWD PASSWORD -MAXUSERS USERS

    -STARTMODE AUTO -PFILE ORACLE_HOME\DATABASE\INITSID.ORA

 

This syntax includes thefollowing variables:

Variable

Description

SID

The same SID name as the SID of the database you are upgrading.

PASSWORD

The password for the new Oracle Database 11g Release 2 (11.2) database instance. This is the password for the user connected with SYSDBA privileges. The -SYSPWD option is not required. If you do not specify it, then operating system authentication is used, and no password is required.

If the default Oracle Database 11g Release 2 (11.2) security settings are in place, then passwords must be at least eight characters, and passwords such as welcome and oracle are not allowed. See Oracle Database Security Guide for more information.

USERS

The maximum number of users who can be granted SYSDBA and SYSOPER privileges.

ORACLE_HOME

The Oracle Database 11g Release 2 (11.2) Oracle home directory. Ensure that you specify the full path name with the -PFILE option, including the drive letter of the Oracle home directory.

 

For example, ifyour SID is ORCL, your password (SYSPWD)is TWxy5791, the maximum number of users (MAXUSERS) is 10, andtheORACLE_HOME directory is C:\ORACLE\PRODUCT\11.2.0\DB, then enterthe following command:

C:\> ORADIM-NEW -SID ORCL -SYSPWD TWxy5791 -MAXUSERS 10

-STARTMODE AUTO-PFILE C:\ORACLE\PRODUCT\11.2.0\DB\DATABASE\INITORCL.ORA

ORADIM writes a log file tothe ORACLE_HOME\database directory.

 

3. If your operatingsystem is Linux or UNIX, then perform the following checks:

(1)Your ORACLE_SID is set correctly

(2)The oratab file points toyour Oracle Database 11g Release 2 (11.2) Oracle home

(3)The following environment variablespoint to the Oracle Database 11g Release 2 (11.2) directories:

ORACLE_HOME

PATH

(4)Any scripts that clients use to setthe ORACLE_HOME value must point to the new Oracle home.

 

4. Log in to the system as the owner of theOracle Database 11g Release 2 (11.2) Oracle home directory.

 

5.At a system prompt, change tothe ORACLE_HOME/rdbms/admin directory.

       –這裏是新的ORACLE HOME

6. Start SQL*Plus.

7.Connect to the database instance as auser with SYSDBA privileges.

8.Start the instanceby issuing the following command:

SQL> STARTUPUPGRADE

 

Upgrade 關鍵字的作用:

The UPGRADE keywordenables you to open a database based on an earlier Oracle Database release. It also restricts logons to AS SYSDBA sessions,disables system triggers, and performs additional operations that prepare theenvironment for the upgrade.

 

You might berequired to use the PFILE option to specify the location of your initializationparameter file.

Once thedatabase is started in upgrade mode, only queries on fixed views executewithout errors until after the catupgrd.sql script is run. Beforerunning catupgrd.sql, queries on any other view or the use of PL/SQL returns anerror.

The followingare common errors that might occur when attempting to start the new OracleDatabase 11g Release 2 (11.2) database. Some of these errors are writtento the alert log and not to your session. If you receive any of these errors,then issue the SHUTDOWN ABORT command to shut down the database andcorrect the problem.

 

ORA-00401: thevalue for parameter compatible is not supported by this release

The COMPATIBLE initializationparameter is set to a value less than 10.0.0.

ORA-39701:database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADE

The CLUSTER_DATABASE initializationparameter is set to TRUE instead of FALSE.

ORA-39700:database must be opened with UPGRADE option

The STARTUP command was issuedwithout the UPGRADE keyword.

ORA-00336: logfile size xxxx blocks is less than minimum 8192 blocks

A redo log file size is less than 4 MB:

 

If errors appearlisting obsolete initialization parameters, then make a note of the obsoleteinitialization parameters and continue with the upgrade. Remove the obsoleteinitialization parameters the next time you shut down the database.

 

9. Perform this step onlyif you are upgrading from Oracle9i Release 2 (9.2). Otherwise, skip to thenext step.

Createa SYSAUX tablespace. In the new Oracle Database 11g release,the SYSAUX tablespace is used to consolidate data from a number oftablespaces that were separate in previous releases.


The SYSAUX tablespace must becreated with the following mandatory attributes:

(1)       ONLINE

(2)       PERMANENT

(3)       READ WRITE

(4)       EXTENT MANAGEMENT LOCAL

(5)       SEGMENT SPACE MANAGEMENT AUTO

 

The Pre-UpgradeInformation Tool provides an estimate of the minimum required size forthe SYSAUX tablespace under the SYSAUX Tablespace section.Table3-4 can be used to determine an optimal size forthe SYSAUX tablespace.

 

Table 3-4 Guidelines for Sizing the SYSAUXTablespace

Factor

Small

Medium

Large

Number of CPUs

2

8

32

Number of concurrently active sessions

5

20

100

Number of user objects (tables and indexes)

500

5,000

50,000

Estimated SYSAUX size at steady state with default configuration

500 MB

2 GB

5 GB

 

The followingSQL statement would create a 500 MB SYSAUX tablespace for thedatabase:

SQL> CREATE TABLESPACE sysaux DATAFILE'sysaux01.dbf'

        SIZE 500M REUSE

        EXTENT MANAGEMENT LOCAL

        SEGMENT SPACE MANAGEMENT AUTO

        ONLINE;

 

10. Set the system to spool results to alog file for later verification of success:

SQL> SPOOL upgrade.log

 

11.Run the Pre-Upgrade Information Tool byexecuting the utlu112i.sql script:

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

 

12. Run the catupgrd.sql script:

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

這個腳本纔是真正的升級腳本,前面搞了那麼多,就爲了執行這個腳本。

 

還有一點要注意,就是執行這個腳本會產生大量的歸檔文件, 平均3分鐘產生40M的歸檔。

該腳本運行了80分鐘。 而在Oracle10g下,運行該腳本在40分鐘左右。時間增加了一倍。增加了升級系統的宕機時間。

 

Note:

If you did not run the Pre-Upgrade Information Tool,the catupgrd.sql script terminates with one of the following errors:

 

ORA-00942: tableor view does not exist

ORA-00904:"TZ_VERSION": invalid identifier

ORA-01722:invalid number

 

If you receiveany of these errors, issue the SHUTDOWN ABORT statement, revert tothe original Oracle home directory, and run the Pre-Upgrade Information Tool (utlu112i.sql)as described in "Usingthe Pre-Upgrade Information Tool".

 

The catupgrd.sql scriptdetermines which upgrade scripts must be run, runs them, and then shuts downthe database. You must run the script in the OracleDatabase 11g Release 2 (11.2) environment.

 

The upgrade script creates and alters certain data dictionary tables. It also upgrades orinstalls the following database components in the new Oracle Database11g Release 2 (11.2) database:

(1)       Oracle Database Catalog Views

(2)       Oracle Database Packages andTypes

(3)       JServer JAVA Virtual Machine

(4)       Oracle Database Java Packages

(5)       Oracle XDK

(6)       Oracle Real ApplicationClusters

(7)       Oracle Workspace Manager

(8)       Oracle Multimedia

(9)       Oracle XML Database

(10)    OLAP Analytic Workspace

(11)    Oracle OLAP API

(12)    OLAP Catalog

(13)    Oracle Text

(14)    Spatial

(15)    Oracle Data Mining

(16)    Oracle Label Security

(17)    Messaging Gateway

(18)    Oracle Expression Filter

(19)    Oracle Rules Manager

(20)    Oracle Enterprise Manager Repository

(21)    Oracle Database Vault

(22)    Oracle Application Express

 

13. Restart the instance to reinitializethe system parameters for normal operation.

SQL> STARTUP

 

This restart, following the database shutdown performed as part ofthe catupgrd.sql script, flushes all caches, clears buffers,and performs other housekeeping activities. These measures are an importantfinal step to ensure the integrity and consistency of the newly upgraded OracleDatabase software.

Catupgrd.sql 腳本里會執行shutdown命令。

 

14.Run utlu112s.sql,the Post-Upgrade Status Tool, which provides a summary of the upgrade at theend of the spool log. You can run utlu112s.sql any time aftercompleting the upgrade. See "Aboutthe Post-Upgrade Status Tool" for more information.

 

Run utlu112s.sql todisplay the results of the upgrade as follows:

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

 

If thePost-Upgrade Status Tool returns errors or shows components that arenot VALID or not the most recent release, then see "Troubleshootingthe Upgrade" for more information.

示例:

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

.Oracle Database11.2 Post-Upgrade Status Tool      09-29-2011 12:05:19

.Component              Current     Version     Elapsed Time

Name                   Status      Number      HH:MM:SS

.Oracle Server             VALID     11.2.0.3.0  00:44:22

JServer JAVAVirtual Machine VALID      11.2.0.3.0  00:00:00

Oracle WorkspaceManager     VALID      11.2.0.3.0  00:02:07

OLAP AnalyticWorkspace      VALID      11.2.0.3.0  00:00:00

OLAP Catalog                          VALID      11.2.0.3.0  00:00:00

Oracle OLAP API                     VALID      11.2.0.3.0  00:01:45

OracleEnterprise Manager       VALID      11.2.0.3.0  00:00:00

Oracle XDK                              VALID      11.2.0.3.0  00:00:00

Oracle Text                                VALID      11.2.0.3.0  00:00:00

Oracle XMLDatabase              VALID      11.2.0.3.0  00:00:00

Oracle DatabaseJava Packages       VALID      11.2.0.3.0  00:00:00

OracleMultimedia                    VALID      11.2.0.3.0  00:10:50

Spatial                                       VALID      11.2.0.3.0  00:17:19

OracleExpression Filter            VALID      11.2.0.3.0  00:00:48

Oracle RulesManager               VALID      11.2.0.3.0  00:00:46

OracleApplication Express       VALID       3.2.1.00.10

GatheringStatistics                                                         00:07:08

Total UpgradeTime: 01:25:42

 

PL/SQL proceduresuccessfully completed.

 

該腳本會顯示升級各個組件所花的時間,這裏顯示我們升級組件花了85分鐘。

 

 

15. Run catuppst.sql, located inthe ORACLE_HOME/rdbms/admin directory, to perform upgrade actions that do not require the database to be in UPGRADE mode:

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

 

This may generate thefollowing informational messages:

 

Generating apply and rollback scripts…

Check the following file for errors:

Apply script: .*

Rollback script: .*

Executing script file…

Updating registry…

Check the following log file for errors:

 

Generating apply and rollback scripts…

Check the following file for errors:

…/cfgtoollogs/catbundle/catbundle_PSU_*.log

Apply script:

…/rdbms/admin/catbundle_PSU_*_APPLY.sql

Rollback script:

…/rdbms/admin/catbundle_PSU_*_ROLLBACK.sql

Executing script file…

 

Updating registry…

Check the following log file for errors:

…/cfgtoollogs/catbundle/catbundle_PSU_*.log

 

16. Run utlrp.sql to recompile any remaining stored PL/SQL and Java code.

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

       該腳本運行需要花30分種。 都很費時間啊。

 

 

Verify that all expectedpackages and classes are valid:

SQL> SELECTcount(*) FROM dba_invalid_objects;

SQL> SELECTdistinct object_name FROM dba_invalid_objects;

 

Note:

If thepre-upgrade information tool detected INVALID objects and populatedthe registry$sys_inv_objs andregistry$nonsys_inv_objs tables,then execute ORACLE_HOME/rdbms/admin/utluiobj.sql to display onlythose objects which are newly invalid because of the upgrade process.The utluiobj.sql script only displays objects that arenowINVALID but which were VALID before the upgrade.

 

17. Exit SQL*Plus.

 

18.If you are upgrading a cluster databasefrom releases 10.2, 11.1, or 11.2.0.1, then upgrade the database configurationin Oracle Clusterware using the following command:

$ srvctl upgradedatabase -d db-unique-name -o oraclehome

 

where db-unique-name isthe database name assigned to it (not the instance name),and oraclehome is the Oracle home location in which the database isbeing upgraded.

 


19. 最後調用一下dbca 重建一下OEM。

       如果dbca 顯示OEM 已經配置過,rm 掉如下2個目錄,再次運行就ok了。

ORACLE_HOME/hostname_dbname

ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_hostname_dbname


至此,通過命令升級操作結束。

 

 

如果在升級過程中遇到問題,可以重新執行升級腳本,步驟如下:

1.Shut down the database as follows:

    SQL> SHUTDOWNIMMEDIATE

2.Restart the databasein UPGRADE mode:

   SQL> STARTUPUPGRADE

3.Set the system to spool results to a logfile for later verification of success:

   SQL> SPOOLupgrade.log

4.Rerun catupgrd.sql:

   SQL>@catupgrd.sql

Note:

You can rerunthe catupgrd.sql script as many times as necessary. The first timeyou run the script, there should be no error messages returned. If you rerunthe script, then the ORA-00001 messageis displayed. You can safely ignore this message.

5.Rerun utlu112s.sql:

   SQL>@utlu112s.sql

 

 

最後驗證一下各個組件的版本和狀態:

SQL> SELECT COMP_NAME, VERSION, STATUSFROM SYS.DBA_REGISTRY;

 

COMP_NAME                                VERSION                        STATUS

———————————————————————- ———————-

OWB                                     11.2.0.1.0                     VALID

Oracle Application Express               3.2.1.00.10                    VALID

Oracle Enterprise Manager                11.2.0.3.0                     VALID

OLAP Catalog                             11.2.0.3.0                     VALID

Spatial                                 11.2.0.3.0                    VALID

Oracle Multimedia                        11.2.0.3.0                     VALID

Oracle XML Database                      11.2.0.3.0                     VALID

Oracle Text                              11.2.0.3.0                     VALID

Oracle Expression Filter                 11.2.0.3.0                     VALID

Oracle Rules Manager                     11.2.0.3.0                     VALID

Oracle Workspace Manager                 11.2.0.3.0                     VALID

 

COMP_NAME                                VERSION                        STATUS

———————————————————————- ———————-

Oracle Database Catalog Views            11.2.0.3.0                     VALID

Oracle Database Packages and Types       11.2.0.3.0                     VALID

JServer JAVA Virtual Machine             11.2.0.3.0                     VALID

Oracle XDK                               11.2.0.3.0                     VALID

Oracle Database Java Packages            11.2.0.3.0                     VALID

OLAP Analytic Workspace                  11.2.0.3.0                     VALID

Oracle OLAP API                          11.2.0.3.0                     VALID

 

18 rows selected.

 

 

小結:

       我升級這個單實例使用的默認參數。 內存參數如下:

 

SQL> show parameter memory

 

NAME                                 TYPE        VALUE

———————————————– ——————————

hi_shared_memory_address             integer     0

memory_max_target                    big integer 1000M

memory_target                        big integer 1000M

shared_memory_address                integer     0

 

SQL> show parameter java

 

NAME                                 TYPE        VALUE

———————————————– ——————————

java_jit_enabled                     boolean     TRUE

java_max_sessionspace_size           integer     0

java_pool_size                       big integer 0

java_soft_sessionspace_limit         integer     0

 

SQL> select * from v$sgainfo;

 

NAME                                  BYTES RES

——————————– ————-

Fixed SGA Size                      2234960 No

Redo Buffers                        5656576 No

Buffer Cache Size                 318767104 Yes

Shared Pool Size                  276824064 Yes

Large Pool Size                     4194304 Yes

Java Pool Size                     71303168 Yes

Streams Pool Size                         0 Yes

Shared IO Pool Size                33554432 Yes

Granule Size                        4194304 No

Maximum SGA Size                 1043886080 No

Startup overhead in Shared Pool    71970864 No

 

NAME                                  BYTES RES

——————————– ————-

Free SGA Memory Available         364904448

 

 

在這種配置下:catupgrd.sql 跑了85分鐘,utlrp.sql 跑了30分鐘。然後加上備份的時間,即使採用out-of-place upgrade的方式來升級,安裝Oracle database 的時間可以省掉,但總的升級時間還是較10g有增加。

腳本120分鐘,備份1個小時,然後冗餘1-2小時,申請停機的時間至少需要4個小時,系統耗不起啊。

 

不過朋友說增加Java_Pool 可以減少運行腳本的時間,這塊還沒有測試,有朋友測試的話可以試試這種方法。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章