大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

11.2.0.4PSU安装操作模版

    补丁安装是一件常态化的事情,针对11.2.0.4的PSU补丁,整理了一套标准安装流程,补丁版本为每季度的PSU补丁以及OJVM补丁。

 26636028 = 26635745 + 26635834
#########################################################################################################################
##一 参考下面的步骤在一个节点上安装补丁26635745 (PSU),数据库完全停止后,可以在两个节点同时安装
#########################################################################################################################

    
-------------------------------------------------------------------------------------------------------------------------
0.为了避免安装补丁运行数据字典脚本时与系统后台作业冲突,查看AutoTask,如果有Enabled的,先Disable,打完补丁后再Enable.
-------------------------------------------------------------------------------------------------------------------------

su - oracle
sqlplus "/as sysdba"
set lin 180 pages 10000
COL CLIENT_NAME FORMAT A40
COL CONSUMER_GROUP FORMAT A30
COL WINDOW_GROUP FORMAT A30
select CLIENT_NAME,STATUS,CONSUMER_GROUP,WINDOW_GROUP from dba_autotask_client;

CLIENT_NAME                              STATUS   CONSUMER_GROUP                 WINDOW_GROUP
---------------------------------------- -------- ------------------------------ ------------------------------
auto optimizer stats collection          ENABLED  ORA$AUTOTASK_STATS_GROUP       ORA$AT_WGRP_OS
auto space advisor                       DISABLED ORA$AUTOTASK_SPACE_GROUP       ORA$AT_WGRP_SA
sql tuning advisor                       DISABLED ORA$AUTOTASK_SQL_GROUP         ORA$AT_WGRP_SQ

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'auto optimizer stats collection', 
operation => NULL, 
window_name => NULL);
END;
/

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'auto space advisor', 
operation => NULL, 
window_name => NULL);
END;
/

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'sql tuning advisor', 
operation => NULL, 
window_name => NULL);
END;
/

再确认当前的数据库组件状态是否都正常,并记录当前状态:
set lin 170 pages 10000
select comp_id,status,version from dba_registry;


COMP_ID                        STATUS                 VERSION
------------------------------ ---------------------- ------------------------------
OWB                            VALID                  11.2.0.4.0
APEX                           VALID                  3.2.1.00.12
EM                             VALID                  11.2.0.4.0
AMD                            VALID                  11.2.0.4.0
SDO                            VALID                  11.2.0.4.0
ORDIM                          VALID                  11.2.0.4.0
XDB                            VALID                  11.2.0.4.0
CONTEXT                        VALID                  11.2.0.4.0
EXF                            VALID                  11.2.0.4.0
RUL                            VALID                  11.2.0.4.0
OWM                            VALID                  11.2.0.4.0
CATALOG                        VALID                  11.2.0.4.0
CATPROC                        VALID                  11.2.0.4.0
JAVAVM                         VALID                  11.2.0.4.0
XML                            VALID                  11.2.0.4.0
CATJAVA                        VALID                  11.2.0.4.0
APS                            VALID                  11.2.0.4.0
XOQ                            VALID                  11.2.0.4.0
RAC                            VALID                  11.2.0.4.0

19 rows selected.
-------------------------------------------------------------------------------------------------------------------------
1.以grid用户停止listener,并kill数据库会话进程
-------------------------------------------------------------------------------------------------------------------------

su - grid
srvctl stop listener
srvctl stop scan_listener
kill -9 `ps -ef|grep LOCAL=NO|grep -v grep|grep -iv ASM|awk '{print $2}'`

-------------------------------------------------------------------------------------------------------------------------
2.以oracle用户禁用db自动启动,然后停止db
-------------------------------------------------------------------------------------------------------------------------

su - oracle
srvctl disable db -d plandb
srvctl stop db -d plandb

-------------------------------------------------------------------------------------------------------------------------
3.(该步骤已经提前执行完成)以root用户替换opatch工具到最新版本
-------------------------------------------------------------------------------------------------------------------------

su - root
cat /home/oracle/.profile | grep HOME
export PATCH_DIR=/oracle/software
export PATCH_GRID_HOME=/grid/app/11.2.0.4/grid
export PATCH_ORACLE_HOME=/oracle/app/oracle/11.2.0.4/db_1
mv $PATCH_GRID_HOME/OPatch $PATCH_GRID_HOME/Opatch.orig`date +%Y%m%d`
mv $PATCH_ORACLE_HOME/OPatch $PATCH_ORACLE_HOME/OPatch.orig`date +%Y%m%d`

cd $PATCH_DIR
unzip p6880880_112000_Linux-x86-64.zip
cp -r ./OPatch $PATCH_GRID_HOME/
cp -r ./OPatch $PATCH_ORACLE_HOME/
cd $PATCH_GRID_HOME/; chown -R grid:oinstall ./OPatch
cd $PATCH_ORACLE_HOME/; chown -R oracle:oinstall ./OPatch

#########################################################################################################################
##二 参考下面的步骤在一个节点上安装补丁26635745 (GI+DB),数据库完全停止后,可以在两个节点同时安装
#########################################################################################################################
-------------------------------------------------------------------------------------------------------------------------
1.生成OCM.RSP 文件
-------------------------------------------------------------------------------------------------------------------------
su - oracle
export PATCH_DIR=/oracle/software

cd $ORACLE_HOME/OPatch/ocm/bin
./emocmrsp -output /tmp/ocm.rsp
-------------------------------------------------------------------------------------------------------------------------
2.减压补丁集,确认文件宿主和权限
-------------------------------------------------------------------------------------------------------------------------
su - grid
cd $PATCH_DIR
unzip p p26636028_112040_Linux-x86-64.zip
chown -R grid:oinstall 26636028
chmod -R 775 26636028
注意:确认解压文件权限是否满足当前
-------------------------------------------------------------------------------------------------------------------------
3.开始打补丁
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
a.检查root用户的环境变量,如果有ORACLE_HOME,ORA_GRID_HOME,GRID_HOME等设置,需要注销这些环境变量,然后重新登录系统;
b.检查安装crs和db的文件系统空间是否足够,打补丁前至少要保证50G空闲空间;
c.检查root/grid/oracle用户的crontab作业,打补丁前先注销访问$ORACLE_HOME和$GRID_HOME的作业,打完补丁后再启用
d.查看是否有未注册到OCR里的grid/oracle独立进程,例如其他的listener,通过kill -9 杀掉这些进程;如果不确定哪些进程是独立的
  ,可以考虑先停止CRS后再重新拉起来,然后执行后续的步骤
-------------------------------------------------------------------------------------------------------------------------

su - root
export PATCH_DIR=/oracle/software
export PATCH_GRID_HOME=/grid/app/11.2.0.4/grid
export PATCH_ORACLE_HOME=/oracle/app/oracle/11.2.0.4/db_1
exportPSU_PATCH_ID=26636028/26635745

# $PATCH_GRID_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -oh $PATCH_GRID_HOME -ocmrf /tmp/ocm.rsp
# $PATCH_ORACLE_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -oh $PATCH_ORACLE_HOME -ocmrf /tmp/ocm.rsp

----------以下脚本用于补丁回滚操作----------
######### $PATCH_GRID_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -rollback -oh $PATCH_GRID_HOME -ocmrf /tmp/ocm.rsp
######### $PATCH_ORACLE_HOME/OPatch/opatch auto $PATCH_DIR/$PSU_PATCH_ID -rollback -oh $PATCH_ORACLE_HOME -ocmrf /tmp/ocm.rsp
su - grid
$ORACLE_HOME/OPatch/opatch lsinv

su - oracle
$ORACLE_HOME/OPatch/opatch lsinv

#########################################################################################################################
##三 参考下面的步骤在一个节点上安装补丁26635834 (OJVM),数据库完全停止后,可以在两个节点同时安装(可以不打次补丁)
#########################################################################################################################

1.以oracle用户为$PATCH_ORACLE_HOME安装该补丁:

su - oracle	
export PATCH_DIR=/oracle/software

srvctl stop db -d plandb

cd $PATCH_DIR/ 26636028/26635834
$ORACLE_HOME/OPatch/opatch apply -local

$ORACLE_HOME/OPatch/opatch lsinv
#########################################################################################################################
##四 以下步骤必须在所有节点都完成上面的补丁的安装后再执行
#########################################################################################################################
1.补丁安装完后,以grid用户停止监听,然后以oracle用户登录其中一个节点启动数据库,运行数据字典脚本

su - grid
srvctl disable listener
srvctl disable scan_listener

srvctl stop listener
srvctl stop scan_listener

lsnrctl stop
srvctl enable database -d plandb

su - oracle
$GRID_HOME/bin/srvctl start instance -d plandb -n plandb01

The following steps load RDBMSPSUmodified SQL files into the database. For an Oracle RAC environment, perform these steps on only one node.
export ORACLE_SID=

sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @?/rdbms/admin/catbundle.sqlpsuapply

SQL> SELECT * FROM dba_registry_history;

SQL> QUIT

If the OJVMPSUwas applied for a previous GIPSUpatch, you may see invalid Java classes after execution of the catbundle.sql script in the previous step. If this is the case, run utlrp.sql to re-validate these Java classes.


sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @?/rdbms/admin/utlprp.sql 4
Check the following log files in $ORACLE_BASE/cfgtoollogs/catbundle for any errors:

catbundle_PSU__APPLY_.log
catbundle_PSU__GENERATE_.log

###This patch now includes the OJVM Mitigation patch (Patch:19721304). 
###If an OJVMPSUis installed or planned to be installed, no further actions are necessary. 
###Otherwise, the workaround of using the OJVM Mitigation patch can be activated. 
###As SYSDBA do the following from the admin directory:
###SQL > @dbmsjdev.sql
###SQL > exec dbms_java_dev.disable

###1.Install the SQL portion of the patch by running the following command for a single instance environment.
###
###sqlplus /nolog
###SQL> CONNECT / AS SYSDBA
###SQL> shutdown immediate
###SQL> startup upgrade
###SQL> @?/sqlpatch/26635834/postinstall.sql
###SQL> shutdown
###SQL> startup


#########################################################################################################################
##五 以下步骤必须在所有节点都完成上面的4个补丁的安装后再执行(如果OJVM 补丁打了,需要执行下列脚本)
#########################################################################################################################
1.The following steps load modified SQL files into the database. For an Oracle RAC environment, perform these steps on only one node.

    Install the SQL portion of the patch by running the following command for a single instance environment.

    cd $ORACLE_HOME/sqlpatch/26635834
    sqlplus /nolog
    SQL> CONNECT / AS SYSDBA
    SQL> startup upgrade
    SQL> @postinstall.sql
    SQL> shutdown
    SQL> startup

    For an Oracle RAC environment, reload the packages on one of the nodes using the following commands. Make sure no other instance of the database is up on the remote nodes.

    cd $ORACLE_HOME/sqlpatch/26635834
    sqlplus /nolog
    SQL> CONNECT / AS SYSDBA
    SQL> STARTUP
    SQL> alter system set cluster_database=false scope=spfile;
    SQL> SHUTDOWN
    SQL> STARTUP UPGRADE
    SQL> @postinstall.sql
    SQL> alter system set cluster_database=true scope=spfile;
    SQL> SHUTDOWN
    SQL> STARTUP 

    After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.

    cd $ORACLE_HOME/rdbms/admin
    sqlplus /nolog
    SQL> CONNECT / AS SYSDBA
    SQL> @utlrp.sql

2.After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.

sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @?/rdbms/admin/utlprp.sql 4


#########################################################################################################################
##六 校验DB 补丁是否完成,恢复相关服务自启动属性及相关jobs等
#########################################################################################################################
SQL> set lin 170 pages 10000
SQL> select comp_id,status,version from dba_registry;
SQL> SELECT * FROM dba_registry_history;
SQL> shutdown immediate;

3. 以oracle用户重新enable数据库的自动启动,并启动数据库

su - oracle
srvctl enable db -d plandb
srvctl start db -d plandb

4. 以oracle用户重新enable之前被disabled的AutoTask,如果某个AutoTask最初的状态就是disabled,则保持最初状态,无需enable
su - oracle
sqlplus "/as sysdba"
COL CLIENT_NAME FORMAT A40
COL CONSUMER_GROUP FORMAT A30
COL WINDOW_GROUP FORMAT A30
select CLIENT_NAME,STATUS,CONSUMER_GROUP,WINDOW_GROUP from dba_autotask_client;

BEGIN
DBMS_AUTO_TASK_ADMIN.ENABLE('auto optimizer stats collection',null,null);
END;
/

BEGIN
DBMS_AUTO_TASK_ADMIN.ENABLE('auto space advisor',null,null);
END;
/

BEGIN
DBMS_AUTO_TASK_ADMIN.ENABLE('sql tuning advisor',null,null);
END;
/

5. 以grid用户重新enable listener/scan_listener的自动启动,并启动这些监听

su - grid
srvctl enable listener
srvctl enable scan_listener

srvctl start listener
srvctl start scan_listener

lsnrctl start
#########################################################################################################################
##注意事项
#########################################################################################################################

如果启动数据库时遇到无法找到spfile,controlfile等读写权限问题,需要确认$RDBMS_HOME/bin/oracle文件的属主是否是oracle:oinstall,
如果是,则执行如下步骤:

su - root
crsctl stop crs

su - grid
cd $ORACLE_HOME/bin
./setasmgidwrap o=$PATCH_ORACLE_HOME/bin/oracle

grid@CRMTSTDB:[$PATCH_GRID_HOME/bin]ls -l $PATCH_GRID_HOME/bin/oracle
-rwsr-s--x   1 grid       oinstall   222955304 May 11 17:20 $PATCH_GRID_HOME/bin/oracle

oracle@CRMTSTDB:[/home/oracle]ls -l /oracle/app/oracle/11.2.0.4/bin/oracle
-rwsr-s--x   1 oracle     asmadmin   246247856 May 11 17:47 /oracle/app/oracle/11.2.0.4/bin/oracle




                                                参考内容
#########################################################################################################################
##参考下面的步骤在一个节点上安装补丁23727132,数据库完全停止后,可以在两个节点同时安装 gi
#########################################################################################################################

1.为安装该补丁:

su - root
$PATCH_GRID_HOME/crs/install/rootcrs.pl -unlock 

su - grid
cd $PATCH_DIR
unzip p23727132_112040_Generic.zip

cd $PATCH_DIR/23727132
$ORACLE_HOME/OPatch/opatch apply -local

su - root
$PATCH_GRID_HOME/crs/install/rootcrs.pl -patch	

su - grid
$ORACLE_HOME/OPatch/opatch lsinv

#########################################################################################################################
##安装单个补丁参考下面的步骤在一个节点上安装补丁13904435,数据库完全停止后,可以在两个节点同时安装 db
#########################################################################################################################

1.为安装该补丁:

su - root
$PATCH_GRID_HOME/crs/install/rootcrs.pl -unlock 

su - grid
cd $PATCH_DIR
unzip p13904435_112046_HPUX-IA64.zip

cd $PATCH_DIR/13904435
$ORACLE_HOME/OPatch/opatch apply -local

su - oracle
cd $PATCH_DIR/13904435
$ORACLE_HOME/OPatch/opatch apply -local

su - root
$PATCH_GRID_HOME/crs/install/rootcrs.pl -patch	

su - grid
$ORACLE_HOME/OPatch/opatch lsinv

su - oracle
$ORACLE_HOME/OPatch/opatch lsinv


#########################################################################################################################
##安装GI DB补丁分步骤
#########################################################################################################################
***********  Configuration Data  ***********
* It shows only those targets that will be patched in this session *
rac_home=/oracle/app/oracle/11.2.0.4/db_1      owner=oracle      opatch_ver=11.2.0.3.17
*********** Steps to be executed as owner unless specified as root ***********
1: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26392168 -oh /oracle/app/oracle/11.2.0.4/db_1
2: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26609929/custom/server/26609929 -oh /oracle/app/oracle/11.2.0.4/db_1
3: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26392168 -oh /oracle/app/oracle/11.2.0.4/db_1
4: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26609929/custom/server/26609929 -oh /oracle/app/oracle/11.2.0.4/db_1
5: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl stop dbconsole
6: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl stop agent
7: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26392168 -oh /oracle/app/oracle/11.2.0.4/db_1
8: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26609929/custom/server/26609929 -oh /oracle/app/oracle/11.2.0.4/db_1
9: /oracle/app/oracle/11.2.0.4/db_1/bin/srvctl stop home -o /oracle/app/oracle/11.2.0.4/db_1 -s /oracle/app/oracle/11.2.0.4/db_1/srvm/admin/stophome.txt -n plandb01 -f
10: /oracle/software/26636028/26635745/26609929/custom/server/26609929/custom/scripts/prepatch.sh -dbhome /oracle/app/oracle/11.2.0.4/db_1
11: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch napply /oracle/software/26636028/26635745/26392168 -local -silent -ocmrf /tmp/ocm.rsp -oh /oracle/app/oracle/11.2.0.4/db_1 -invPtrLoc /oracle/app/oracle/11.2.0.4/db_1/oraInst.loc
12: /oracle/app/oracle/11.2.0.4/db_1/OPatch/opatch napply /oracle/software/26636028/26635745/26609929/custom/server/26609929 -local -silent -ocmrf /tmp/ocm.rsp -oh /oracle/app/oracle/11.2.0.4/db_1 -invPtrLoc /oracle/app/oracle/11.2.0.4/db_1/oraInst.loc
13: /oracle/software/26636028/26635745/26609929/custom/server/26609929/custom/scripts/postpatch.sh -dbhome /oracle/app/oracle/11.2.0.4/db_1
14: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl start dbconsole
15: /oracle/app/oracle/11.2.0.4/db_1/bin/emctl start agent
16: /oracle/app/oracle/11.2.0.4/db_1/bin/srvctl start home -o /oracle/app/oracle/11.2.0.4/db_1 -s /oracle/app/oracle/11.2.0.4/db_1/srvm/admin/stophome.txt -n plandb01


***********  Configuration Data  ***********
* It shows only those targets that will be patched in this session *
*********** Steps to be executed as owner unless specified as root ***********
1: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26392168 -oh /grid/app/11.2.0.4/grid
2: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/26609929 -oh /grid/app/11.2.0.4/grid
3: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/software/26636028/26635745/22502505 -oh /grid/app/11.2.0.4/grid
4: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26392168 -oh /grid/app/11.2.0.4/grid
5: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/26609929 -oh /grid/app/11.2.0.4/grid
6: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/software/26636028/26635745/22502505 -oh /grid/app/11.2.0.4/grid
7: /grid/app/11.2.0.4/grid/crs/install/rootcrs.pl -unlock : run as root
8: /grid/app/11.2.0.4/grid/tfa/bin/tfactl stop : run as root
9: /sbin/fuser -k /grid/app/11.2.0.4/grid/bin/crsctl.bin : run as root
10: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26392168 -oh /grid/app/11.2.0.4/grid
11: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/26609929 -oh /grid/app/11.2.0.4/grid
12: /grid/app/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/software/26636028/26635745/22502505 -oh /grid/app/11.2.0.4/grid
13: /grid/app/11.2.0.4/grid/OPatch/opatch napply /oracle/software/26636028/26635745/26392168 -local -silent -ocmrf /tmp/ocm.rsp -oh /grid/app/11.2.0.4/grid -invPtrLoc /grid/app/11.2.0.4/grid/oraInst.loc
14: /grid/app/11.2.0.4/grid/OPatch/opatch napply /oracle/software/26636028/26635745/26609929 -local -silent -ocmrf /tmp/ocm.rsp -oh /grid/app/11.2.0.4/grid -invPtrLoc /grid/app/11.2.0.4/grid/oraInst.loc
15: /grid/app/11.2.0.4/grid/OPatch/opatch napply /oracle/software/26636028/26635745/22502505 -local -silent -ocmrf /tmp/ocm.rsp -oh /grid/app/11.2.0.4/grid -invPtrLoc /grid/app/11.2.0.4/grid/oraInst.loc
16: /grid/app/11.2.0.4/grid/bin/emctl start dbconsole
17: /grid/app/11.2.0.4/grid/rdbms/install/rootadd_rdbms.sh : run as root
18: /grid/app/11.2.0.4/grid/crs/install/rootcrs.pl -patch : run as root

新闻名称:11.2.0.4PSU安装操作模版
文章路径:http://dzwzjz.com/article/jjoioh.html
在线咨询
服务热线
服务热线:028-86922220
TOP