1:操作系统要求
如下所示,官方文档有system requirements,即必须满足操作系统要求才能打补丁,一般情况下很少有不满足条件。
System Requirements
The following are the system requirements for this patch set:
Operating System
Asianux 2.0
Asianux 3.0
Oracle Enterprise Linux 4.0/Oracle VM
Oracle Enterprise Linux 5.0/Oracle VM
Red Hat Enterprise Linux AS/ES 3.0
Red Hat Enterprise Linux AS/ES 4.0/Oracle VM
Red Hat Enterprise Linux AS/ES 5.0/Oracle VM
SUSE Linux Enterprise Server (SLES) 9
SUSE Linux Enterprise Server (SLES) 10
Oracle Database 10g (10.2.0.1) or later
2:检查设置环境变量
[oracle@enmo Disk1]$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1
[oracle@enmo Disk1]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@enmo Disk1]$
3:查看安装补丁情况
[oracle@enmo Disk1]$ cd $ORACLE_HOME
[oracle@enmo db_1]$ cd OPatch/
[oracle@enmo OPatch]$
[oracle@enmo OPatch]$ opatch
-bash: opatch: command not found
[oracle@enmo OPatch]$ ./opatch
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2017_Apr_11_22-23-53-CST_Tue.log
Usage: opatch [ -help ] [ -r[eport] ] [ command ]
command := apply
lsinventory
query
rollback
version
<global_arguments> := -help Displays the help message for the command.
-report Print the actions without executing (deprecated).
example:
'opatch -help'
'opatch apply -help'
'opatch lsinventory -help'
'opatch rollback -help'
OPatch succeeded.
[oracle@enmo OPatch]$ ./opatch version
Invoking OPatch 10.2.0.1.0
OPatch Version: 10.2.0.1.0
OPatch succeeded.
[oracle@enmo OPatch]$ ./opatch lsinv
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2017_Apr_11_22-24-16-CST_Tue.log
Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory-2017_Apr_11_22-24-16-CST_Tue.txt
-------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 10g 10.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
-------------------------------------------------------------------------------
4:检查Oracle Time Zone Definitions
SQL> select version from v$timezone_file;
VERSION
----------
2
OPatch succeeded.
5:停止所有进程(Stop All Processes)
$ emctl stop dbconsole
$ isqlplusctl stop
$ lsnrctl stop
SQL> SHUTDOWN IMMEDIATE
[oracle@enmo OPatch]$ emctl sto dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://enmo:1158/em/console/aboutApplication
Invalid arguments
Unknown command option sto
Usage::
Oracle Enterprise Manager 10g Database Control commands:
emctl start| stop| status| setpasswd dbconsole
emctl secure <options>
emctl set ssl test|off|on em
emctl set ldap <host> <port> <user dn> <user pwd> <context dn>
emctl blackout options can be listed by typing "emctl blackout"
emctl config options can be listed by typing "emctl config"
emctl secure options can be listed by typing "emctl secure"
emctl ilint options can be listed by typing "emctl ilint"
emctl deploy options can be listed by typing "emctl deploy"
[oracle@enmo OPatch]$ emctl stop dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://enmo:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
... Stopped.
[oracle@enmo OPatch]$
[oracle@enmo OPatch]$ isqlplusctl stop
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
iSQL*Plus instance on port 5561 is not running ...
[oracle@enmo OPatch]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-APR-2017 22:27:33
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
[oracle@enmo OPatch]$
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
6.安装补丁包
Oracle提供了两种方式安装补丁包,即图形化安装或静默安装。即Installing the Oracle Database 10g Patch Set Interactively 和
Installing the Oracle Database 10g Patch Set Noninteractively 安装。
下面我用Installing the Oracle Database 10g Patch Set Interactively
Installing the Oracle Database 10g Patch Set Interactively
1.Log in as the oracle user.
2.If you are not installing the software on the local computer, then run the following command on remote machine:
Bourne, Bash, or Korn shell:
$ export DISPLAY=localhost:0.0
C shell:
% setenv DISPLAY local_host:0.0
In this example, local_host is the host name or IP address of the computer that you want to use to display Oracle Universal Installer.
Now to enable X applications, run the following command on the machine that you want to use to display Oracle Universal Installer:
$ xhost + [fully_qualified_remote_host_name]
这里我直接在主机上安装,就不用上面的步骤了
[oracle@enmo ~]$ cd /u01/Disk1/
[oracle@enmo Disk1]$ ./runInstaller
使用root运行/u01/app/oracle/product/10.2.0/db_1/root.sh就可以了
安装后任务
7.升级数据库
可以使用手工升级数据库或使用DBUA界面安装数据库。下面我们选择使用手工升级数据库
[oracle@enmo ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Apr 11 22:45:47 2017
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL>
SQL>
SQL>
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 557842432 bytes
Fixed Size 2085456 bytes
Variable Size 155192752 bytes
Database Buffers 394264576 bytes
Redo Buffers 6299648 bytes
Database mounted.
Database opened.
SQL> SPOOL upgrade_info.log
SQL> @?/rdbms/admin/utlu102i.sql
Oracle Database 10.2 Upgrade Information Utility 04-11-2017 22:46:38
.
**********************************************************************
Database:
**********************************************************************
--> name: ENMO
--> version: 10.2.0.1.0
--> compatible: 10.2.0.1.0
--> blocksize: 8192
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 489 MB
.... AUTOEXTEND additional space required: 9 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 359 MB
.... AUTOEXTEND additional space required: 59 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 255 MB
.... AUTOEXTEND additional space required: 15 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 58 MB
.... AUTOEXTEND additional space required: 31 MB
.
**********************************************************************
Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.
**********************************************************************
Components: [The following database components 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 Java Packages [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> Oracle Data Mining [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Rule Manager [upgrade] VALID
.
PL/SQL procedure successfully completed.
SQL>
[oracle@enmo OPatch]$ ./opatch lsinv
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.2
OUI version : 10.2.0.4.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2017-04-11_22-47-44PM.log
Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-04-11_22-47-44PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 10.2.0.4.0
There are 2 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
[oracle@enmo OPatch]$
SQL> select version from v$timezone_file;
VERSION
----------
4
关闭数据库,然后执行脚本:
SQL> STARTUP UPGRADE
SQL> SPOOL patch.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> SPOOL OFF
@?/rdbms/admin/catupgrd.sql
。
。
。
Oracle Data Mining VALID 10.2.0.4.0 00:00:14
OLAP Analytic Workspace VALID 10.2.0.4.0 00:00:32
OLAP Catalog VALID 10.2.0.4.0 00:00:42
Oracle OLAP API VALID 10.2.0.4.0 00:00:39
Oracle interMedia VALID 10.2.0.4.0 00:03:18
Spatial VALID 10.2.0.4.0 00:01:06
Oracle Expression Filter VALID 10.2.0.4.0 00:00:08
Oracle Enterprise Manager VALID 10.2.0.4.0 00:01:01
Oracle Rule Manager VALID 10.2.0.4.0 00:00:06
.
Total Upgrade Time: 00:21:26
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> COL COMP_NAME FOR A50
SQL> COL VERSION FOR A12
SQL> COL STATUS FOR A12
SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
COMP_NAME VERSION STATUS
-------------------------------------------------- ------------ ------------
Oracle Enterprise Manager 10.2.0.4.0 VALID
Spatial 10.2.0.4.0 VALID
Oracle interMedia 10.2.0.4.0 VALID
OLAP Catalog 10.2.0.4.0 VALID
Oracle XML Database 10.2.0.4.0 VALID
Oracle Text 10.2.0.4.0 VALID
Oracle Expression Filter 10.2.0.4.0 VALID
Oracle Rule Manager 10.2.0.4.0 VALID
Oracle Workspace Manager 10.2.0.4.3 VALID
Oracle Data Mining 10.2.0.4.0 VALID
Oracle Database Catalog Views 10.2.0.4.0 VALID
Oracle Database Packages and Types 10.2.0.4.0 VALID
JServer JAVA Virtual Machine 10.2.0.4.0 VALID
Oracle XDK 10.2.0.4.0 VALID
Oracle Database Java Packages 10.2.0.4.0 VALID
OLAP Analytic Workspace 10.2.0.4.0 VALID
Oracle OLAP API 10.2.0.4.0 VALID
升级成功
SQL> select to_char(version) from v$timezone_file;
TO_CHAR(VERSION)
----------------------------------------
4
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31467250/viewspace-2141190/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31467250/viewspace-2141190/