R12 AR Transaction SQL script

Hi guys,
In R12
Could someone please help me with sql script that I could use to find out what Receivables Transactions/Invoices that was raised with TAX EXEMPT.
Thanks in advance.
Tim

The query you are looking for....
select trx_number as "Invoice Number"
from RA_CUSTOMER_TRX_ALL
where DEFAULT_TAX_EXEMPT_FLAG = 'Y'
Thanks
Pradeep

Similar Messages

  • Patch 5726010 adcrtbsp.sql script during up-grade to R12

    Dear All,
    Oracle EBS 11.5.9 with Windows 2003
    as a R-12 upgrade process i have downloaded patch 5726010 and executed @adgncons.sql apps apps scripts.
    its created adcrtbsp.sql for creation of consolidated tablespace model and increases tablespaces which are below in minimum size.
    adcrtbsp.sql script is like
    CREATE TABLESPACE
    APPS_TS_TX_DATA
    DATAFILE '?/dbf/transaction_table.dbf'
    SIZE 1000 M REUSE
    EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128 K
    SEGMENT SPACE MANAGEMENT AUTO ;
    ALTER TABLESPACE
    APPS_TS_TX_DATA
    add DATAFILE
    *'?/dbf/transaction_table_2.dbf'*
    SIZE 1000 M;
    My current table spaces paths are.
    e:\oracle\proddata\datafile_name
    My question is how i pass paths in above script adcrtbsp.sql for
    DATAFILE '?/dbf/transaction_table.dbf'
    Please advise, i have confusion.
    Regards,

    You need to manually edit the SQL file with the path of your datafiles.
    **Added**
    Okay, something like this
    DATAFILE 'e:\oracle\proddata\transaction_table.dbf'Edited by: Bobcatalog on Jan 28, 2009 3:13 PM

  • "ORA-1722 Invalid number" error while runing a SQL script in SQL*Plus

    Hello,
    I created a SQL script that is intended to populate tables with
    baseline data. When I run the script in the SQL*Plus program
    that comes with the Oracle 8.1.6 (client), I receive an "ORA-
    1722 Invalid number".
    The error always occurs when SQL*Plus tries to execute the
    following SQL statement:
    insert into components(db_ind,module_id,ext_compid,active) values
    ('cm',modules_seq.currval,1046682,'y');
    The datatypes for the columns on the components table are as
    follows:
    db_ind varchar2(2);
    module_id number;
    ext_compid number;
    active varchar2(1);
    It seems that for some reason Oracle is having trouble
    recognizing 1046682 as a number.
    I also tried the following INSERT statements to see if that
    would work:
    insert into components(db_ind,module_id,ext_compid,active) values
    ('cm',modules_seq.currval,to_number('1046682'),'y');
    insert into components(db_ind,module_id,ext_compid,active) values
    ('cm',modules_seq.currval,'1046682','y');
    but I still receive the same error message
    Is there some NLS setting(s) I need to modify so that Oracle
    does not give me this error? Does anyone know the answer to
    this problem?
    Your help is greatly appreciated.
    Oscar
    (NOTE: I also receive this same error when trying run the
    script in SQL Navigator and Toad programs)

    Please see the following docs.
    R12: JBO-27122 Error Message Clicking On Supplier Accounting Link With Unexpected Error [ID 1218903.1]
    Supplier Management Accounting Link Gives Unexpected Error and JBO-27122 at SELECT * FROM (select pvsa.ADDRESS_STYLE [ID 1340655.1]
    Adding Accounting Information or Operating Unit Information fails with APP-FND-1564: ORACLE error 1722 in FDFGVD [ID 364265.1]
    Thanks,
    Hussein

  • Buckup SQL Script doesn't work

    Hi  all,
    In ECC i want schedule ASE jobs to  dump transaction logs,i do it fellow the note 1588316 step by step .  In  schedule jobs my sql script doesn't work,but it works in sql command line.
    sql script :
    dump transaction DEV using config= 'DEVLOG'
    Anybody can give me some advise to face this issue?  Thanks in advance.
    David Lv

    Hi  all,
    My problem sloved, it's JSagent problem.
    sp_dumptrans not working at dbacockpit @Alcino Melo
    use sybmgmtdb
    go
    sp_js_wakeup "start_js",1
    go
    after start  JSagent  my sql script can run 
    Thanks  all
    David Lv

  • SQL scripts for Data Warehouse support team

    Hi, I would like to have the SQL scripts that must be there with a person supporting a data warehousing system... like on locks, sessions, how much progress a transaction/SQL has made, resources being consumed.

    There are various scripts available on the net. For example http://www.oracle-base.com/dba/DBACategories.php

  • IF statement syntax in SQL script view

    I need to include a "IF" condition in the "SELECT" section of my SQL script view.
    I tried the following syntax's but I get the error 'Incorrect SQL syntax near 'IF'
    1.  IF(Revenue <> '0' AND Quantity <> '0', Revenue/Quantity, '0') AS Gross Price
    2.  IF(Revenue != '0' AND Quantity != '0', Revenue/Quantity, '0') AS Gross Price
    3.  IF(Revenue <> '0' AND Quantity <> '0' THEN Revenue/Quantity ELSE  '0' END) AS Gross Price
    4.  IF(Revenue != '0' AND Quantity != '0' THEN Revenue/Quantity ELSE  '0' END) AS Gross Price
    My final SQL would read like follows:
    SELECT field1, field2, IF(......) AS field3
    FROM table1
    Can anybody please help with the correct IF statement syntax to be used in the SQL script based view?

    Hi Lakshmi,
    below is the syntax for IF statement.
    IF <bool_expr1> THEN
    <then_stmts1>
    ELSEIF <bool_expr2>
    THEN <then_stmts2>
    [ELSE <else_stmts3>]
    END IF
    eg :
    BEGIN
    DECLARE found INT := 1;
    SELECT count(*) INTO found FROM books WHERE isbn = :v_isbn;
    IF :found = 0 THEN
    INSERT INTO books VALUES (:v_isbn, 'In-Memory Data Management', 1, 1, '2011', 42.75, 'EUR');
    ELSE
    UPDATE books SET price = 42.75 WHERE isbn =:v_isbn;
    END IF;
    END;
    Sreehari

  • IF Condition in a PL/SQL Script give a report error.

    Hello, I’m German and I hope you can unterstand my Question.
    First, I work with the HTML DB Version 1.6.0.0.0.87 and the Oracle Version 9.2.0.6.
    I create a SQL Report, where a PL/SQL Script return the SQL Statement for the Report. This is my source-code, I have short it...:
    Declare
    sql_str varchar(2000);
    sql_str_select varchar(1000) :=' select dim_sparte …... ';
    sql_str_from varchar(1000) := ' from faktentabelle,dim_sparte ';
    sql_str_where varchar(1000):= ' where … and faktentabelle.zeit_id = :POPUP_ZEIT ';
    sql_str_groupby varchar(1000):= ' group by dim_sparte.name, faktentabelle.zeit_id ';
    Begin
    If ( (V('POPUP_NETZGEBIET') is not NULL) and (V('POPUP_NETZGEBIET') <>
    'Alle Netzgebiete')) THEN
    sql_str_select := sql_str_select || ' ,dim_organisationseinheit.netzgebiet_name ';
    sql_str_from := sql_str_from || ' , dim_organisationseinheit ';
    sql_str_where := sql_str_where || ' and faktentabelle ... and
    dim_organisationseinheit.netzgebiet_name = :POPUP_NETZGEBIET';
    sql_str_groupby := sql_str_groupby || ' , dim_orga .... ';
    End IF;
    sql_str:= sql_str_select || sql_str_from || sql_str_where || sql_str_groupby;
    htp.print(sql_str);
    Return sql_str;
    End;
    This Script include a IF-THEN condition. The Condition is true and the sql-String-Variables are updatet.
    I can get the string with htp.print() and the Statement is OK.
    The report get a Error “report error: ORA-1403: no data found”. If I copy the printet sql String in a new Report Region with SQL String, the Report is OK. When I write IF(true) instead of IF( Condition) the Report is OK, too.
    I try ist with Varibalen V(‘name‘) and with :name. It’s always the same problem. I can’t use IF-THEN-Else Conditions in a Script.
    Please help me and say me what is the problem???
    Thanks,
    Simona

    Hi Simona,
    In the sql region below the region source see that you have " Use Generic Column Names (parse query at runtime only)" check and not " Use Query-Specific Column Names and Validate Query".
    This error you usually get when you have a mismatch in your report heading.
    Vivek
    [email protected]

  • Pl/sql script needed - Urgent

    Hi All,
    I have one problem. I have to populate a table having rows more than 500000000 $ through PL/SQL.
    For getting the idea...I have created one dummy table " T1 " with column " X " having 9 rows and
    values in source are -
    row 1 = 10
    row 5 = 20
    row 8 = 30
    Other rows(2, 3, 4, 6, 7, 9) are null.
    I want to carry fwd the values so the values in the same table will come like -
    row 1, 2, 3, 4 = 10
    row 5, 6 ,7 = 20
    row 8,9 = 30
    For resolving the problem i have written a procedure :
    DECLARE
    CURSOR cur_adb IS SELECT * FROM t1 ;
    var cur_adb%rowtype ;
    var1 number(10) ;
    BEGIN
    OPEN cur_adb ;
    LOOP
    FETCH cur_adb INTO var ;
    DBMS_OUTPUT.PUT_LINE ( 'x=') ;
    EXIT WHEN cur_adb%ROWCOUNT > 10 ;
    If var is not null
    then update t1
    set x = var ;
    var1 := VAR;
    else update t1
    set x = var1 ;
    exit;
    end if;
    END LOOP;
    CLOSE cur_adb ;
    END ;
    But it is giving me wrong result as it is fetching more rows at a time.
    Pls. send me the correct Pl/SQL script as soon as possible.
    Note: You can directaly send the procedure to [email protected] .
    Thanks & Regs,
    Ashish

    Hello,
    I got the solution by adding on more column in the source table :
    source table : T1 -> x x_id
    10 1
    2
    3
    4
    20 5
    6
    7
    30 8
    9
    The procedure is :
    SQL> DECLARE
    2 CURSOR cur_adb IS SELECT x, x_id FROM t1 ;
    3 var number(10) ;
    4 var1 number(10) ;
    5 var2 number(10) ;
    6 BEGIN
    7 OPEN cur_adb ;
    8 LOOP
    9 FETCH cur_adb INTO var , var2 ;
    10 If var is not null
    11 then var1 := VAR;
    12 elsif var is null
    13 then update t1
    14 set x = var1
    15 where x_id = var2;
    16 end if;
    17 DBMS_OUTPUT.PUT_LINE ('The value of x=' || var) ;
    18 Exit when cur_adb%ROWCOUNT > 9 or cur_adb%NOTFOUND ;
    19 END LOOP;
    20 CLOSE cur_adb ;
    21 END ;
    22 /
    The value of x=10
    The value of x=10
    The value of x=10
    The value of x=10
    The value of x=20
    The value of x=20
    The value of x=20
    The value of x=30
    The value of x=30
    The value of x=30
    PL/SQL procedure successfully completed.
    Thanks everyone for helping me........
    Regards,
    Ashish

  • Can't Upload SQL scripts or application scripts in APEX 3.1

    I have installed APEX 3.1 on an Oracle 10g database.
    I can log in to APEX, create applications, and run applications.
    One application I import is the sample OEHR application which imports correctly at the hosted site.
    However, when I try to upload an SQL script or import the sample application I get
    "Page not Found" for this page http://csora:7777/pls/apex/wwv_flow.accept
    I've included my dads.conf below and also some Apache error entries
    Alias /i/ "e:\oracle\product\10.1.0\Db\Apache\Apache\images/"
    AddType text/xml     xbl
    AddType text/x-component     htc
    <Location /pls/apex>
    Order deny,allow
    PlsqlDocumentPath docs
    AllowOverride None
    PlsqlDocumentProcedure      wwv_flow_file_mgr.process_download
    PlsqlDatabaseConnectString     csora:1521:ORCL ServiceNameFormat
    PlsqlNLSLanguage          AMERICAN_AMERICA.AL32UTF8
    PlsqlAuthenticationMode     Basic
    SetHandler          pls_handler
    PlsqlDocumentTablename     wwv_flow_file_object$
    PlsqlDatabaseUsername     APEX_PUBLIC_USER
    plsqlDefaultPage          apex     
    PlsqlDatabasePassword     hocking
    Allow from all
    </Location>
    I:[Mon Apr 14 15:52:35 2008] [error] [client 10.116.101.158] [ecid: 1208202755:198.30.4.195:2696:2864:2873,0] File does not exist: e:/oracle/product/10.1.0/db/apache/apache/htdocs/pls/htmldb/builder/topnav2.gif
    [Mon Apr 14 15:52:35 2008] [error] [client 10.116.101.158] [ecid: 1208202755:198.30.4.195:2696:2924:2771,0] File does not exist: e:/oracle/product/10.1.0/db/apache/apache/htdocs/pls/htmldb/builder/left_curve.gif
    [Mon Apr 14 15:52:35 2008] [error] [client 10.116.101.158] [ecid: 1208202755:198.30.4.195:2696:2944:2767,0] File does not exist: e:/oracle/product/10.1.0/db/apache/apache/htdocs/pls/htmldb/builder/left_curve.gif
    [Mon Apr 14 15:52:35 2008] [error] [client 10.116.101.158] [ecid: 1208202755:198.30.4.195:2696:2972:2750,0] File does not exist: e:/oracle/product/10.1.0/db/apache/apache/htdocs/pls/htmldb/builder/right_curve.gif
    [Mon Apr 14 15:52:35 2008] [error] [client 10.116.101.158] [ecid: 1208202755:198.30.4.195:2696:2940:2762,0] File does not exist: e:/oracle/product/10.1.0/db/apache/apache/htdocs/pls/htmldb/builder/right_curve.gif
    [Mon Apr 14 16:19:33 2008] [error] [client 10.116.101.158] [ecid: 1208204373:198.30.4.195:2696:2924:2773,0] File does not exist: e:/oracle/product/10.1.0/db/apache/apache/htdocs/pls/htmldb/builder/topnav2.gif
    [Mon Apr 14 16:21:48 2008] [error] [client 10.116.101.158] [ecid: 1208204507:198.30.4.195:2696:2948:2801,0] mod_plsql: /pls/apex/wwv_flow.accept HTTP-404 ORA-00942: table or view does not exist
    [Mon Apr 14 16:23:29 2008] [error] [client 10.116.101.158] [ecid: 1208204609:198.30.4.195:2696:2788:2760,0] mod_plsql: /pls/apex/wwv_flow.accept HTTP-404 ORA-00942: table or view does not exist
    [Mon Apr 14 16:23:29 2008] [error] [client 10.116.101.158] [ecid: 1208204609:198.30.4.195:2696:2788:2761,0] mod_wchandshake: incorrect uri: name="p_t04" passed in.
    [Mon Apr 14 16:23:29 2008] [error] [client 10.116.101.158] [ecid: 1208204609:198.30.4.195:2696:2788:2761,0] Invalid URI in request -data; name="p_t04"
    Am I missing some files or directories from the 3.1 install? Any help would be appreciated since I think I'm close to having APEX fully functional.

    Val,
    In this line:
    PlsqlDocumentTablename wwv_flow_file_object$
    ...that needs to be wwv_flow_file_objects$
    Scott

  • How to test a simple PL SQL function from another PL SQL script

    Hi,
    I have created a function. Now i need to test that whether it is returning the correct values or not.
    For that, i have written anothe pl sql script and trying to call this function. Im passing all the IN parameters in that function. I assume here that OUT parameters will provide me the result. Im trying to display the OUT parameter one by one to see my result.
    I'm using toad as sql client here connected with oracle.
    pl sql script:-
    DECLARE
    BEGIN
         DBMS_OUTPUT.PUT_LINE('$$$$$$$ VINOD KUMAR NAIR $$$$$$$');
         FETCH_ORDER_PRODUCT_DATA(320171302, 1006, 6999,
    ODNumber OUT VARCHAR2, Line_Number OUT VARCHAR2,
    ServiceID OUT VARCHAR2, BilltoNumber OUT VARCHAR2,
    AnnualPrice OUT NUMBER, CoverageCode OUT VARCHAR2)
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ODNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | Line_Number );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ServiceID );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | BilltoNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | AnnualPrice );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | CoverageCode );
    END;
    Function:-
    Program Name : SPOT_Order_Product_Data_For_CFS.sql
    Description : Function to Validate parameters from CFS
    By : Vinod Kumar
    Date : 08/19/2011
    Modification History
    By When TAR Description
    CREATE OR REPLACE FUNCTION FETCH_ORDER_PRODUCT_DATA(orderNumber IN VARCHAR2, customerNumber IN VARCHAR2,
    productLine IN VARCHAR2, ODNumber OUT VARCHAR2,
    Line_Number OUT VARCHAR2, ServiceID OUT VARCHAR2,
    BilltoNumber OUT VARCHAR2, AnnualPrice OUT NUMBER,
    CoverageCode OUT VARCHAR2)
    RETURN VARCHAR2 IS
    lv_err_msg VARCHAR2(100) := '';
    lv_bucket_id VARCHAR2(14);
    lv_bill_number VARCHAR2(30);
    lv_anual_price NUMBER;
    lv_coverage_code VARCHAR2(8);
    lv_quote_num NUMBER(10) := NULL;
    lv_line_num NUMBER(5) := 0;
    lv_customer_number VARCHAR2(30) := customerNumber;
    lv_product_id VARCHAR2(14) := productLine;
    lv_count_quote NUMBER := 0;
    lv_quote_status VARCHAR2(5);
    lv_quote_version NUMBER(2):=0;
    BEGIN
    IF INSTR(orderNumber, '-') = 0 THEN
    lv_quote_num := orderNumber;
    ELSE
    lv_quote_num := SPT_Delimiter(orderNumber, 1, '-');
    lv_line_num := SPT_Delimiter(orderNumber, 2, '-');
    END IF;
    --Check status of the quote COM, APP
    SELECT COUNT(*) INTO lv_count_quote FROM sot_order_header WHERE ORDER_NUMBER=lv_quote_num
    AND ORDER_STATUS IN ('APP', 'COM') AND CUSTOMER_NUMBER = lv_customer_number;
    IF lv_count_quote = 0 THEN
    lv_err_msg := 'Invalid Order number';
    RETURN lv_err_msg;
    END IF;
    -- Fetch the latest version on SPOT quote
    SELECT MAX(VERSION_NUMBER) INTO lv_quote_version FROM SPT_QUOTE_HEADER WHERE QUOTE_NUMBER = lv_quote_num
    AND CUSTOMER_NUMBER = lv_customer_number;
    -- If quote is valid fetch the data in OUT parameters
    IF lv_line_num = 0 THEN
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.LINE_NUMBER, b.BUCKET_ID,
    b.ANNUAL_REF_RATE_USD, b.COVERAGE_CODE
    INTO lv_bill_number,lv_line_num,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
    lv_err_msg := 'Multiple PIDs existing in the SPOT order, please provide the SPOT order + line number as input data';
    RETURN lv_err_msg;
    END;
    ELSE
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.BUCKET_ID, b.ANNUAL_REF_RATE_USD,
    b.COVERAGE_CODE
    INTO lv_bill_number,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id
    AND b.LINE_NUMBER = lv_line_num;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
              lv_err_msg := 'Multiple SPOT lines exist with same parameter';
              RETURN lv_err_msg;
    END;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    lv_err_msg := '@@@ EXCEPTION THROWN @@@ '|| SUBSTR(SQLERRM,1,120);
    RETURN lv_err_msg ;
    END;
    Don't look at the function, it might have errors but my primary concern is how to test this function. Once I start doing its testing then only i can understand any bugs(if any).
    My pl sql is not so good. Im still learning. I don't understand IN and OUT parameters are.
    I just know that IN parameters r those whick we pass in to the function wen we call it and OUT parameters are those through which we get the result.
    Thanks in advance
    Vinod Kumar Nair

    20100511 wrote:
    I wondered how I could test the output of the function from within TOAD?I usually create the following function in my developer schema:
    create or replace function BoolToChar( b boolean ) return varchar2 is
    begin
      if b then
        return( 'TRUE' );
      else
        return( 'FALSE' );
      end if;
    end;To test a function like yours, the following will do in SQL*Plus/TOAD/etc:
    begin
      DBMS_OUTPUT.put_line(
        BoolToChar( XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934)  )
    end;
    I'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.Shout at? You reckon? I thought people risked being beaten with a lead pipe, or pelted with beer cans and stale pretzels - which makes being shouted at a really safe and viable alternative. {noformat};-){noformat}

  • How can I convert a mysql sql script to a oracle sql script

    Hi,
    We have a bunch of tables with data running on a mysql server.
    This should now be moved to an oracle 9 db.
    are there any tools to convert the import script of a mysql db
    to a format of the sql script that work for oracle ?
    Thanks
    Michael

    Oracle has a tool called Migration Toolbench, which supports MySQL 3.22 and 3.23:
    http://otn.oracle.com/tech/migration/workbench/content.html
    On this same topic, I was wondering if anybody has tried migrating from PostgreSQL to Oracle 9i. The workbench doesn't seem to support it, and feeding a pg_dump file directly into SQL*Plus is not working.

  • How to reference dynamic parameters in the PL/SQL script

    The meaning of dynamic parameter is the position and name of parameters will be changed based on the data structure of a referenced text file reading by the concerned PL/SQL script. Anybody can post a sample code will be very appreciated.

    The SQL and PL/SQL discussion forum is a good source for this kind of information.
    The URL is:
    PL/SQL

  • How can I run a SQL script file...

    How can I run a SQL script file from a location on my computer without providing the whole path?
    Is there some way I can set a "Working folder" in SQL Plus??
    Thanks!
    Tom

    You can create an environment variable called "SQLPATH" which is a list of directories that SQL*Plus will search for your .SQL
    scripts.
    I would like to use another directory than the oracle/bin...
    How can I do this ??
    Hello,
    U can do this by this way:
    Save odm_script.sql file to the default Oracle
    directory i.e. Oracle-Home/bin and Run following command
    through SQL Plus.
    SQL>@Script_Name
    I hope this will resolve ur problem.
    Regards,
    Omer Saeed Khan.

  • Retrieve alert values for use as parameter in corrective action sql script

    I am trying to write a corrective action sql script to kill a session that is blocking other sessions. I have the "blocking session count" metric set and the alert is firing correctly.
    Is there any way to retrieve the sid and serial number from the alert generated and use it in a corrective action sql script?
    Here is the alert generated:
    Target Name=myproddb.world
    Target Type=Database Instance
    Host=myprodserver
    Metric=Blocking Session Count
    Blocking Session ID=SID: 522 Serial#: 5228
    Timestamp=Mar 4, 2008 5:57:12 PM EST
    Severity=Warning
    Message=Session 522 is blocking 1 other sessions
    Notification Rule Name=Testing Corrective actions
    Notification Rule Owner=sysman
    Clearly the sid, and serial # is contained within the alert Message field
    what I want to write for the sql script is :
    alter system kill session '%sid%,%serial_no%' immediate;
    and have GC pass in the sid and serial_no to the script.
    The "Target Properties" listed on the right of the Edit Corrective Action screen lists minimal details pertaining to the alert and certainly not the session sid, serial no.
    Generically, is there any way to retrieve the values from an alert and use them in a corrective action script or job?
    I've looked into getting the values from the mgmt$alert_history table, but I'm hoping that GC can pass the values to the sql script.
    thanks in advance for your help.

    Hi
    You can implementing a procedure like this.
    1. When a block session count alarms occurs, there is a column in the v$lock that you can examine.
    #!/bin/ksh
    #kill_block_session.sh
    #first export your variables
    export ORACLE_HOME=/oracle/product/10.2.0.3
    export ORACLE_SID=SIDNAME
    $ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF
    execute immediate killed_blocks;
    EOF
    # end
    The killed_blocks is a procedure:
    create procedure
    declare
    v_sid varchar2(15);
    v_serial varchar2(15);
    -- now a sql query that retrieve the sid and serial
    -- you can obtain these values from v$session and v$lock
    select vs.sid,vs.serial into v_sid,v_serial
    from v$session vs,v$lock vl
    where vs.sid=vl.sid
    and vl.block >0
    -- After this, you execute a dbms_put line with these
    -- values
    But you understant that this response action is very dangerous, because its possible that you kill sessions that the blocking are transitient.
    You must examine your enviroment and your application and establish the metric like UDM and not for only session blocking count.
    You must to see:
    - The type of block
    - The ctime time in the v$lock for to understatn the amount of time to determine that the block is need killed.
    - In my opinion you need a special UDM and deactivate the blocking sesion count
    If you want help to create this UDM send me a mail to [email protected]
    Regards
    Robert

  • How to run a sql script in oracle forms

    Hi,
    For me there is an sql script. I need to run that sql script in forms.
    Actually we will run that sql file in pl/sql developer by giving @and the file name.
    But how to run that file in forms.
    Can any one help on these.Which book I have to look.
    Thanks

    Actually there is a script files which will drop all the indexes and tables.
    DROP querry will be there for each index and each table.
    So I run the script all the indexes and all the tables will be deleted. So using forms I have to run that script.
    Thanks

Maybe you are looking for

  • How do I move vznavigator favorites from one phone to another?

    how do I move vznavigator favorites from one phone to another? Wife has Pre 2 where GPS works beautiful... my old Pre Plus was always hit or miss on GPS. But I've developed quite a library of favorites on my Plus.  How do I move these to our new Pre

  • CS4 - Is there a way to adjust gamma for second monitor or send to overlay?

    One thing that is evident when I edit in Premiere CS4 using the AVCHD 1080i 60 template is that the preview in the second monitor, which in my case is my TV set connected using a DVI to HDMI cable, is that the output is too dark compared to what it s

  • % Symbol in report after calculation

    Hi, I have two key figures in my report. I want to calculate the percentage of KF1 to KF2. Say KF1 is 20 and KF2 is 100. My KF3 is the formula and it should 20 %. I am using the %A operator and it is just returning the value 20 and the % Symbol follo

  • WD ABAP : dropdown

    Hi, I have made a drop down in my screen. But it has to be of "read-only" type. When i set it to read only.... it display only the value while the selection list is lost. The requirement is that it needs of be read only and also the selection list sh

  • I cant drag my nideos onbto my itunes!!! HELP!!!

    My friends told me to go to the video file and drag it onto my itunes so it'll appear on my library. but it wont appear!!! how do i make it show?