搜索此博客

2011年12月11日星期日

Oracle 10.2.0.1升级到10.2.0.5

一次简单的oracle升级笔记

首先查看一下现在的版本信息等

以sysdba登陆


SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production



SQL> select rownum,parameter,value from (select parameter,value from v$option order by 2);

    ROWNUM PARAMETER                                          VALUE
---------- -------------------------------------------------- --------------------
         1 Real Application Clusters                          FALSE
         2 Oracle Label Security                              FALSE
         3 Data Mining Scoring Engine                         FALSE
         4 Bit-mapped indexes                                 TRUE
         5 Connection multiplexing                            TRUE
         6 Connection pooling                                 TRUE
         7 Database queuing                                   TRUE
         8 Incremental backup and recovery                    TRUE
         9 Instead-of triggers                                TRUE
        10 Parallel backup and recovery                       TRUE
        11 Parallel execution                                 TRUE
        12 Parallel load                                      TRUE
        13 Point-in-time tablespace recovery                  TRUE
        14 Fine-grained access control                        TRUE
        15 Proxy authentication/authorization                 TRUE
        16 Change Data Capture                                TRUE
        17 Plan Stability                                     TRUE
        18 Online Index Build                                 TRUE
        19 Coalesce Index                                     TRUE
        20 Managed Standby                                    TRUE
        21 Materialized view rewrite                          TRUE
        22 Materialized view warehouse refresh                TRUE
        23 Database resource manager                          TRUE
        24 Spatial                                            TRUE
        25 Visual Information Retrieval                       TRUE
        26 Export transportable tablespaces                   TRUE
        27 Transparent Application Failover                   TRUE
        28 Fast-Start Fault Recovery                          TRUE
        29 Sample Scan                                        TRUE
        30 Duplexed backups                                   TRUE
        31 Java                                               TRUE
        32 OLAP Window Functions                              TRUE
        33 Block Media Recovery                               TRUE
        34 Fine-grained Auditing                              TRUE
        35 Application Role                                   TRUE
        36 Enterprise User Security                           TRUE
        37 Oracle Data Guard                                  TRUE
        38 OLAP                                               TRUE
        39 Table compression                                  TRUE
        40 Join index                                         TRUE
        41 Trial Recovery                                     TRUE
        42 Data Mining                                        TRUE
        43 Online Redefinition                                TRUE
        44 Streams Capture                                    TRUE
        45 File Mapping                                       TRUE
        46 Block Change Tracking                              TRUE
        47 Flashback Table                                    TRUE

    ROWNUM PARAMETER                                          VALUE
---------- -------------------------------------------------- --------------------
        48 Flashback Database                                 TRUE
        49 Transparent Data Encryption                        TRUE
        50 Backup Encryption                                  TRUE
        51 Advanced replication                               TRUE
        52 Unused Block Compression                           TRUE
        53 Partitioning                                       TRUE
        54 Objects                                            TRUE

54 rows selected.

SQL>



下载好补丁包 p8202632_10205_Linux-x86-64.zip,并解压缩

unzip p8202632_10205_Linux-x86-64.zip -d /home/oracle/ug

查看 README.htm,养成好的习惯,不要想当然的这样那样,README.htm是必须看滴

readme中提到如果库中存在TIMESTAMP WITH LOCAL TIME ZONE (TSLTZ) and TIMESTAMP WITH TIME ZONE (TSTZ)数据类型,需要做点处理,比如expdp相关的表,升级以后再impdp回去。
。。。。

怎么找受影响的表?readme中有详细的步骤介绍。这里简单介绍一下

首先sysdba登陆

SQL> SELECT version FROM v$timezone_file;

   VERSION
----------
         2

如果返回值是4,则不需要做任何修改,直接可以升级到10.2.0.5,大于4小于4各有相关的处理流程,My Oracle Support document 中的1086400.1有详细介绍,这里就不累赘啦。总之都是找出受影响数据,提前备份好。

升级之前先做好全库备份,万一升级失败起码可以回退到升级前的版本。



创建一个备份脚本,offline-backup.sh,内容如下



#!/bin/bash


# --------------------------------------------------------------------------
# File:      offline-backup.sh
#
# Autor:     shisl.up@gmail.com , 2011.12.09
#
# Purpose:   Backup Oracle Database in NOARCHIVELOG Mode
#            (for Example before an Upgrade)
#
# Certified: Oracle 10.2.0.1 on Oracle Enterprise linux 5.7
# --------------------------------------------------------------------------



rman target / log /home/oracle/offline-backup.log << EOF

shutdown immediate;
startup;
shutdown immediate;
startup mount;

#delete noprompt backup;

 CONFIGURE BACKUP OPTIMIZATION ON;
 CONFIGURE DEFAULT DEVICE TYPE TO DISK;
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
 CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/rmanbk/ct_%F';
 CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE to compressed backupset;
 CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u01/rmanbk/db_%U';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u01/rmanbk/db_%U';

 #backup database skip inaccessible filesperset 20 tag 'before-upgrade' plus archivelog delete all input
 backup database skip inaccessible filesperset 20 tag 'before-upgrade' plus archivelog delete all input ;
 #backup database skip inaccessible include current controlfile filesperset 20 tag 'before-upgrade' plus archivelog delete all input ;

alter database open;
show all;
list backupset;

EOF
exit;


开始脱机备份数据库:

[oracle@mydb1 ~]$ ./backup-offilne.sh 


Recovery Manager: Release 10.2.0.1.0 - Production on Fri Dec 9 16:37:00 2011

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

connected to target database: MYDB1 (DBID=3843918227)

RMAN>
RMAN>
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

RMAN>
connected to target database (not started)
Oracle instance started
database mounted
database opened

Total System Global Area    2147483648 bytes

Fixed Size                     2022144 bytes
Variable Size                486540544 bytes
Database Buffers            1644167168 bytes
Redo Buffers                  14753792 bytes

RMAN>
database closed
database dismounted
Oracle instance shut down

RMAN>
connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    2147483648 bytes

Fixed Size                     2022144 bytes
Variable Size                486540544 bytes
Database Buffers            1644167168 bytes
Redo Buffers                  14753792 bytes

RMAN>
RMAN>
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=155 devtype=DISK

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
51      51      1   1   AVAILABLE   DISK        /u01/rmanbk/db_1kmtppm4_1_1
52      52      1   1   AVAILABLE   DISK        /u01/rmanbk/db_1jmtppm4_1_1
53      53      1   1   AVAILABLE   DISK        /u01/rmanbk/ct_c-3843918227-20111209-0e
deleted backup piece
backup piece handle=/u01/rmanbk/db_1kmtppm4_1_1 recid=51 stamp=769451716
deleted backup piece
backup piece handle=/u01/rmanbk/db_1jmtppm4_1_1 recid=52 stamp=769451716
deleted backup piece
backup piece handle=/u01/rmanbk/ct_c-3843918227-20111209-0e recid=53 stamp=769451753
Deleted 3 objects

RMAN>
RMAN>
old RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored

RMAN>
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1
released channel: ORA_DISK_2

RMAN>
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN>
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/rmanbk/ct_%F';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/rmanbk/ct_%F';
new RMAN configuration parameters are successfully stored


RMAN>
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored

RMAN>
old RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/db_%U';
new RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/db_%U';
new RMAN configuration parameters are successfully stored

RMAN>
old RMAN configuration parameters:
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/db_%U';
new RMAN configuration parameters:
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/db_%U';
new RMAN configuration parameters are successfully stored

RMAN>
RMAN> 2>

Starting backup at 09-DEC-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=155 devtype=DISK
specification does not match any archive log in the recovery catalog
backup cancelled because all files were skipped
Finished backup at 09-DEC-11

Starting backup at 09-DEC-11
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/oradata/mydb1/system01.dbf
input datafile fno=00004 name=/u01/oradata/mydb1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-DEC-11
channel ORA_DISK_2: starting compressed full datafile backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
input datafile fno=00003 name=/u01/oradata/mydb1/sysaux01.dbf
input datafile fno=00002 name=/u01/oradata/mydb1/undotbs01.dbf
channel ORA_DISK_2: starting piece 1 at 09-DEC-11
channel ORA_DISK_2: finished piece 1 at 09-DEC-11
piece handle=/u01/rmanbk/db_1nmtppro_1_1 tag=BEFORE-UPGRADE comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: finished piece 1 at 09-DEC-11
piece handle=/u01/rmanbk/db_1mmtppro_1_1 tag=BEFORE-UPGRADE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:40
Finished backup at 09-DEC-11

Starting backup at 09-DEC-11
using channel ORA_DISK_1
using channel ORA_DISK_2
specification does not match any archive log in the recovery catalog
backup cancelled because all files were skipped
Finished backup at 09-DEC-11

Starting Control File and SPFILE Autobackup at 09-DEC-11
piece handle=/u01/rmanbk/ct_c-3843918227-20111209-0f comment=NONE
Finished Control File and SPFILE Autobackup at 09-DEC-11

RMAN> 2> 3>
database opened

RMAN>
using channel ORA_DISK_1
using channel ORA_DISK_2
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/db_1nmtppro_1_1 recid=54 stamp=769451896
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/db_1mmtppro_1_1 recid=55 stamp=769451896
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/ct_c-3843918227-20111209-0f recid=56 stamp=769451936
Crosschecked 3 objects


RMAN>
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/rmanbk/ct_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/db_%U';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/db_%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/dbhome_1/dbs/snapcf_mydb1.f'; # default

RMAN>

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
54      Full    26.25M     DISK        00:00:24     09-DEC-11    
        BP Key: 54   Status: AVAILABLE  Compressed: YES  Tag: BEFORE-UPGRADE
        Piece Name: /u01/rmanbk/db_1nmtppro_1_1
  List of Datafiles in backup set 54
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 661982     09-DEC-11 /u01/oradata/mydb1/undotbs01.dbf
  3       Full 661982     09-DEC-11 /u01/oradata/mydb1/sysaux01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
55      Full    79.40M     DISK        00:00:34     09-DEC-11    
        BP Key: 55   Status: AVAILABLE  Compressed: YES  Tag: BEFORE-UPGRADE
        Piece Name: /u01/rmanbk/db_1mmtppro_1_1
  List of Datafiles in backup set 55
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 661982     09-DEC-11 /u01/oradata/mydb1/system01.dbf
  4       Full 661982     09-DEC-11 /u01/oradata/mydb1/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
56      Full    7.08M      DISK        00:00:00     09-DEC-11    
        BP Key: 56   Status: AVAILABLE  Compressed: NO  Tag: TAG20111209T163856
        Piece Name: /u01/rmanbk/ct_c-3843918227-20111209-0f
  Control File Included: Ckp SCN: 661982       Ckp time: 09-DEC-11
  SPFILE Included: Modification time: 09-DEC-11

RMAN>
RMAN>

Recovery Manager complete.



备份完数据库以后备份$ORACLE_HOME,先shutdown数据库,退出,关掉所有oracle进程,包括监听、dbconsole等等,最后用ps确认一下


[oracle@mydb1 Disk1]$ ps -eaf|grep ora
root      2513  2481  0 Dec08 ?        00:01:00 hald-addon-storage: polling /dev/sr0
root     12173  2686  0 Dec08 ?        00:00:00 sshd: oracle [priv]
oracle   12175 12173  0 Dec08 ?        00:00:00 sshd: oracle@pts/6
oracle   12176 12175  0 Dec08 pts/6    00:00:00 -bash
root     20951  2686  0 20:10 ?        00:00:00 sshd: oracle [priv]
oracle   20955 20951  0 20:10 ?        00:00:00 sshd: oracle@pts/0
oracle   20956 20955  0 20:10 pts/0    00:00:00 -bash
oracle   20976 20955  0 20:10 ?        00:00:00 /usr/libexec/openssh/sftp-server
oracle   20993 20955  0 20:12 ?        00:00:00 /usr/libexec/openssh/sftp-server
oracle   21325 20956  0 21:12 pts/0    00:00:00 ps -eaf
oracle   21326 20956  0 21:12 pts/0    00:00:00 grep ora
[oracle@mydb1 Disk1]$




[oracle@mydb1 oracle]$ cd /u01/app/oracle/
[oracle@mydb1 oracle]$ ls -l
total 20
drwxr-x--- 3 oracle oinstall 4096 Dec  8 16:24 admin
drwxr-x--- 3 oracle oinstall 4096 Dec  8 16:29 flash_recovery_area
drwxr-xr-x 6 oracle oinstall 4096 Dec  8 16:13 oraInventory
drwxrwxr-x 3 oracle oinstall 4096 Dec  8 07:42 product
[oracle@mydb1 oracle]$ du -sh product
1.7G    product
[oracle@mydb1 oracle]$

tar -zcvf product_old.tar.gz product

[oracle@mydb1 oracle]$ ls -hl
total 747M
drwxr-x--- 3 oracle oinstall 4.0K Dec  8 16:24 admin
drwxr-x--- 3 oracle oinstall 4.0K Dec  8 16:29 flash_recovery_area
drwxr-xr-x 6 oracle oinstall 4.0K Dec  8 16:13 oraInventory
drwxrwxr-x 3 oracle oinstall 4.0K Dec  8 07:42 product
-rw-r--r-- 1 oracle oinstall 746M Dec  9 16:48 product_old.tar.gz
[oracle@mydb1 oracle]$


现在已经有了数据库的完整备份,可以放心的升级到10.2.0.5啦,万一出错,也可以很快的恢复回来。


拷贝模板文件

cp ug/Disk1/response/patchset.rsp ~/

默认内容如下


[oracle@mydb1 ~]$ more ug/Disk1/response/patchset.rsp|grep -v ^#|grep -v ^$
RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME=<Value Unspecified>
FROM_LOCATION=<Value Required>
NEXT_SESSION_RESPONSE=<Value Unspecified>
ORACLE_HOME=<Value Required>
ORACLE_HOME_NAME=<Value Required>
TOPLEVEL_COMPONENT={"oracle.patchset.db","10.2.0.5.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=false
SHOW_COMPONENT_LOCATIONS_PAGE=false
SHOW_CUSTOM_TREE_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=true
SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
SHOW_OPTIONAL_CONFIG_TOOL_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_XML_PREREQ_PAGE=false
SHOW_RELEASE_NOTES=false
SHOW_END_OF_INSTALL_MSGS=true
SHOW_ROOTSH_CONFIRMATION=true
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=false
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=false
SHOW_DEINSTALL_CONFIRMATION=false
SHOW_DEINSTALL_PROGRESS=false
ACCEPT_LICENSE_AGREEMENT=true
RESTART_SYSTEM=<Value Unspecified>
CLUSTER_NODES=<Value Unspecified>
OUI_HOSTNAME=<Value Unspecified>
REMOVE_HOMES=<Value Unspecified>
COMPONENT_LANGUAGES={"en"}
sl_userNodeList=<Value Unspecified>
MYORACLESUPPORT_USERNAME=<Value Unspecified>
MYORACLESUPPORT_PASSWORD=<Value Unspecified>
PROXY_HOST=<Value Unspecified>
PROXY_PORT=<Value Unspecified>
PROXY_USER=<Value Unspecified>
PROXY_PWD=<Value Unspecified>
SECURITY_UPDATES_VIA_MYORACLESUPPORT=<Value Unspecified>
DECLINE_SECURITY_UPDATES=<Value Unspecified>
COLLECTOR_UPGRADE=<Value Unspecified>
COLLECTOR_IGNORE_CONFIGURATION=<Value Unspecified>
COLLECTOR_IGNORE_FAILURES=<Value Unspecified>
COLLECTOR_USE_OBFUSCATED_PASSWORDS=<Value Unspecified>
COLLECTOR_RESPONSE_FILE=<Value Unspecified>
COLLECTOR_SUPPORTHUB_URL=<Value Unspecified>

前几项必须修改成相应的值,后边布尔值保持默认。如果ORACLE_HOME_NAMEORACLE_HOME_NAME值不记得的话,可以查看下边这个文件
more /u01/app/oracle/oraInventory/ContentsXML/inventory.xml

修改后的responsefile如下:


RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME=oinstall
FROM_LOCATION="/home/oracle/ug/Disk1/stage/products.xml"
NEXT_SESSION_RESPONSE=
ORACLE_HOME="/u01/app/oracle/product/10.2.0/dbhome_1"
ORACLE_HOME_NAME="OraDbHome1"
TOPLEVEL_COMPONENT={"oracle.patchset.db","10.2.0.5.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=false
SHOW_COMPONENT_LOCATIONS_PAGE=false
SHOW_CUSTOM_TREE_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=true
SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
SHOW_OPTIONAL_CONFIG_TOOL_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_XML_PREREQ_PAGE=false
SHOW_RELEASE_NOTES=false
SHOW_END_OF_INSTALL_MSGS=true
SHOW_ROOTSH_CONFIRMATION=true
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=false
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=false
SHOW_DEINSTALL_CONFIRMATION=false
SHOW_DEINSTALL_PROGRESS=false
ACCEPT_LICENSE_AGREEMENT=true
RESTART_SYSTEM=false
CLUSTER_NODES=
OUI_HOSTNAME=
REMOVE_HOMES=
COMPONENT_LANGUAGES={"en,zh_CN"}
sl_userNodeList=
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES= true
COLLECTOR_UPGRADE=
COLLECTOR_IGNORE_CONFIGURATION=
COLLECTOR_IGNORE_FAILURES=
COLLECTOR_USE_OBFUSCATED_PASSWORDS=
COLLECTOR_RESPONSE_FILE=
COLLECTOR_SUPPORTHUB_URL=



开始升级

./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/patchset.rsp

可能会遇到下边这个错误

[oracle@mydb1 Disk1]$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/patchset.rsp
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, SuSE-10, redhat-4, redhat-5, redhat-6, UnitedLinux-1.0, asianux-1, asianux-2, asianux-3, enterprise-4, enterprise-5 or SuSE-11
                                      Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-12-09_09-10-52PM. Please wait ...[oracle@mydb1 Disk1]$ Oracle Universal Installer, Version 10.2.0.5.0 Production
Copyright (C) 1999, 2010, Oracle. All rights reserved.

You can find a log of this install session at:
 /u01/app/oracle/oraInventory/logs/installActions2011-12-09_09-10-52PM.log
.................................................................................................... 100% Done.


Loading Product Information
.................................................................................................................. 100% Done.

SEVERE:Values for the following variables could not be obtained from the command line or response file(s):
  MYORACLESUPPORT_USERNAME(MyOracleSupportUsername)
Silent install cannot continue.

如果遇到的话,修改responsefile中

DECLINE_SECURITY_UPDATES=true


升级开始以后会提示日志文件位置,如下所示



[oracle@mydb1 Disk1]$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/patchset.rsp 
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, SuSE-10, redhat-4, redhat-5, redhat-6, UnitedLinux-1.0, asianux-1, asianux-2, asianux-3, enterprise-4, enterprise-5 or SuSE-11
                                      Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-12-09_09-23-50PM. Please wait ...[oracle@mydb1 Disk1]$ Oracle Universal Installer, Version 10.2.0.5.0 Production
Copyright (C) 1999, 2010, Oracle. All rights reserved.

You can find a log of this install session at:
 /u01/app/oracle/oraInventory/logs/installActions2011-12-09_09-23-50PM.log
.................................................................................................... 100% Done.

Linking in progress (Friday, December 9, 2011 9:25:59 PM CST)
...                                                              88% Done.
Link successful


Setup in progress (Friday, December 9, 2011 9:28:13 PM CST)
...........                                                     100% Done.
Setup successful


End of install phases.(Friday, December 9, 2011 9:28:20 PM CST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root script to run
/u01/app/oracle/product/10.2.0/dbhome_1/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts


The installation of Oracle Database 10g Release 2 Patch Set 4 was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2011-12-09_09-23-50PM.log' for more details.

按提示以root运行脚本

[oracle@mydb1 Disk1]$ su -
Password: 
[root@mydb1 ~]# 
[root@mydb1 ~]# 
[root@mydb1 ~]# /u01/app/oracle/product/10.2.0/dbhome_1/root.sh
Running Oracle 10g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/10.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: y
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[root@mydb1 ~]# 

启动监听

[oracle@mydb1 Disk1]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 09-DEC-2011 22:45:39

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/10.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Log messages written to /u01/app/oracle/product/10.2.0/dbhome_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mydb1)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date                09-DEC-2011 22:45:39
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mydb1)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@mydb1 Disk1]$ 
以sysdba连接oracle,启动到upgrade模式
[oracle@mydb1 Disk1]$ sqlplus -V

SQL*Plus: Release 10.2.0.5.0 - Production

 

[oracle@mydb1 Disk1]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Dec 9 22:46:25 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn sys/adf as sysdba
Connected to an idle instance.
SQL> 
SQL> 
SQL> startup upgrade
ORACLE instance started.

Total System Global Area 2147483648 bytes
Fixed Size                  2097656 bytes
Variable Size             486542856 bytes
Database Buffers         1644167168 bytes
Redo Buffers               14675968 bytes
Database mounted.
Database opened.
SQL> 
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

SQL> select rownum,parameter,value from (select parameter,value from v$option order by 2);
    ROWNUM PARAMETER                                          VALUE
---------- -------------------------------------------------- --------------------
         1 Oracle Database Vault                              FALSE
         2 Data Mining Scoring Engine                         FALSE
         3 Real Application Clusters                          FALSE
         4 Oracle Label Security                              FALSE
         5 Connection multiplexing                            TRUE
         6 Connection pooling                                 TRUE
         7 Database queuing                                   TRUE
         8 Incremental backup and recovery                    TRUE
         9 Instead-of triggers                                TRUE
        10 Parallel backup and recovery                       TRUE
        11 Parallel execution                                 TRUE
        12 Parallel load                                      TRUE
        13 Point-in-time tablespace recovery                  TRUE
        14 Fine-grained access control                        TRUE
        15 Proxy authentication/authorization                 TRUE
        16 Change Data Capture                                TRUE
        17 Plan Stability                                     TRUE
        18 Online Index Build                                 TRUE
        19 Coalesce Index                                     TRUE
        20 Managed Standby                                    TRUE
        21 Materialized view rewrite                          TRUE
        22 Materialized view warehouse refresh                TRUE
        23 Database resource manager                          TRUE
        24 Spatial                                            TRUE
        25 Visual Information Retrieval                       TRUE
        26 Export transportable tablespaces                   TRUE
        27 Transparent Application Failover                   TRUE
        28 Fast-Start Fault Recovery                          TRUE
        29 Sample Scan                                        TRUE
        30 Duplexed backups                                   TRUE
        31 Java                                               TRUE
        32 OLAP Window Functions                              TRUE
        33 Block Media Recovery                               TRUE
        34 Fine-grained Auditing                              TRUE
        35 Application Role                                   TRUE
        36 Enterprise User Security                           TRUE
        37 Oracle Data Guard                                  TRUE
        38 OLAP                                               TRUE
        39 Table compression                                  TRUE
        40 Join index                                         TRUE
        41 Trial Recovery                                     TRUE
        42 Data Mining                                        TRUE
        43 Online Redefinition                                TRUE
        44 Streams Capture                                    TRUE
        45 File Mapping                                       TRUE
        46 Block Change Tracking                              TRUE
        47 Flashback Table                                    TRUE
        48 Flashback Database                                 TRUE
        49 Transparent Data Encryption                        TRUE
        50 Backup Encryption                                  TRUE
        51 Unused Block Compression                           TRUE
        52 Bit-mapped indexes                                 TRUE

    ROWNUM PARAMETER                                          VALUE
---------- -------------------------------------------------- --------------------
        53 Advanced replication                               TRUE
        54 Real Application Testing                           TRUE
        55 Partitioning                                       TRUE
        56 Objects                                            TRUE

56 rows selected.

SQL> 

SQL> select count(*) from dba_objects where status = 'INVALID';

  COUNT(*)
----------
       132

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

........................................



TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UPGRD_END  2011-12-09 23:34:36

1 row selected.

.
Oracle Database 10.2 Upgrade Status Utility           12-09-2011 23:34:36
.
Component                                Status         Version  HH:MM:SS
Oracle Database Server                    VALID      10.2.0.5.0  00:09:59
JServer JAVA Virtual Machine              VALID      10.2.0.5.0  00:01:52
Oracle XDK                                VALID      10.2.0.5.0  00:01:48
Oracle Database Java Packages             VALID      10.2.0.5.0  00:00:25
Oracle Text                               VALID      10.2.0.5.0  00:00:41
Oracle XML Database                       VALID      10.2.0.5.0  00:03:16
Oracle Workspace Manager                  VALID      10.2.0.5.0  00:01:05
Oracle Data Mining                        VALID      10.2.0.5.0  00:00:27
OLAP Analytic Workspace                   VALID      10.2.0.5.0  00:00:30
OLAP Catalog                              VALID      10.2.0.5.0  00:01:34
Oracle OLAP API                           VALID      10.2.0.5.0  00:01:46
Oracle interMedia                         VALID      10.2.0.5.0  00:05:29
Spatial                                   VALID      10.2.0.5.0  00:04:05
Oracle Expression Filter                  VALID      10.2.0.5.0  00:00:28
Oracle Rule Manager                       VALID      10.2.0.5.0  00:00:17
.
Total Upgrade Time: 00:37:32

PL/SQL procedure successfully completed.

DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC>   The above PL/SQL lists the SERVER components in the upgraded
DOC>   database, along with their current version and status.
DOC>
DOC>   Please review the status and version columns and look for
DOC>   any errors in the spool log file.  If there are errors in the spool
DOC>   file, or any components are not VALID or not the current version,
DOC>   consult the Oracle Database Upgrade Guide for troubleshooting
DOC>   recommendations.
DOC>
DOC>   Next shutdown immediate, restart for normal operation, and then
DOC>   run utlrp.sql to recompile any invalid application objects.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL> 


SQL> @?/rdbms/admin/utlu102s.sql
.
Oracle Database 10.2 Upgrade Status Utility           12-09-2011 23:35:36
.
Component                                Status         Version  HH:MM:SS
Oracle Database Server                    VALID      10.2.0.5.0  00:09:59
JServer JAVA Virtual Machine              VALID      10.2.0.5.0  00:01:52
Oracle XDK                                VALID      10.2.0.5.0  00:01:48
Oracle Database Java Packages             VALID      10.2.0.5.0  00:00:25
Oracle Text                               VALID      10.2.0.5.0  00:00:41
Oracle XML Database                       VALID      10.2.0.5.0  00:03:16
Oracle Workspace Manager                  VALID      10.2.0.5.0  00:01:05
Oracle Data Mining                        VALID      10.2.0.5.0  00:00:27
OLAP Analytic Workspace                   VALID      10.2.0.5.0  00:00:30
OLAP Catalog                              VALID      10.2.0.5.0  00:01:34
Oracle OLAP API                           VALID      10.2.0.5.0  00:01:46
Oracle interMedia                         VALID      10.2.0.5.0  00:05:29
Spatial                                   VALID      10.2.0.5.0  00:04:05
Oracle Expression Filter                  VALID      10.2.0.5.0  00:00:28
Oracle Rule Manager                       VALID      10.2.0.5.0  00:00:17
.
Total Upgrade Time: 00:37:32

PL/SQL procedure successfully completed.

SQL>

关闭数据库并重新启动到normal模式

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

Total System Global Area 2147483648 bytes
Fixed Size                  2097656 bytes
Variable Size             520097288 bytes
Database Buffers         1610612736 bytes
Redo Buffers               14675968 bytes
Database mounted.
Database opened.
SQL> 

视情况运行 SQL> @?/rdbms/admin/olstrig.sql (Label Security policies),


重新编译失效对象

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

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2011-12-09 23:40:54

1 row selected.

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

漫长的等待。。。。。。。

该抽烟抽烟,该上厕所上厕所。。。。。。。

SQL>
SQL> SELECT count(*) FROM dba_objects WHERE status='INVALID';

  COUNT(*)
----------
         0

1 row selected.

SQL> 


OK,本次数据库升级到此结束,谢谢观赏。下级预告:

安装Oracle Enterprise Manager Grid Control 12C,日期待定。









没有评论:

发表评论