环境说明:参照RedHat Linux 5.6 一步一步安装Oracle 10.2.0.1
详细见p8202632_10205_Linux-x86-64.zip里的README.htm
10.2.0.1升级过程:(10.2.0.1->10.2.0.5)
1.System Requirements操作系统检查
2.Preinstallation Tasks 安装前任务
2.1 Review Known Preinstallation Issues
2.2 Identify the Oracle Database Installation
cat /etc/oratab
2.3 Check Postrelease Updates 省略
2.4 Download and Extract the Installation Software
下载p8202632_10205_Linux-x86-64.zip
2.5 Update Oracle Time Zone Definitions
此步骤在升级后再检查
The 10.2.0.5 patch set includes an update to the Oracle time zone definitions to Version 4. This version of the time zone definitions includes the changes to daylight saving time in the USA in 2007 and other updates.
In the Oracle database the TIMESTAMP WITH LOCAL TIME ZONE (TSLTZ) and TIMESTAMP WITH TIME ZONE (TSTZ) data types and the TZ_OFFSET function select the time zone information from the time zone files.
It may be necessary to take action on existing TIMESTAMP WITH LOCAL TIME ZONE (TSLTZ) and TIMESTAMP WITH TIME ZONE (TSTZ) data or to re-apply DST patches afterwards.
For full overview, see My Oracle Support (formerly OracleMetaLink) document 1086400.1 Actions for the DSTv4 update in the 10.2.0.5 patchset.
When patching from a lower 10.2 release or upgrading from 10.1.0.x directly to 10.2.0.5, check the current version of the Oracle time zone definitions with the following command:
SELECT version FROM v$timezone_file;
If this query reports version 4, no action is required.
If this reports a version lower or higher than 4, see My Oracle Support document 1086400.1 Actions for the DSTv4 update in the Release 10.2.0.5 patchset.
On upgrading from any release of Oracle9i to Release 10.2.0.5, see My Oracle Support document 1086400.1 Actions for the DSTv4 update in the 10.2.0.5 patchset.
On upgrading from Release 8.1.7 directly to Release 10.2.0.5, no action is required because Release 8.1.7 has no timezone data stored.
SQL> SELECT version FROM v$timezone_file;
VERSION
----------
2
2.6 Shut Down Oracle Databases关闭数据库
Shut down any existing Oracle Database instances with normal or immediate priority. On Oracle RAC systems, shut down all instances on each node.
If Oracle Automatic Storage Management (Oracle ASM) is running, shut down all databases that use Oracle ASM, then shut down the Oracle ASM instance on each node of the cluster.
[oracle@rhel ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 19 11:52:40 2017
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
2.7 Set the ORACLE_HOME and ORACLE_SID Environment Variables
设置环境变量
[oracle@rhel ~]$ echo $ORACLE_SID
orcl
[oracle@rhel ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0.1/db_1
[oracle@rhel ~]$
2.8 Stop All Processes(Stopping All Processes for a Single Instance Installation),单实例数据库停所有进程
2.8.1 Shut down allprocesses in the Oracle home that might be accessing a database; for example, Oracle Enterprise Manager Database Control:
$ emctl stop dbconsole
$ lsnrctl stop
2.8.2 Shut down all database instances running in the Oracle home directory, where you need to install the patch set.
2.8.3 Shut down all listeners running in the Oracle home directory, where you need to install the patch set.
2.9 Back Up the System 备份
Oracle recommends that you create a backup of the Oracle Inventory, Oracle 10g home and Oracle 10g Database before you install the patch set. If you are planning to apply this patch to Oracle RAC, ensure that you create a backup of these components on all nodes before applying the patch. You must also ensure that the GID and UID of the CRS / Oracle User be less than 65536 bytes (ID username will provide the UID / GID for the user).
3.Installation Tasks 安装任务
3.1 Installing the Oracle Database 10g Patch Set Interactively 交互模式安装patch set
--解压安装包:
[oracle@rhel ~]$ cd patch/
[oracle@rhel patch]$ ls
p6880880_102000_Linux-x86-64.zip p8202632_10205_Linux-x86-64.zip
[oracle@rhel patch]$ unzip p8202632_10205_Linux-x86-64.zip
................................
[oracle@rhel patch]$ ll
total 1248744
drwxr-xr-x 5 oracle oinstall 4096 Apr 29 2010 Disk1
-rw-r--r-- 1 oracle oinstall 27412455 Oct 17 00:34 p6880880_102000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 1249857866 Oct 17 00:48 p8202632_10205_Linux-x86-64.zip
-rwxr-xr-x 1 oracle oinstall 171131 Apr 29 2010 README.htm
[oracle@rhel patch]$
--使用shell工具启图形安装:
[oracle@rhel ~]$ cd patch/
[oracle@rhel patch]$ ls
Disk1 p8202632_10205_Linux-x86-64.zip
p6880880_102000_Linux-x86-64.zip README.htm
[oracle@rhel patch]$ cd Disk1/
[oracle@rhel Disk1]$ ls
install patch_note.htm response runInstaller stage
[oracle@rhel Disk1]$ ./runInstaller
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/OraInstall2017-10-19_12-04-12PM. Please wait ...[oracle@rhel Disk1]$ Oracle Universal Installer, Version 10.2.0.5.0 Production
Copyright (C) 1999, 2010, Oracle. All
rights reserved.
[root@rhel ~]# /u01/app/oracle/product/10.2.0.1/db_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.1/db_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@rhel ~]#
4.Postinstallation Tasks 安装后任务
4.1 Updating Oracle Time Zone Definitions
SQL> SELECT version FROM v$timezone_file;
VERSION
----------
4
不需要采取任何措施
4.2 Upgrading Oracle Database 10g Release 10.2.0.x to Oracle Database 10g Release 10.2.0.5
See one of the following sections for upgrading an Oracle Database 10g release 10.2.0.x to Oracle Database 10g release 10.2.0.5:
Manually Upgrading a Release 10.2 Database:手动更新版本到10.2:
4.2.1
[oracle@rhel ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Oct 19 14:16:27 2017
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> STARTUP UPGRADE
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 163580992 bytes
Database Buffers 427819008 bytes
Redo Buffers 6287360 bytes
Database mounted.
Database opened.
SQL>
SQL> SPOOL upgrade_info.log
SQL>
SQL> @?/rdbms/admin/utlu102i.sql
Oracle Database 10.2 Upgrade Information Utility 10-19-2017 14:17:32
.
**********************************************************************
Database:
**********************************************************************
--> name: ORCL
--> 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: 492 MB
.... AUTOEXTEND additional space required: 12 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
.... AUTOEXTEND additional space required: 370 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 249 MB
.... AUTOEXTEND additional space required: 9 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 58 MB
.... AUTOEXTEND additional space required: 38 MB
--> EXAMPLE tablespace is adequate for the upgrade.
.... minimum required size: 69 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> SPOOL OFF
检查上述 upgrade_info.log的内容看有无需要整改的
4.2.2,运行catupgrd.sql和utlrp.sql两个脚本
$ lsnrctl start
$ sqlplus /nolog
SQL> CONNECT SYS AS SYSDBA
Enter password:SYS_password
SQL> STARTUP UPGRADE
SQL> SPOOL patch.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> SPOOL OFF
--检查patch.log有无错误
[oracle@rhel ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Oct 19 14:54:01 2017
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select status from v$instance;
STATUS
------------
OPEN MIGRATE
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 209718336 bytes
Database Buffers 381681664 bytes
Redo Buffers 6287360 bytes
Database mounted.
Database opened.
SQL>
SQL> @?/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2017-10-19 14:55:19
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.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2017-10-19 14:56:21
PL/SQL procedure successfully completed.
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
PL/SQL procedure successfully completed.
SQL> SQL>
--验证检查数据库升级后各组件版本及状态
SQL> col COMP_NAME for a40
SQL> set lines 200
SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
COMP_NAME VERSION STATUS
---------------------------------------- ------------------------------ -----------
Oracle Database Catalog Views 10.2.0.5.0 VALID
Oracle Database Packages and Types 10.2.0.5.0 VALID
Oracle Workspace Manager 10.2.0.5.0 VALID
JServer JAVA Virtual Machine 10.2.0.5.0 VALID
Oracle XDK 10.2.0.5.0 VALID
Oracle Database Java Packages 10.2.0.5.0 VALID
Oracle Expression Filter 10.2.0.5.0 VALID
Oracle Data Mining 10.2.0.5.0 VALID
Oracle Text 10.2.0.5.0 VALID
Oracle XML Database 10.2.0.5.0 VALID
Oracle Rule Manager 10.2.0.5.0 VALID
COMP_NAME VERSION STATUS
---------------------------------------- ------------------------------ -----------
Oracle interMedia 10.2.0.5.0 VALID
OLAP Analytic Workspace 10.2.0.5.0 VALID
Oracle OLAP API 10.2.0.5.0 VALID
OLAP Catalog 10.2.0.5.0 VALID
Spatial 10.2.0.5.0 VALID
Oracle Enterprise Manager 10.2.0.5.0 VALID
17 rows selected.
SQL> select status from v$instance;
STATUS
------------
OPEN
升级完成!!!!!!!!!!!!!!