下载Oracle11.2.0.3.1补丁包(PSU)
上传到服务器上。
unzip p13343438_112030_AIX64-5L.zip
停止Oracle实例
停止Oracle监听
停止EM
定义环境变量
export PATH=$PATH:$ORACLE_HOME/OPatch
输入如下命令: /*opatch命令就在$ORACLE_HOME/OPatch目录下,13343438就是PSU解压生的文件夹名*/
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./13343438
cd 13343438
opatch apply
这时就将补丁安装了,但是并没有提交,只有提交后才生效。
启动数据库实例,执行SQL脚本,提交PSU。 /*可以有多种方法启动数据库实例,只要能够执行catbundle.sql脚本就行了*/
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
/*在执行脚本时遇到过一个报错,内容如下:
SQL> @catbundle.sql psu apply
PL/SQL procedure successfully completed.
IF dbms_registry.is_valid('JAVAVM',dbms_registry.release_version) = 1 THEN
*
ERROR at line 2:
ORA-06550: line 2, column 6:
PLS-00201: identifier 'DBMS_REGISTRY.IS_VALID' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
DBMS_SYSTEM.GET_ENV('ORACLE_BASE', baseDir);
*
ERROR at line 17:
ORA-06550: line 17, column 3:
PLS-00201: identifier 'DBMS_SYSTEM.GET_ENV' must be declared
ORA-06550: line 17, column 3:
PL/SQL: Statement ignored
ORA-06550: line 18, column 3:
PLS-00201: identifier 'DBMS_SYSTEM.GET_ENV' must be declared
ORA-06550: line 18, column 3:
PL/SQL: Statement ignored
ORA-06550: line 21, column 5:
PLS-00201: identifier 'RAISE_APPLICATION_ERROR' must be declared
ORA-06550: line 21, column 5:
PL/SQL: Statement ignored
ORA-06550: line 64, column 6:
PLS-00201: identifier 'DBMS_REGISTRY.IS_VALID' must be declared
ORA-06550: line 64, column 3:
PL/SQL: Statement ignored
*/
经查是因为没有给用户DBMS_AQ的execute权限,赋于权限后问题解决。
grant execute on DBMS_AQ to sys;
再次执行SQL脚本:
SQL> @catbundle.sql psu apply
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Generating apply and rollback scripts...
Check the following file for errors:
/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_SRXTDB_GENERATE_2012Feb14_12_36_22.log
Apply script: /app/oracle/db/rdbms/admin/catbundle_PSU_SRXTDB_APPLY.sql
Rollback script: /app/oracle/db/rdbms/admin/catbundle_PSU_SRXTDB_ROLLBACK.sql
PL/SQL procedure successfully completed.
Executing script file...
SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/app/oracle/cfgtoollogs/catbundle/' || 'catbundle_PSU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;
SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')
PL/SQL procedure successfully completed.
SQL> ALTER SESSION SET current_schema = SYS;
Session altered.
SQL> PROMPT Updating registry...
Updating registry...
SQL> INSERT INTO registry$history
2 (action_time, action,
3 namespace, version, id,
4 bundle_series, comments)
5 VALUES
6 (SYSTIMESTAMP, 'APPLY',
7 SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),
8 '11.2.0.3',
9 1,
10 'PSU',
11 'PSU 11.2.0.3.1');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_SRXTDB_APPLY_2012Feb14_12_36_24.log
SQL> commit;
成功完成数据库升级。
查看数据库PSU版本:
输入:
SQL> select namespace,version,comments from dba_registry_history;
NAMESPACE VERSION
------------------------------ ------------------------------
COMMENTS
--------------------------------------------------------------------------------
SERVER 11.2.0.3
Patchset 11.2.0.2.0
SERVER 11.2.0.3
Patchset 11.2.0.2.0
SERVER 11.2.0.3
PSU 11.2.0.3.1
NAMESPACE VERSION
------------------------------ ------------------------------
COMMENTS
--------------------------------------------------------------------------------
SERVER 11.2.0.3
PSU 11.2.0.3.1
SERVER 11.2.0.3
PSU 11.2.0.3.1
SERVER 11.2.0.3
PSU 11.2.0.3.1
6 rows selected.
上传到服务器上。
unzip p13343438_112030_AIX64-5L.zip
停止Oracle实例
停止Oracle监听
停止EM
定义环境变量
export PATH=$PATH:$ORACLE_HOME/OPatch
输入如下命令: /*opatch命令就在$ORACLE_HOME/OPatch目录下,13343438就是PSU解压生的文件夹名*/
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./13343438
cd 13343438
opatch apply
这时就将补丁安装了,但是并没有提交,只有提交后才生效。
启动数据库实例,执行SQL脚本,提交PSU。 /*可以有多种方法启动数据库实例,只要能够执行catbundle.sql脚本就行了*/
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
/*在执行脚本时遇到过一个报错,内容如下:
SQL> @catbundle.sql psu apply
PL/SQL procedure successfully completed.
IF dbms_registry.is_valid('JAVAVM',dbms_registry.release_version) = 1 THEN
*
ERROR at line 2:
ORA-06550: line 2, column 6:
PLS-00201: identifier 'DBMS_REGISTRY.IS_VALID' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
DBMS_SYSTEM.GET_ENV('ORACLE_BASE', baseDir);
*
ERROR at line 17:
ORA-06550: line 17, column 3:
PLS-00201: identifier 'DBMS_SYSTEM.GET_ENV' must be declared
ORA-06550: line 17, column 3:
PL/SQL: Statement ignored
ORA-06550: line 18, column 3:
PLS-00201: identifier 'DBMS_SYSTEM.GET_ENV' must be declared
ORA-06550: line 18, column 3:
PL/SQL: Statement ignored
ORA-06550: line 21, column 5:
PLS-00201: identifier 'RAISE_APPLICATION_ERROR' must be declared
ORA-06550: line 21, column 5:
PL/SQL: Statement ignored
ORA-06550: line 64, column 6:
PLS-00201: identifier 'DBMS_REGISTRY.IS_VALID' must be declared
ORA-06550: line 64, column 3:
PL/SQL: Statement ignored
*/
经查是因为没有给用户DBMS_AQ的execute权限,赋于权限后问题解决。
grant execute on DBMS_AQ to sys;
再次执行SQL脚本:
SQL> @catbundle.sql psu apply
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Generating apply and rollback scripts...
Check the following file for errors:
/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_SRXTDB_GENERATE_2012Feb14_12_36_22.log
Apply script: /app/oracle/db/rdbms/admin/catbundle_PSU_SRXTDB_APPLY.sql
Rollback script: /app/oracle/db/rdbms/admin/catbundle_PSU_SRXTDB_ROLLBACK.sql
PL/SQL procedure successfully completed.
Executing script file...
SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/app/oracle/cfgtoollogs/catbundle/' || 'catbundle_PSU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;
SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')
PL/SQL procedure successfully completed.
SQL> ALTER SESSION SET current_schema = SYS;
Session altered.
SQL> PROMPT Updating registry...
Updating registry...
SQL> INSERT INTO registry$history
2 (action_time, action,
3 namespace, version, id,
4 bundle_series, comments)
5 VALUES
6 (SYSTIMESTAMP, 'APPLY',
7 SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),
8 '11.2.0.3',
9 1,
10 'PSU',
11 'PSU 11.2.0.3.1');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_SRXTDB_APPLY_2012Feb14_12_36_24.log
SQL> commit;
成功完成数据库升级。
查看数据库PSU版本:
输入:
SQL> select namespace,version,comments from dba_registry_history;
NAMESPACE VERSION
------------------------------ ------------------------------
COMMENTS
--------------------------------------------------------------------------------
SERVER 11.2.0.3
Patchset 11.2.0.2.0
SERVER 11.2.0.3
Patchset 11.2.0.2.0
SERVER 11.2.0.3
PSU 11.2.0.3.1
NAMESPACE VERSION
------------------------------ ------------------------------
COMMENTS
--------------------------------------------------------------------------------
SERVER 11.2.0.3
PSU 11.2.0.3.1
SERVER 11.2.0.3
PSU 11.2.0.3.1
SERVER 11.2.0.3
PSU 11.2.0.3.1
6 rows selected.