2013年2月7日 星期四

Oracle DBA - ORA-01591 lock held by in-doubt distributed transaction

ORA-01591

Step 1. Select 'Rollback force '''||local_tran_id||'''' from sys.pending_trans$;
            Find out the local_tran_id.
Step 2. Try to commit or rollback.
            rollback force LOCAL_TRAN_ID;
            or  
            commit force LOCAL_TRAN_ID;
Step 3. If still error . then log in use sys and execute :
set transaction use rollback segment system;
delete from dba_2pc_pending where local_tran_id = LOCAL_TRAN_ID;
delete from pending_sessions$ where local_tran_id = LOCAL_TRAN_ID;
delete from pending_sub_sessions$ where local_tran_id = LOCAL_TRAN_ID;
commit;
rollback force LOCAL_TRAN_ID;  

2013年2月4日 星期一

Oracle ERP R12. CST_INVALID_WIP (The wip entity is either not defined or does not have a period balance entry.) - Discrete Job

Cause :

Records not found in WIP_PERIOD_BALANCES
(該工單於WIP_PERIOD_BALANCES裡,少了該交易期間的資料)


Solution :

I. Normally, when there are records in MTL_MATERIAL_TRANSACTIONS with the Costed_Flag = 'E' you would resubmit these records by doing the following :
  (一般而言,若MMT裡有發現COSTED_FLAG=E時,正常異常排除的步驟如下)
  a. Backup the rows to be updated. (將資料備份下來)
  b. Turn off the Cost Manager. (先暫停Cost Manager,以避免干擾接下來要執行的步驟)
  c. Run the SQL statement: (執行以下SQL)
     UPDATE MTL_MATERIAL_TRANSACTIONS
        SET costed_flag          = 'N',
            error_code           = NULL,
            error_explanation    = NULL,
            transaction_group_id = NULL
      WHERE organization_id =
        and transaction_source_id =
        and costed_flag IS NOT NULL;

II. When this does not work, it is usually due to one or more of the following three conditions.
    (若異常狀況仍存在,則可以是以下原因造成) 

   * Item costs are not defined for Frozen cost type in CST_ITEM_COSTS.
  (CST_ITEM_COSTS沒有該品號的Frozen cost)
     ==> 請補建Item Cost 並Copy cost至Forezen cost
     
   * WIP_PERIOD_BALANCES is missing rows for the acct_period_id.
   (該工單於WIP_PERIOD_BALANCES缺少該期間的餘額資料)
     ==> 請於WIP_PERIOD_BALANCES補該筆工單該Period的資料
     
    NOTE:  THIS DOES NOT APPLY TO CLOSED DISCRETE JOBS WDJ.STATUS_TYPE = 12
    (注意 : 該動作不適用於Closed的工單)