2012年10月24日 星期三

Rolling Patch - OPatch Support for RAC [ID 244241.1]


Rolling Patch - OPatch Support for RAC [ID 244241.1]

Applies to:

Oracle Server - Enterprise Edition - Version: 9.0.1.0 to 11.2.0.2 - Release: 9.0.1 to 11.2
Oracle Server - Standard Edition - Version: 9.0.1.0 to 11.2.0.2   [Release: 9.0.1 to 11.2]
Information in this document applies to any platform.

Purpose

This note is to describe the current support of OPatch for Real Application Clusters. Before reading opatch RAC Support, you should be familiar with single-instance OPatch processing.

For more information about OPatch, please refer to Note 189489.1 - Oracle Data Server Interim Patch Installation (OPatch)

For more information about Oracle Clusterware (CRS) Rolling Upgrades, please refer to <note 338706.1>

Scope and Application

This document is intended for DBAs, System Administrators and Oracle Support Engineers that are going to apply Oracle Interim Patches on RAC environment.

Rolling Patch - OPatch Support for RAC


1 - RAC Patching methods
     patch的方式

OPatch supports 3 different patch methods on a RAC environment:

Patching RAC as a single instance (All-Node Patch)
In this mode, OPatch applies the patch to the local node first, then propagates the patch to all other nodes, and finally updates the inventory. All instances will be down during the whole patching process.
Patching RAC using a minimum down-time strategy (Min. Downtime Patch)
In this mode, OPatch patches the local node, asks users for a sub-set of nodes, which will be the first nodes to be patched. After the initial subset of nodes are patched, Opatch propagates the patch to the other nodes and finally updates the inventory. The downtime would happen between the shutdown of the the second subset of nodes and the startup of the initial subset of nodes patched.
Patching RAC using a rolling strategy - No down time (Rolling Patch)
With this method, there is no downtime. Each node would be patched and brought up while all the other nodes are up and running, resulting in no disruption of the system.

A rolling patch does not always no downtime as some patches require post-installation steps, i.e. running sql scripts to patch the actual database. Please refer to patch readme to find out whether post-installation steps requires downtime.


2 - Flow diagrams
     流程說明

All-Node Patch
. Shutdown all Oracle instances on all nodes
. Apply the patch to the RAC home on all nodes
. Bring all instances up
Minimum downtime
. Shutdown the Oracle instance on node 1
. Apply the patch to the RAC home on node 1
. Shutdown the Oracle instance on node 2
. Apply the patch to the RAC home on node 2
. Shutdown the Oracle instance on node 3
. At this point, instances on nodes 1 and 2 can be brought up
. Apply the patch to the RAC home on node 3
. Startup the Oracle instance on node 3
Rolling patch (no downtime)
. Shutdown the Oracle instance on node 1
. Apply the patch to the RAC home on node 1
. Start the Oracle instance on node 1
. Shutdown the Oracle instance on node 2
. Apply the patch to the RAC home on node 2
. Start the Oracle instance on node 2
. Shutdown the Oracle instance on node 3
. Apply the patch to the RAC home on node 3
. Start the Oracle instance on node 3

3 - How does OPatch select which method to use?
     選擇何種patch方式?

To be eligible to be applied on as a rolling patch, the patch need to meet certain criteria, which are determined by Oracle developers. To be applied on a "rolling fashion", the patch must be designated as a "rolling updatable patch" or simply "rolling patch".

The algorithm used to decide which method is going to be used is the following:

       If (users specify minimize_downtime)
              patching mechanism = Min. Downtime
       else if (patch is a rolling patch)
              patching mechanism = Rolling
            else
                  patching mechanism = All-Node  


4 - Availability of rolling patches
      Rolling patch的可用性

As patches are released they will qualified and identified as a "rolling" or "not rolling patch". While most patches can be applied in a rolling fashion some patches can not be applied in this fashion. Patches that could potentially be installed on rolling fashion include:

   . Patches that do not affect the contents of the database.
   . Patches not related to the RAC internode communication infrastructure.
   . Patches that change procedural logic and do not modify common header definitions of kernel modules. This includes client side patches that only affect utilities like export, import, sql*plus, sql*loader, etc.

Only individual patches -- not patch sets -- will be “rollable”. It should also be noted that a merge patch of a “rolling patch” and an ordinary patch will not be a “rolling patch”.

From 9.2.0.4 on, all patches released will be marked as a "rolling" or "not rolling patch", based on defined set of rules. Patches previously released are packaged as "not rolling".

Because the set of rules currently defined are very conservative, patches released as "not rolling patches", either before and after 9.2.0.4, may be eligible to be re-released as "rolling patches", after analysis from Oracle Development.

If you plan to apply a patch that is marked as "not rolling" and want to check if is possible to take advantage of the rolling patch strategy, please contact Oracle Support.



5 - How to determine if a patch is a "rolling patch" or not? 
     如何得知是否是 rolling patch?

As database user execute the following:

    - 9i or 10gR1: opatch query -is_rolling

    - 10gR2: opatch query -all  [unzipped patch location] | grep rolling

    - 10gR2 on Windows: opatch query -all [unzipped patch location] | findstr rolling

    - Later 10gR2 or 11g: opatch query -is_rolling_patch [unzipped patch location]

The command may not work if unzipped patch location has more than one patch sub-directory, example output while checking CPU patches:

Failed to load the patch object.  Possible causes are:
  The specified path is not an interim Patch shiphome
  Meta-data files are missing from the patch area
  Patch location = /home/oracle/stage/8836308
  Details = Input metadata files are missing.

Patch Location "/home/oracle/stage/8836308" doesn't point to a valid patch area.

OPatch failed with error code 75

Please refer to patch readme to find out whether the patch is rolling patch or not.



6 - Current Limitations 
     限制

. Patching with Shared File System

Currently OPatch treats Shared File System, like CFS, as a single-instance patch.  It means that OPatch will blindly patch files under a given ORACLE_HOME knowing that other nodes will pick up the changes via the Shared File System. Unfortunately, this means that OPatch cannot take advantage of a rolling patch on a Shared File System environment; all nodes must be down throughout the patching process.


. Patching one node at time

The Opatch strategies discussed above (All-Node, Min. Down-Time, and Rolling) presumes that all nodes will be patched at the same time. Additionally, each node can be patched individually, at different times, using the "-local" key word, which will patch only the local node.

也可以參考 http://www.cnblogs.com/wenjiewang/archive/2012/10/23/2735681.html

2012年10月7日 星期日

Windows 指令大全 (XP)

windows 指令大全《XP》
指令:【gpedit.msc】群組原則
指令:【sndrec32】錄音機
指令:【Nslookup】IP位址偵測器
指令:【explorer】開啟檔案總管
指令:【logoff】登出指令 tsshutdn 60秒倒計時關機指令
指令:【lusrmgr.msc】本地機用戶和組
指令:【services.msc】本機服務設定
指令:【oobe/msoobe /a】檢查XP是否啟動
指令:【notepad】開啟記事本
指令:【cleanmgr】磁碟垃圾整理
指令:【net start messenger】開始信使服務
指令:【compmgmt.msc】電腦管理
指令:【net stop messenger】停止信使服務
指令:【conf】啟動
指令:【netmeetingdvdplay】DVD播放器charmap】啟動字元對應表
指令:【diskmgmt.msc】磁牒管理實用程序
指令:【calc】啟動電子計算器
指令:【dfrg.msc】磁碟重組工具
指令:【chkdsk.exe】Chkdsk磁牒檢查
指令:【devmgmt.msc】裝置管理員
指令:【drwtsn32】系統醫生
指令:【rononce -p】15秒關機
指令:【dxdiag】檢查DirectX資訊
指令:【regedt32】註冊表編輯器
指令:【Msconfig.exe】系統配置實用程序
指令:【rsop.msc】群組原則結果集
指令:【mem.exe】顯示記憶體使用情況
指令:【regedit.exe】註冊表
指令:【winchat】XP自帶區域網路聊天
指令:【progman】程序管理器
指令:【winmsd】系統資訊
指令:【 perfmon.msc】電腦效能監測程序
指令:【winver】檢查Windows版本
指令:【sfc /scannow】掃瞄錯誤並復原
指令:【taskmgr】工作管理器(2000/xp/-2003)
指令:【eventvwr.msc】事件檢視器
指令:【secpol.msc】本機安全性設定
指令:【rsop.msc】原則的結果集
指令:【ntbackup】啟動制作備份還原嚮導
指令:【mstsc】遠端桌面
指令:【wmimgmt.msc】開啟windows管理體系結構WMI)
指令:【wupdmgr】windows更新程序
指令:【wscript】windows指令碼宿主設定
指令:【write】寫字板
指令:【wiaacmgr】掃瞄儀和照相機嚮導
指令:【winchat】XP原有的區域網路聊天
指令:【mplayer2】簡易
指令:【widnows media player mspaint】畫圖板
指令:【mstsc】遠端桌面連接
指令:【mplayer2】媒體播放機
指令:【magnify】放大鏡實用程序
指令:【mmc】開啟控制台
指令:【mobsync】同步指令
指令:【dfrg.msc】磁碟重組程式
指令:【dcomcnfg】開啟系統元件服務
指令:【ddeshare】開啟DDE共享設定
指令:【dvdplay】DVD播放器
指令:【nslookup】網路管理的工具嚮導
指令:【ntbackup】系統制作備份和還原
指令:【narrator】螢幕「講述人」
指令:【ntmsmgr.msc】移動存儲管理器
指令:【ntmsoprq.msc】移動存儲管理員操作請求
指令:【netstat -an】(TC)指令檢查連接
指令:【syncapp】新增一個公文包
指令:【sysedit】系統配置編輯器
指令:【sigverif】文件簽名驗證程序
指令:【shrpubw】新增共用資料夾
指令:【secpol.msc】本機安全原則
指令:【syskey】系統加密,一旦加密就不能解開,保護windows xp系統的雙重密碼
指令:【Sndvol32】音量控制程序
指令:【sfc.exe】系統檔案檢查器
指令:【sfc /scannow】windows文件保護
指令:【tourstart】xp簡介(安裝完成後出現的漫遊xp程序)
指令:【taskmgr】工作管理器
指令:【eventvwr】事件檢視器
指令:【eudcedit】造字程序
指令:【explorer】開啟檔案總管
指令:【packager】對像包裝程序
指令:【regsvr32 /u *.dll】停止dll文件執行
指令:【regsvr32 /u zipfldr.dll】取消ZIP支持
指令:【cmd.exe】CMD命令提示字元
指令:【chkdsk.exe】Chkdsk磁牒檢查
指令:【certmgr.msc】證書管理實用程序
指令:【calc】啟動計算器
指令:【cliconfg】SQL SERVER 客戶端網路實用程序
指令:【Clipbrd】剪貼板檢視器
指令:【netmeeting compmgmt.msc】電腦管理
指令:【ciadv.msc】索引服務程序
指令:【osk】開啟螢幕小鍵盤
指令:【odbcad32】ODBC資料來源管理器
指令:【iexpress】木馬元件服務工具,系統原有的
指令:【fsmgmt.msc】共用資料夾管理器
指令:【utilman】協助工具管理器
指令:【Clipbrd】剪貼板檢視器
指令:【packager】對像包裝程序
指令:【sfc /scannow】windows文件保護

============================================================

開機→執行→命令(命令集錦,豐富你的知識)

【winver】檢查Windows版本
【wmimgmt.msc】打開windows管理體系架構(WMI)
【wupdmgr】windows更新程式
【wscript】windows腳本宿主設置
【write】寫字板
【winmsd】系統訊息
【wiaacmgr】掃描儀和照相機向導
【winchat】XP自帶局域網聊天
【mem.exe】顯示內存使用情況
【Msconfig.exe】系統配置實用程式
【mplayer2】簡易widnows media player
【mspaint】畫圖板
【mplayer2】媒體播放機
【magnify】放大鏡實用程式
【mmc】打開控制台
【dxdiag】檢查DirectX訊息
【drwtsn32】系統醫生
【devmgmt.msc】 設備管理器
【dfrg.msc】磁片碎片整理程式
【diskmgmt.msc】磁片管理實用程式
【dcomcnfg】打開系統組件服務
【ddeshare】打開DDE共享設置
【dvdplay】DVD播放器
【net stop messenger】停止信使服務
【net start messenger】開始信使服務
【notepad】打開記事本
【nslookup】網路管理的工具向導
【ntbackup】系統備份和還原
【narrator】螢幕“講述人”
【ntmsmgr.msc】移動存儲管理器
【ntmsoprq.msc】移動存儲管理員*(糙)*作請求
【netstat -an】(TC)命令檢查界面
【syncapp】創建一個公文包
【sysedit】系統配置編輯器
【sigverif】文件簽名驗証程式
【sndrec32】錄音機
【shrpubw】創建共享文件夾
【secpol.msc】本地安全策略
【syskey】系統加密,一旦加密就不能解開,保護windows xp系統的雙重密碼
【services.msc】本地服務設置
【Sndvol32】音量控制程式
【sfc.exe】系統文件檢查器
【sfc /scannow】windows文件保護
【tsshutdn】60秒倒計時關機命令
【tourstart】xp簡介(安裝完成后出現的漫遊xp程式)
【taskmgr】任務管理器
【eventvwr】事件查看器
【eudcedit】造字程式
【explorer】打開資源管理器
【packager】對象包裝程式
【perfmon.msc】計算機性能監測程式
【progman】程式管理器
【regedit.exe】註冊表
【rsop.msc】組策略結果集
【regedt32】註冊表編輯器
【rononce -p】15秒關機
【regsvr32 /u *.dll】停止dll文件營運
【regsvr32 /u zipfldr.dll】取消ZIP支持
【cmd.exe】CMD命令提示符
【chkdsk.exe】Chkdsk磁片檢查
【certmgr.msc】證書管理實用程式
【calc】啟動電算機
【charmap】啟動字符映射表
【cliconfg】SQL SERVER 客戶端網路實用程式
【Clipbrd】剪貼板查看器
【conf】啟動netmeeting
【compmgmt.msc】計算機管理
【cleanmgr】垃圾整理
【ciadv.msc】索引服務程式
【osk】打開螢幕鍵盤
【odbcad32】ODBC數據源管理器
【oobe/msoobe /a】檢查XP是否激活
【lusrmgr.msc】本機用戶和組
【logoff】註銷命令
【fsmgmt.msc】共享文件夾管理器
【utilman】輔助工具管理器
【gpedit.msc】組策略

資料來源:
http://vmixclub.pixnet.net/blog/post/2266937-windows-%E6%8C%87%E4%BB%A4%E5%A4%A7%E5%85%A8%E3%80%8Axp%E3%80%8B

2012年10月1日 星期一

Can't find oracle_process_id in fnd_concurrent_requests with Oracle ERP 11.5.10.2 report

打開 Report Builder
1. Data Model => User Parameters => 定義 P_CONC_REQUEST_ID


Data Model => User Parameters => 定義 P_REQUEST_ID

2. Report => Report Triggers => Before Report
     SQL_TRACE;


Report => Report Triggers => After Report
     SRW.USER_EXIT('FND SRWEXIT');

3. Program Units => 定義 SQL_TRACE

PROCEDURE SQL_TRACE IS

   CURSOR c_program_id(p_request_id IN NUMBER) IS
  SELECT concurrent_program_id, nvl(enable_trace,'N')
  FROM apps.FND_CONCURRENT_REQUESTS
  WHERE REQUEST_ID = p_request_id;

  CURSOR get_audsid IS -- RC kpvs
  SELECT a.sid, a.serial#, b.spid FROM gv$session a,gv$process b
  WHERE audsid = userenv('SESSIONID')
  AND a.paddr = b.addr
  and a.inst_id= b.inst_id;


  CURSOR get_dbname IS
  SELECT name FROM gv$database;

  v_enable_trace apps.FND_CONCURRENT_PROGRAMS.enable_trace%TYPE;
  v_program_id apps.FND_CONCURRENT_PROGRAMS.concurrent_program_id%TYPE;
  v_sid gv$session.sid%TYPE;
  v_serial gv$session.serial#%TYPE;
  v_spid gv$process.spid%TYPE;
  v_name gv$database.name%TYPE;

BEGIN
 SRW.USER_EXIT('FND SRWINIT');
    SRW.MESSAGE( 1275, 'Report Version -> 616.4, LastUpdateDate -> 06/11/2003');

    OPEN c_program_id(:p_conc_request_id);
    FETCH c_program_id INTO v_program_id, v_enable_trace;
    CLOSE c_program_id;

    SRW.message( 1275, 'v_program_id -> '||v_program_id
    ||', v_enable_trace -> '||v_enable_trace
    ||', request_id -> '||:P_CONC_REQUEST_ID);

    IF v_enable_trace = 'Y' THEN

      OPEN get_audsid; -- RC kpvs
      FETCH get_audsid INTO v_sid, v_serial, v_spid;
      CLOSE get_audsid;

      OPEN get_dbname;
      FETCH get_dbname INTO v_name;
      CLOSE get_dbname;

      srw.message(1275,'TraceFile Name = '||lower(v_name)||'_ora_'||v_spid||'.trc');
      SRW.DO_SQL('ALTER SESSION SET EVENTS ''10046 trace name context forever, level 4''' );
    END IF;
EXCEPTION
  WHEN OTHERS THEN
    SRW.MESSAGE( 1275, 'Error during enabling the trace. ErrCode -> '||SQLCODE ||', ErrMesg -> '||SQLERRM );
END;

補充:
在Oracle論壇上有人是這麼做的:

1. before report trigger
add SRW.USER_EXIT('FND SRWINIT');
2. after report trigger
and SRW.USER_EXIT('FND SRWEXIT');
3. add a parameter P_CONC_REQUEST_ID in User PARAMETERS