顯示具有 Oracle ERP Alert 標籤的文章。 顯示所有文章
顯示具有 Oracle ERP Alert 標籤的文章。 顯示所有文章

Oracle ERP Alert 中, 傳遞 Parameters 到 Concurrent Program


在 Oracle ERP Alert 中,

若 Alert Action 是 Concurrent Program, 且要設定 Concurrent Program 的 Parameter 參數值,

則可以輸入 "參數值1 參數值2 參數值3 ..." (用空白區隔參數)

參數值可以是 "固定數值", 也可以是 "SQL 變數"

如圖:


Oracle ERP Alert 正確執行 SQL Statement 的要點

若是要透過 Alert 執行 SQL Statement,

有以下幾點須注意 :

1) Alert Detail 的 Installations 要輸入資料, 這樣 Alert Action 才會執行.


2) Alert Sets 的 Members 要輸入資料, 這樣 Alert Action 才會執行.


3) SQL Statement 中, 在 "DML、DDL" 之後, "一定不能" 加入 "/", 否則會重複執行.

4) SQL Statement 中, 在 "Begin ... End;" 之後, "一定要" 加入 "/", 且 "該行不能有空白字元", 否則不會執行.


5) SQL Statement 中, 可以有多個 "DML"、"DDL"、"Begin ... End;".

6) SQL Statement 有 2000 字元的限制.

Oracle ERP Alert 錯誤: APP-ALR-04132: Invalid or no mail system specified


這個錯誤訊息, 表示 Alert 沒有指定 or 指定到無作用的 SMTP 發信軟體.

請到 Alert Manager / System / Options 此作業中查看 :

1) 在 Mail Systems 頁籤中, 至少有一個 In Use 勾選.

2) 在 Mail Systems 頁籤中, In Use 的 Command 指令必須可發送 Mail.


Oracle ERP Alert 設定常用的收件者 E-Mail Address (聯絡人群組)


在 Oracle ERP Alert 中, 也有設定 E-Mail 群組的作業,

也就是 "Distribution List" 作業, 如圖 :


在 Oracle ERP Alert 中, 就可以將設定好的群組, 直接拿來使用, 如圖 :


Oracle ERP 的 Event Alert 中, 取得觸發該 Alert 的最後觸發時間


在 Oracle ERP 的 Standard Alert 中,

有一個內定變數 :DATE_LAST_CHECKED,

用來取得觸發此 Event Alert 的時間,

範例, 如圖 :


Oracle ERP 過濾 Alert SQL Statement

在 Oracle ERP 中,

若要過濾 Alert 的 SQL Statement,

找出自己所需要的 Alerts,

可以參考以下語法 :
 程式碼
declare
v_condition_value varchar2(100) := '&Condition';

cursor cur_data is
select ALERT_NAME
, SQL_STATEMENT_TEXT
from ALR_ALERTS;
begin
for rec_data in cur_data loop
if rec_data.SQL_STATEMENT_TEXT like '%'|| v_condition_value ||'%' then
dbms_output.put_line( rec_data.ALERT_NAME );
end if;
end loop;
end;

Oracle ERP 的 Event Alert 取得觸發該 Alert 的 ORG_ID

在 Oracle ERP 的 Standard Alert 中,

有一個內定變數 :ORG_ID,

用來取得觸發此 Event Alert 的 ORG_ID (OU) 或 Organization_ID,

範例, 如圖 :


Oracle ERP 的 Event Alert 只抓取觸發 Alert 的 User Mail Address, 做為 Mail 收件者


Standard Alert 中, 有一個內定變數 :MAILID, 做為觸發此 Alert 的使用者 Mail (來源: FND_USER 的 Mail Address).

你只需將 Mail 收件者設定為 :MAILID 即可, 如下圖:

Oracle ERP 的 Event Alert 只抓取觸發 Alert 的當筆資料

在 Alert 的 Where Clause 中加入一行條件即可, 如下:

<Event Table or View>.ROWID = :ROWID
or
<Event Table or View>.ROW_ID = :ROWID

其中 :ROWID 為 Alert 中的內定值.

而且, :ROWID 不分大小寫, 但 :ROWID 不能有底線, 也就是 :ROWID 不能寫成 :ROW_ID.



Oracle ERP 的 Event Alert 為何一直無法觸發

在 Oracle ERP 中, 若 Event Alert 一直沒有觸發 or 收不到 Mail, 可以按照下面步驟檢查 :

檢查 1: Alert 中的 Application 需有設定在 Alert Manager / System / Installations 中.


檢查 2: 檢查右下角 Alert Details 的 Installations Page 中, Oracle ID 是否有 APPS; 若無, 請設定之.

檢查 3: 檢查右下角 Alert Details 的 Installations Page 中, 是否有設定 Operating Unit; 若無, 請設定之.


檢查 4: 檢查右下角 Action Sets 的 Members Page 中, 是否有指定 Action; 若無, 請設定之.


檢查 5: 是否 Table 真的有 Insert or Update; 可以從 Alert Manager / History 中查看有無 Alert 執行的紀錄.




檢查 6: 若 Alert Manager / History 中查看有 Alert 執行的紀錄, 但卻沒有 Exception 筆數, 則看 SQL 是否正確設定 :rowid.

檢查 7: 若 Alert Manager / History 中查看無 Alert 執行的紀錄, 則看 System Admin / Concurrent / Manager / Administer 的 Alert Event Manager 是否有啟動, 若無, 則 Activate.


檢查 8: 若上述檢查都 OK, 也確定有 Alert 有觸發執行, 卻收不到 Mail, 則看 Alert Manager / System / Options 是否有設定 Mail 程式, 若無, 則設定之.




p.s. 當有 Event Alert 時, 系統會自動在 DBA_TRIGGERS table 中, 增加名為 ALR_<TableName>_IAR or ALR_<TableName>_UAR 的 trigger.

Oracle ERP Alert 如何在同一天多次執行 ?

要讓 Oracle ERP Alert 在一天之內,

同一個 Alert 多次執行,

可以參考以下方式 :

 方式 1: 設定時間區間 (建議用這個)
輸入 Alert 的 End Time (一天之中限定 Alert 執行的最後時間) 後,

Check Interval (時間區間) 欄位便可輸入,

如要半小時執行一次, 便將 Check Interval 設定為 00:30:00 即可.



 方式 2: Copy Alert, 設定不同的執行時間
建立一份 Alert 之後, 複製許多份, 並將每份 Alert 設定為不同的執行時間.








Oracle ERP Standard Alert 改良版 - Graphic Alert


針對 Oracle ERP Alert 設定不夠快速, 功能不足與不美觀的部份, 進行改良, 如下 :

. Alert 發送 HTML Mail, 整齊規則美觀

. Alert HTML Mail 完全不用編排

. Alert HTML Mail 沒有亂碼問題

. Alert HTML Mail 也可有 Excel 附檔

. Alert 可以將 Excel 檔案上傳到 FTP Server

. Alert 會回傳 Excel 檔案名稱, 以利做後續處理

. Alert 可以有多段 Select SQL 語法, 輸出多段結果

. Alert 可以判斷不同條件, 產生不同的結果, 來發送給不同收件者

. 只需設定好資料 (含 Select SQL), 其餘工作交由 DB Package 實現:發送 Email, 產生 Excel, 透過 FTP 傳送檔案到 File Server

. 核心是一個 DB Package, 所以除前端設定作業外, 不限 Oracle ERP, 任何系統皆可搭配使用

Oracle ERP 的 Periodic Alert 為何一直無法觸發

在 Oracle ERP 中,

若 Periodic Alert 一直沒有觸發或收不到 Mail,

可以按照下面步驟檢查 :

1) Alert 中的 Application 欄位資料, 需有設定在 Alert Manager / System / Installations 中.

其實, Alert 的 Application LOV 就是抓取 Installations 中的資料.


2) 檢查右下角 Action Sets 的 Members Page 中, 是否有指定 Action; 若無, 請設定之.


3) 若 Alert Manager / History 中查看有 Alert 執行的紀錄, 但卻沒有 Exception 筆數, 則表示 Select 沒有資料.




4) 若 Alert Manager / History 中查看無 Alert 執行的紀錄, 則看 Alert Manager / Request / Schedule 的 Periodic Alert Scheduler 是否有啟動; 若無, 則 Activate.


5) 若上述已有啟動, 則看 System Admin / Concurrent / Manager / Administer 的 Alert Periodic Manager 是否有啟動; 若無, 則 Activate.


6) 若上述檢查都 OK, 也確定有 Alert 有觸發執行, 卻收不到 Mail, 則看 Alert Manager / System / Options 是否有設定 Mail 程式; 若無, 則設定之 (以 Unix 為例).


取得某段時間執行的 Oracle ERP Alert 有哪些

在 Oracle ERP Alert 中,

若想要知道在某段時間內, 有哪些 Alert 會執行,

可以參考下面的語法 :
 語法
-- 如 AM 6:00 ~ AM 8:00 執行的 Alert
select ALERT_NAME
, ALERT_CONDITION_TYPE "TYPE"
, round( CHECK_START_TIME / 3600, 2 ) "START_TIME (H)"
, round( SECONDS_BETWEEN_CHECKS / 60, 2 ) "BETWEEN (M)"
, round( CHECK_END_TIME / 3600, 2 ) "END_TIME (H)"
from ALR_ALERTS
where ENABLED_FLAG = 'Y'
and (CHECK_START_TIME / 3600) >= 6
and (CHECK_START_TIME / 3600) <= 8
;

取得某個 Mail Address 所在的 Oracle ERP Alert

在 Oracle ERP Alert 中,

若想要知道在哪些 Alert 中,

有設定要發送給某個 Mail Address,

可以參考下面的語法 :
 語法
SELECT AA.ALERT_NAME
, AA.DESCRIPTION
, AAA.ACTION_ID
, AAA.NAME ACTION_NAME
, AAA.SUBJECT
, AAA.TO_RECIPIENTS
, AAA.CC_RECIPIENTS
, AAA.BCC_RECIPIENTS
FROM ALR_ACTIONS AAA
, ALR_ALERTS AA
WHERE 1 = 1
AND AA.APPLICATION_ID = AAA.APPLICATION_ID
AND AA.ALERT_ID = AAA.ALERT_ID
AND ( UPPER( AAA.TO_RECIPIENTS) LIKE UPPER('%&Mail_Address%')
or UPPER( AAA.CC_RECIPIENTS) LIKE UPPER('%&Mail_Address%')
or UPPER( AAA.BCC_RECIPIENTS) LIKE UPPER('%&Mail_Address%') );

Oracle ERP Alert 輸入結果突破 64K 限制

在 Oracle ERP Alert 的 Mail Output 結果, 有 64K 輸出大小的限制,

要突破這個限制, 有以下幾種方式 :


採用 Oracle DB Package 方式

1) 由 Oracle DB Package 根據 Select 語法, 產生 Output 檔案.
2) 由 Oracle DB Package 將 Output 檔案, 發送給相關的人員.

這種方式, 也是目前最常用的方式 : 站長客制的 Graphic Alert.


採用 OS FTP 方式

1) 撰寫一個 FTP 的 OS shell
 程式碼
#!/bin/sh

# ===============================================
# 接收與定義變數
# Created by : Tom 2006.12.15
# ===============================================

USERNAME=$2
PASSWORD=$3
REMOTE_DIR=$4
LOCAL_DIR=$5
LOCAL_FILE=$6
NEW_LOCAL_FILE=$7

# ===============================================
# 判斷資料是否輸入完整
# Created by : Tom 2006.12.15
# ===============================================

if [ "$1" = "" ]; then
echo "please input ftp address"
exit
fi

if [ "$USERNAME" = "" ]; then
echo "please input ftp username"
exit
fi

if [ "$PASSWORD" = "" ]; then
echo "please input ftp password"
exit
fi

if [ "$REMOTE_DIR" = "" ]; then
echo "please input ftp remote directory"
exit
fi

if [ "$LOCAL_DIR" = "" ]; then
echo "please input ftp local directory"
exit
fi

if [ "$LOCAL_FILE" = "" ]; then
echo "please input ftp local file name"
exit
fi

if [ "$NEW_LOCAL_FILE" = "" ]; then
NEW_LOCAL_FILE=$LOCAL_FILE
fi

# ===============================================
# 判斷 Local Directory & File 是否存在
# Created by : Tom 2006.12.19
# ===============================================

if [ ! -e $LOCAL_DIR ]; then
echo "local directory : $LOCAL_DIR is not exist"
exit
fi

if [ ! -e $LOCAL_DIR/$LOCAL_FILE ]; then
echo "local files : $LOCAL_FILE is not exist"
exit
fi

# ===============================================
# 開始 ftp 上傳檔案
# Created By : Tom 2006.12.15
# ===============================================

ftp -n << EOF
open $1
user $USERNAME $PASSWORD
prompt off
cd $REMOTE_DIR
lcd $LOCAL_DIR
put $LOCAL_FILE $NEW_LOCAL_FILE
quit
EOF

2) 撰寫一個 SQL File, 裡面包含 "設定各 Column 標題" 與 "spool 輸出檔案" :


3) SQL File 最後, 執行步驟 1 的 FTP Shell, 如: host $TOM_TOP/shell/myFtp.sh &1 &2 &3 &4 &5 &6 &7

4) 建立一個型態為 "SQL*PLUS" 的 Concurrent Program, 用來執行剛才的 SQL File

5) 在 Alert 中的 Action Type 設定為 "Concurrent Program", 用來執行上步驟的 Concurrent Program.

Oracle ERP Alert 的 Select SQL 是錯的, 但為何在 SQL PLUS 中是正確的

在 Alert 中檢查語法較其他軟體來的嚴謹,

所以若 SQL Plus 中語法 Ok, 但在 Alert 卻有 Error,

可從以下幾點檢查 :

1) 若 Select 之欄位為 Function / 複合式欄位, 則須有別名.

2) 若 Select 中有使用 Mark 備註符號, 則 Mark 會把其以後整行程式碼 Mark 掉, 所以, 不想被 Mark 掉的程式碼, 請移到下一行.

3) 若 Sort 的資料為 Function / 複合式欄位, 則 Sort 不能為別名, 也不能為原欄位名, 須為 Function / 複合式欄位.

Oracle ERP Alert 如何 Copy 複製

在 Oracle ERP 中,

如何將某個 Alert 的所有內容, 複製到另一個 Alert,

可以按以下方式 :

1) 先進入 "Alert Define" 作業, 然後點選 Menu:Tools / Transfer Alert :


2) 選擇來源 Alert, 輸入目的 Alert Name, 按 Transfer 即可 :

Oracle ERP 在某段時間內執行的 Alert - 查詢 SQL 語法

在 Oracle ERP 中, 可利用 ALR_ALERTS, 來取得 "在某段時間內執行的 Alert",

其中, CHECK_START_TIME / SECONDS_BETWEEN_CHECKS / CHECK_END_TIME 的欄位值, 都是以 "秒" 為單位,

語法, 如下 :
 語法: 早上 6 ~ 8 點執行的 Alert
select ALERT_NAME
, ALERT_CONDITION_TYPE "TYPE"
, round( CHECK_START_TIME / 3600, 2 ) "START_TIME (H)"
, round( SECONDS_BETWEEN_CHECKS / 60, 2 ) "BETWEEN (M)"
, round( CHECK_END_TIME / 3600, 2 ) "END_TIME (H)"
from ALR_ALERTS
where ENABLED_FLAG = 'Y'
and (CHECK_START_TIME / 3600) >= 6
and (CHECK_START_TIME / 3600) <= 8;

Oracle ERP - Alert 介紹

本文章投影片介紹 Alert of Oracle ERP 的特性與操作 :

投影片, 目前只限站長瀏覽, Sorry :


投影片內容 :

1.Alert 概觀

2.Alert Manager 環境介紹

3.Define Alert 環境

4.Define Periodic Alert

5.Define Alert - Actions

6.Define Alert - Action Sets

7.Define Alert - Response Sets

8.Check Alert

9.Define Periodic Sets

10.Schedule Alert

11.Alert History

12.Define Alert Options
Related Posts Plugin for WordPress, Blogger...