SQL Performance - Looking for a hint or suggestion on how to improve performance.

I've linked several tables for the Sales Order, Delivery, and Invoicing. In essence, a query to show shipments and invoicing to a sales order.
Throughput is poor....60 + seconds, so I am looking for a solution...perhaps /* + hints*/ techinques to improve the performance of this code.
Here is a functional version of the code....
/* Functionally tested join between OM, WSH, AR Tables */
Select oeh.order_number
     , trx_number as invc_no
     , rctl.line_number as invc_line_no
     , rctl.inventory_item_id rctl_inventory_item_id
     , rctl.sales_order_line as SO_Line_No
     , oel.line_id
     , rctl.line_type
     , oel.ship_from_org_id as oel_ship_from_org_id
     , rctl.warehouse_id
     , oel.ordered_quantity
     , oel.shipped_quantity
     , oel.invoiced_quantity
     , rctl.UNIT_SELLING_PRICE
     , rctl.extended_amount
     , rctl.revenue_amount
     , wdd.delivery_detail_id
     , wnd.delivery_id
     , rctl.interface_line_attribute1  -- Sales Order Number
     , rctl.interface_line_attribute3  -- delivery_id (wsh)
     , rctl.interface_line_attribute6  -- Sales Order Line Id
  From apps.oe_order_headers_all oeh
     , apps.oe_order_lines_all oel
     , apps.wsh_delivery_details wdd
     , apps.wsh_new_deliveries wnd
     , apps.wsh_delivery_assignments wda
     , apps.ra_customer_trx_all rct
     , apps.ra_customer_trx_lines_all rctl
Where oeh.header_id = oel.header_id                           
   and wdd.source_header_id = oeh.header_id
   and wdd.source_header_id = oel.header_id 
       and wdd.source_line_id = oel.line_id
       and wdd.SOURCE_CODE = 'OE'
   and wdd.delivery_detail_id = wda.delivery_detail_id
   and wda.delivery_id = wnd.delivery_id
   and rctl.interface_line_attribute1 = to_char(oeh.order_number)
      and rctl.interface_line_attribute6 = to_char(oel.line_id) --this is where explain plan cost is high!
       and rctl.org_id = oel.org_id
   and rctl.interface_line_attribute3 = to_char(wnd.delivery_id)
   and rctl.customer_trx_id = rct.customer_trx_id
   and rct.interface_header_context = 'ORDER ENTRY'
   and oeh.order_number = '99999' --enter desired sales order here....
Order by 1,2,3,4;

Can you provide your explain?
Also, can you do an "set autotrace traceonly" and run it again and post results?  The results of that would help people here provide more reasonable suggestions.
(Mine so far is only: avoid hints - that's a crutch and not solving the real problem).
Are your statistics up to date?
select table_name, last_analyzed from dba_tables
where table_name in (
       'OE_ORDER_HEADERS_ALL OEH','OE_ORDER_LINES_ALL OEL','WSH_DELIVERY_DETAILS WDD',
       'WSH_NEW_DELIVERIES WND','WSH_DELIVERY_ASSIGNMENTS WDA','RA_CUSTOMER_TRX_ALL RCT',
        'RA_CUSTOMER_TRX_LINES_ALL RCTL' );

Similar Messages

  • I have a large library that I ripped in AIFF using iTunes.  I converted to Mp3 to save drive space, keeping the originals. I have a new computer and want to revert to my original files. iTunes sees the library but is looking for Mp3 files.  Suggestions?

    I have a large library that I ripped in AIFF using iTunes.  I converted to Mp3 to save drive space, keeping the originals. I have a new computer and want to revert to my original files. iTunes sees the library but is looking for Mp3 files.  Suggestions?

    You're welcome.
    For tips on logical organization within iTunes see my article on Grouping Tracks Into Albums.
    tt2

  • SQL novice looking for a little help

    A little SQL help asked for…because my solution works but runs like a pig.
    I have two tables with a link many-many association table between them with two FK's defined on the PK's in the tables either side of the join.
    CREATE TABLE TABLE1
    ID VARCHAR2(20 BYTE) NOT NULL
    , NAME VARCHAR2(20 BYTE)
    , AGE NUMBER
    , ADDR1 VARCHAR2(20 BYTE)
    , CONSTRAINT TABLE1_PK PRIMARY KEY
    ID
    ENABLE
    CREATE TABLE TABLE2
    ID2 VARCHAR2(20 BYTE) NOT NULL
    , TYPE VARCHAR2(20 BYTE)
    , DATE_CREATED DATE
    , CONSTRAINT TABLE2_PK PRIMARY KEY
    ID2
    ENABLE
    CREATE TABLE LINK_TABLE
    ID VARCHAR2(20 BYTE) NOT NULL
    , ID2 VARCHAR2(20 BYTE) NOT NULL
    , CONSTRAINT LINK_TABLE_PK PRIMARY KEY
    ID
    , ID2
    ENABLE
    ALTER TABLE LINK_TABLE
    ADD CONSTRAINT LINK_TABLE1_FK1 FOREIGN KEY
    ID
    REFERENCES TABLE1
    ID
    ENABLE;
    ALTER TABLE LINK_TABLE
    ADD CONSTRAINT LINK_TABLE2_FK2 FOREIGN KEY
    ID2
    REFERENCES TABLE2
    ID2
    ENABLE;
    Populated with the simple data set below that also establishes the many to many links between table1 and table2.
    Insert into TABLE1 (ID,NAME,AGE,ADDR1) values ('a','jake',23,'london');
    Insert into TABLE1 (ID,NAME,AGE,ADDR1) values ('d','jimmy',26,'lamelane');
    Insert into TABLE1 (ID,NAME,AGE,ADDR1) values ('b','jenny',55,'lakeside');
    Insert into TABLE1 (ID,NAME,AGE,ADDR1) values ('c','jemima',21,'lothian');
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('z','type1',to_date('10-MAR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('x','type1',to_date('09-MAR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('n','type2',to_date('04-MAR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('d','type1',to_date('03-MAR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('e','type1',to_date('03-MAR-13','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('f','type2',to_date('16-MAR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('s','type4',to_date('04-MAR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('w','type3',to_date('05-APR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('h','type1',to_date('02-APR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('v','type2',to_date('23-APR-12','DD-MON-RR'));
    Insert into TABLE2 (ID2,TYPE,DATE_CREATED) values ('k','type3',to_date('30-MAR-12','DD-MON-RR'));
    REM INSERTING into LINK_TABLE
    SET DEFINE OFF;
    Insert into LINK_TABLE (ID,ID2) values ('a','z');
    Insert into LINK_TABLE (ID,ID2) values ('a','x');
    Insert into LINK_TABLE (ID,ID2) values ('a','f');
    Insert into LINK_TABLE (ID,ID2) values ('d','d');
    Insert into LINK_TABLE (ID,ID2) values ('d','e');
    Insert into LINK_TABLE (ID,ID2) values ('b','w');
    Insert into LINK_TABLE (ID,ID2) values ('b','x');
    Insert into LINK_TABLE (ID,ID2) values ('b','v');
    Insert into LINK_TABLE (ID,ID2) values ('a','n');
    Insert into LINK_TABLE (ID,ID2) values ('c','s');
    Insert into LINK_TABLE (ID,ID2) values ('c','k');
    Insert into LINK_TABLE (ID,ID2) values ('a','s');
    Insert into LINK_TABLE (ID,ID2) values ('a','v');
    And thus when queried using the join, gives me this data.
    select t1.*, t2.* from table1 t1, link_table lt, table2 t2
    where lt.id = t1.id
    and t2.id2 = lt.id2;
    ID NAME AGE ADDR1 ID2 TYPE DATE_CREATED
    a jake 23 london f type2 16-MAR-12
    a jake 23 london n type2 04-MAR-12
    a jake 23 london s type4 04-MAR-12
    a jake 23 london v type2 23-APR-12
    a jake 23 london x type1 09-MAR-12
    a jake 23 london z type1 10-MAR-12
    b jenny 55 lakeside v type2 23-APR-12
    b jenny 55 lakeside w type3 05-APR-12
    b jenny 55 lakeside x type1 09-MAR-12
    c jemima 21 lothian k type3 30-MAR-12
    c jemima 21 lothian s type4 04-MAR-12
    d jimmy 26 lamelane d type1 03-MAR-12
    d jimmy 26 lamelane d type1 03-MAR-13
    12 rows selected
    However, what I need is
    for every unique ID in table1, I need the maximum date for in table2 but given that there needs to be a precedence on types in a predefined order, that order being
    type4 trumps type2 which trumps type3 which trumps type1.
    therefore the query I'm looking for will return the type, type4 and it's max date even if other types exist. If no type4's exist for a link from table1.id in table2 then return type2 and it's max date and so forth.
    essentially my query should return
    ID     TYPE     MAX_DATE_CREATED
    a     type4     04-MAR-12
    b     type2     23-APR-12 (since it has no type4 and type2 trumps the other)
    c     type4     04-MAR-12
    d     type1     03-MAR-13 (the highest precedence is type1 and it's highest date is 03-MAR-13)
    Hmmm
    I have achieved this using some odd SQL where I use CASE to score the type against the precedence and then sum the total in an aggregate super query but as I say, it runs like a pig, my real dataset is much bigger than this. Hope there's a nice chap/lady out there who rises to this challenge.
    TIA
    Jenny.

    Hi, Jenny,
    Welcome to the forum!
    Here's one way:
    WITH   got_r_num   AS
         SELECT t1.*
         ,      t2.*
         ,      ROW_NUMBER () OVER ( PARTITION BY  t1.id
                                        ORDER BY         CASE    t2.type
                                              WHEN  'type4'  THEN  1
                                              WHEN  'type2'  THEN  2
                                              WHEN  'type3'  THEN  3
                                              WHEN  'type1'  THEN  4
                                          END
                            ,            t2.date_created     DESC
                          )      AS r_num
         FROM   table1          t1
         ,      link_table      lt
         ,      table2          t2
         WHERE  lt.id      = t1.id
         AND    t2.id2      = lt.id2
    SELECT     *     -- or whatever columns you want
    FROM     got_r_num
    WHERE     r_num     = 1
    ;This is an example of a Top-N Query , where we pick N items (N=1 in this case) from the top of an ordered list (or lists; in this case, we need a separate list for each id.) The analytic ROW_NUMBER function can assign numbers 1, 2, 3, ..., in order, with a separate set of numbers for each id. The tricky part in this problem is getting your trumping order. I used a CASE expresion to map each of the types to a number that reflected the order.
    Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful!
    Would you like to be even more helpful? Post your best attempt at a query. Even if it performs really poorly, it can help illustrate what you need to do, and maybe give ideas about how to do it. It could be that a small change in what you already have is all that's needed.
    The query above will work in Oracle 9.1 or higher. It never hurts to say which version of Oracle you have.

  • Looking for multiple graph logging suggestions

    I have a "host program" that is attached to a cRIO platform used for precision controlling of some heavy machinery.  The current host is used to set parameters, but primarily to read values and display trends for the operators and maintenance personnel.  I had previously been looking for a method to put a correct timestamp on my historical charts, which allow the user to scroll back if something odd occurs, but this has become more trouble than it is worth.  One of my main difficulties in all of this is that I have 6 synchronized graphs that need the "roll back" ability, and putting a live timestamp on a chart you must be able to pause and rewind is unfathomably difficult with LabVIEW...
    So, I have decided to kill 2 birds with 1 stone, so to speak.  I needed to work out logging the graphed signals to file anyhow, so I decided I might as well just do this and externally reference the log files for the "rewind" functionality.  My problem now is finding the best approach to log these 6 graphs of differing types...  The first graph has 3 overlaid analog values, the second graph has 2 overlaid values, and the last 4 are each just a single individual (scaled) sensor reading.  The graphs are updated every 100ms.  Accurate timestamps (date and time) need to be attached to the data as well.
    This logging is a new arena of LabVIEW for me, but I figured there has to be at least a few experienced users or developers out there who know all of the ins and outs.  Any suggestions on the best way for me to log this data?  Individual files for each chart, or is there a better method to combine the data to keep it cleaner (not multiple files to track)?  Are there pitfalls I should be watching out for?

    Take a look at tdms files.  They are a binary format that is open (www.ni.com/white-paper/5696/en).  You can define groups of channels and they can be logged at different rates.  The LabVIEW API makes it relatively easy to retrieve a channel or group, although it may be more challenging to find a specific time if your files are large.  Besides the examples included with LabVIEW, you can drill down into the TDMS File Viewer that's in the TDMS palette for another example.  Also, there is a plug in for Excel that will allow it to import TDMS files (zone.ni.com/devzone/cda/epd/p/id/2944).

  • SQL SCRIPT LOOKING FOR PAPERCLIP HELP

    Good morning,
    Please I need hel I am looking for this famous paperclip  I have choosed each Icon and I cant find it
    Thank you
    Microsoft SQL Server Management Studio:<o:p></o:p>
    1. Right-click the paperclip icon to the left to open the Table_Size.txt script or save<o:p></o:p>
    the script to your hard disk. You’ll use this script to identify the largest table by<o:p></o:p>
    size in kilobytes in a Microsoft Database.<o:p></o:p>

    Then why do you ask strangers rather than your "consultant"?  And this question sounds much like your previous one
    how to get table size

  • If ur looking for best answer, I suggest you.

    there's Alot of customers who have not solved the issues, even I have an issues with my iPhone since the new upgrade. I tried calling, it was a long hold and also wastes of time so I hung up. I had problem
    with wifi and freezing application, I tried going on apple online support to find the answer for this. I seen so many I mean billions of comment and I got too tired of looking for it so I just used google and typed down what the problem I was having, guess what... It works like charm everythi g on my iPhone works perfectly fine. So my opinion is just google seach them and also make sure u type in for example I typed in iphone 2.0 version wifi problem and there's a list but all of them were helpful they answer faster than calling or searching on apple and macworld.com. So that's my opinion. Remeber take ur time reading it. Good luck with the search.

    I also found this case from amazon and it works great for $6
    [IMG]http://i50.tinypic.com/21oypog.jpg[/IMG]

  • New Ipad User looking for some good CRM suggestions for small business

    Hello All,
    I am a new (and satisfied) Apple Ipad2 user.  I am the sales rep for a small business that is in the health care field.  I am looking for a good CRM program for the following reasons and I am wanting to know if there is a particular program that can provide any of these things for me:
    Ability to put in all of my customers information.  Seperate folders for each.
    Ability to add information to customer folders/files based on recent phoen conversations or actual on-site visits.
    Ability to set a reminder of when to call back on that customer to see status of his/her patient that was fit with our product.
    Ability to allow other members of the company to check in on this information as well.
    A little background, we are a small company in the health care field.  We have 90 customers currently and we are growing at a steady pace.  I would like for my upper management to look at the CRM at any point and see what is going on with each customer.  If I sell a product to Customer A, then I would like a reminder to pop up 6 months from now when that patient will be ready for another product.  I would also like to be able to update a customer file so that management can see when I called on a customer, etc.
    I appreciate everyone's input as I have never utilized a CRM program.  I am currently using Dropbox for all of this right now, but it seems like a CRM would be more organized,
    Thank you,
    --Ryan

    HI Ryan,
    Did you find an app for CRM, one thing that I'm also curious about, you may need to find one that is HIPPA compliant.
    James

  • Looking for a DVR, any suggestion?

    i'm looking for a real good DVR, similar to TIVO, that doesn't require a monthly subscription.

    Paying a subscription is often up to your service provider... such as cable or satellite
    Try http://www.avsforum.com/f/100/digital-recorders-pvrs-general

  • I am trying to set up icloud on my new device. However it keeps showing hte message account not verified, check your email. I have tried looking for email there is nothing. How do I set this up?

    I am trying to set up icloud on my new device. However it keeps showing the message - account not verified, check your email. I have looked for email and there is nothing. How do I set this up?

    Welcome to the Apple Community.
    Put in a request for another verification e-mail to be sent to you.
    Start here, change your country if necessary and go to manage your account.
    Also check your Mail rules and filtering, the verification mail may be going to a junk folder or even being deleted altogether. You may also wish to contact your mail provider to see if their spam filters are removing the email before it gets to you.

  • HT201328 I am looking for a factory unlocked iPhone 5; how do I get one?

    I am looking for factory unlocked iPhone 5; how do I get one? Are all those that are bought online factory unlocked?

    An unlocked iPhone 5 has not been release in the U.S.

  • Looking for an example VI that shows how to trigger an event in a VI from a subvi based on a value.

    I am looking for an example VI that uses a typical event structure for the GUI, but also has an event that will trigger based on a boolean value changing in a subVI to that VI.
    Thank you.

    You need to Create User Event.  Any Event structure which is registered with the event, whether it be in a subVI or otherwise can trigger the user event by using Generate User Event.
    Right-click an event structure and select Show Dynamic Event Terminal.  This is what you use to register your user (dynamic) events.
    Search for "events" in NI examples within LabVIEW.

  • Looking for CURSOR replacement, please suggest!

    Hello Experts,
    I having some master tables "#ACTION_MASTER" & "#RPT_MILE_MASTER" and a link table "#ACTION_MILE_RPT_LINK" showing their relationship.
    And again I having a derive table "#TBL" to finally update the master table ''#ACTION_MASTER".
    I am able to do the task with below approach and I would like to know how to optimize it, please suggest and let me know for any other information. Thanks! 
    CREATE TABLE #ACTION_MASTER (UID INT, ACTION_ID INT, IS_ACTV BIT)
    INSERT INTO #ACTION_MASTER VALUES (1, 102, 1), (2, 103, 1)
    --SELECT * FROM #ACTION_MASTER
    CREATE TABLE #RPT_MILE_MASTER (UID INT, RPT_ID INT, MILE_ID INT, MILE_STATUS INT)
    INSERT INTO #RPT_MILE_MASTER VALUES (1, 12, 1, 5), (2, 13, 2, 2)
    --SELECT * FROM #RPT_MILE_MASTER
    CREATE TABLE #ACTION_MILE_RPT_LINK (LINK_ID INT, ACTION_ID INT, RPT_ID INT, MILE_ID INT)
    INSERT INTO #ACTION_MILE_RPT_LINK VALUES (1, 102, 12, 1), (2, 102, 13, 2), (3, 103, 13, 2)
    --SELECT * FROM #ACTION_MILE_RPT_LINK
    CREATE TABLE #TBL (RPT_ID INT, MILE_ID INT, MILE_STATUS INT)
    INSERT INTO #TBL VALUES (13, 1, 5), (13, 2, 5)
    --SELECT * FROM #TBL
    DECLARE @ACTION_ID INT
    DECLARE DB_CURSOR CURSOR FOR
    SELECT DISTINCT ACTION_ID FROM #ACTION_MILE_RPT_LINK WHERE MILE_ID IN (SELECT MILE_ID FROM #TBL WHERE MILE_STATUS = 5)
    OPEN DB_CURSOR
    FETCH NEXT FROM DB_CURSOR INTO @ACTION_ID
    WHILE @@FETCH_STATUS = 0
    BEGIN
    IF EXISTS(
    SELECT * FROM #ACTION_MILE_RPT_LINK
    WHERE MILE_ID IN (SELECT MILE_ID FROM #TBL WHERE MILE_STATUS = 5)
    AND RPT_ID NOT IN (SELECT DISTINCT RPT_ID FROM #TBL)
    AND ACTION_ID = @ACTION_ID)
    BEGIN
    DECLARE @COMPARE TABLE (RPT_ID INT, MILE_ID INT, MILE_STATUS INT)
    INSERT INTO @COMPARE
    SELECT RPT_ID, MILE_ID, 5 'MILE_STATUS' FROM #ACTION_MILE_RPT_LINK
    WHERE MILE_ID IN (SELECT MILE_ID FROM #TBL WHERE MILE_STATUS = 5)
    AND RPT_ID NOT IN (SELECT DISTINCT RPT_ID FROM #TBL)
    AND ACTION_ID = @ACTION_ID
    IF NOT EXISTS(
    SELECT RPT_ID, MILE_ID, MILE_STATUS FROM #RPT_MILE_MASTER WHERE RPT_ID IN (SELECT RPT_ID FROM @COMPARE)
    EXCEPT
    SELECT RPT_ID, MILE_ID, MILE_STATUS FROM @COMPARE)
    BEGIN
    UPDATE #ACTION_MASTER SET IS_ACTV = 0 WHERE ACTION_ID = @ACTION_ID
    END
    END
    ELSE
    BEGIN
    UPDATE #ACTION_MASTER SET IS_ACTV = 0 WHERE ACTION_ID = @ACTION_ID
    END
    FETCH NEXT FROM DB_CURSOR INTO @ACTION_ID
    END
    CLOSE DB_CURSOR
    DEALLOCATE DB_CURSOR
    --SELECT * FROM #ACTION_MASTER
    DROP TABLE #ACTION_MASTER
    DROP TABLE #RPT_MILE_MASTER
    DROP TABLE #ACTION_MILE_RPT_LINK
    DROP TABLE #TBL

    I don't understand the values in #TBL. Why are the manually inserted? Shouldn't they be the same as in #RPT_MILE_MASTER?
    Further more I don't understand the condition in the cursor. Both tables have RPT_ID and MILE_ID in common. Either this is a real multivalued relationship, then why do you only filter by MILE_ID? It looks wrong.
    You can rewrite your cursor internals without IF's to
    WITH Compare ( RPT_ID, MILE_ID, MILE_STATUS )
    AS ( SELECT RPT_ID ,
    MILE_ID ,
    5
    FROM #ACTION_MILE_RPT_LINK
    WHERE MILE_ID IN ( SELECT MILE_ID
    FROM #TBL
    WHERE MILE_STATUS = 5 )
    AND RPT_ID NOT IN ( SELECT DISTINCT
    RPT_ID
    FROM #TBL )
    AND ACTION_ID = @ACTION_ID
    UPDATE #ACTION_MASTER
    SET IS_ACTV = 0
    WHERE ACTION_ID = @ACTION_ID
    AND NOT EXISTS ( SELECT RPT_ID ,
    MILE_ID ,
    MILE_STATUS
    FROM #RPT_MILE_MASTER
    WHERE RPT_ID IN ( SELECT RPT_ID
    FROM Compare )
    EXCEPT
    SELECT RPT_ID ,
    MILE_ID ,
    MILE_STATUS
    FROM Compare )
    AND EXISTS ( SELECT *
    FROM #ACTION_MILE_RPT_LINK
    WHERE MILE_ID IN ( SELECT MILE_ID
    FROM #TBL
    WHERE MILE_STATUS = 5 )
    AND RPT_ID NOT IN ( SELECT DISTINCT
    RPT_ID
    FROM #TBL )
    AND ACTION_ID = @ACTION_ID );
    UPDATE #ACTION_MASTER
    SET IS_ACTV = 0
    WHERE ACTION_ID = @ACTION_ID
    AND NOT EXISTS ( SELECT *
    FROM #ACTION_MILE_RPT_LINK
    WHERE MILE_ID IN ( SELECT MILE_ID
    FROM #TBL
    WHERE MILE_STATUS = 5 )
    AND RPT_ID NOT IN ( SELECT DISTINCT
    RPT_ID
    FROM #TBL )
    AND ACTION_ID = @ACTION_ID );
    You can now remove the cursor and JOIN the cursors SELECT into both UPDATEs.

  • Lab Manager 3 reports - SQL Queries - looking for some help

    Hi Everyone
    Our management has asked for metrics on the use of Lab Manager so I started looking around and noticed that none of the 3rd party tools support Lab Manager. I started to poke around the SQL database and managed to extract some info however my SQL knowledge is very limited. I am wondering if anyone out there has written their own queries or can help me sort some things out.
    I thought I would start a community thread as i'm sure I am not the only one out there looking to do this.
    This first query gives you the usernames and deploys in order
    SELECT *
    FROM Jobs
    WHERE (starttime > '02/01/2007') AND (object NOT LIKE 'VirtualRouter%') AND (operation LIKE 'JOB_Deploy') AND (object_type_full = 'Virtual Machine') and (status <> 3)
    This query gives you the daily deployments per organization
    SELECT convert(char(10), starttime, 101) as MonthYear, count(operation) as Deployments, bucket_name AS Organization
    FROM Jobs
    WHERE (operation LIKE 'JOB_Deploy')AND starttime BETWEEN '12/01/2006' AND '12/01/2009' AND (status <>3)
    GROUP BY convert(char(10), starttime, 101),bucket_name
    ORDER BY MonthYear
    This last query shows total deployments listed by username (someone helped me with this)
    SELECT U.username, COUNT(J.job_id) AS Deploys
    FROM  Jobs J INNER JOIN
                         Usr U ON J.user_id = U.user_id
    WHERE (J.object_type_full = 'Virtual Machine') AND (J.operation = 'JOB_Deploy') AND (starttime BETWEEN '12/01/2006' AND '12/01/2009')
    GROUP BY U.username
    I would like to know how to get some of the following:
    Top 10 Users (Query 3 lists the total deployments per user but i don't know how to have it display this)
    number of images created monthly (VM Templates / Workspace Configurations)
    number of images captured to the library monthly
    Biggest VMs
    Number of logins daily (to Lab Manager)
    Top 10 images checked out
    Images not used in x days
    Any help would be greatly appreciated

    Troubleshooting Queries for Lab Manager 4
    I always had the need to map the VM IDs in vSphere Client and public IPs to the actual user and organisation. Also, LUN and ESX relations I need from time to time.
    SQL file to show all deployed VMs in all configurations
    use LabManager
    go
    select
      right('000000' + convert(varchar,bvs.dir_id),6) + '-' + left(bvs.name,15) as "Name in VCeneter",
      left(bko.name,12) as "Organization",
      left(bkw.name,8) as "Workspace",
      left(us.fullname,20) as "User",
      left(cfg.name,25) as "Configuration",
      dir.chain_length as "Chain Length",
      left(ds.display_name,15) as "LUN",
      left(ms.display_name,26) as "ESX Server",
      rii.ip_addr as "Internal IP",
      rie.ip_addr as "External IP",
      left(bvs.vm_tools_version,7) as "VM Tools",
      bvs.vcpu_count "CPU Count",
      left(bvs.mem,5) as "Memeory",
      convert(varchar(19), bvs.date_created, 120) as "Created",
      convert(varchar(19), dvs.date_deployed, 120) as "Deloyed"
    from BucketVirtualServer bvs
      inner join Bucket bko on bko.bucket_id=bvs.OrganizationBucketId
      inner join Bucket bkw on bkw.bucket_id=bvs.bucket_id
      inner join ConfigurationView cfg on bvs.sg_id=cfg.sg_id
      inner join Usr us on us.user_id=bvs.user_id
      inner join FsDir dir on dir.dir_id=bvs.dir_id
      inner join Datastore ds on ds.datastore_id=dir.datastore_id
      inner join NetworkInterface ni on bvs.vs_id=ni.vs_id
      inner join ReservedIPAddress rii on rii.address_id=ni.ip_address_id
      left join ReservedIPAddress rie on rie.address_id=ni.ext_address_id
      inner join DeployedVirtualServer dvs on dvs.vs_id=bvs.vs_id
      inner join ManagedServer ms on ms.ms_id=dvs.ms_id
    where bvs.is_vrouter=0
    order by bvs.dir_id
    go
    Batch file
    osql -S localhost\LABMANAGER -E -i vmlist.sql -o vmlist.txt -w 1024 -n
    start notepad vmlist.txt
    SQL file to show all VMs in all configurations
    use LabManager
    go
    select
    right('000000' + convert(varchar,bvs.dir_id),6) + '-' + left(bvs.name,15) as "Name in VCeneter",
    left(bko.name,12) as "Organization",
    left(bkw.name,8) as "Workspace",
    left(us.fullname,20) as "User",
    left(cfg.name,25) as "Configuration",
    dir.chain_length as "Chain Length",
    left(ds.display_name,15) as "LUN",
    left(ms.display_name,26) as "ESX Server",
    rii.ip_addr as "Internal IP",
    rie.ip_addr as "External IP",
    left(bvs.vm_tools_version,7) as "VM Tools",
    bvs.vcpu_count "CPU Count",
    left(bvs.mem,5) as "Memeory",
    convert(varchar(19), bvs.date_created, 120) as "Created",
    convert(varchar(19), dvs.date_deployed, 120) as "Deloyed"
    from BucketVirtualServer bvs
      inner join Bucket bko on bko.bucket_id=bvs.OrganizationBucketId
      inner join Bucket bkw on bkw.bucket_id=bvs.bucket_id
      inner join ConfigurationView cfg on bvs.sg_id=cfg.sg_id
      inner join Usr us on us.user_id=bvs.user_id
      inner join FsDir dir on dir.dir_id=bvs.dir_id
      inner join Datastore ds on ds.datastore_id=dir.datastore_id
      inner join NetworkInterface ni on bvs.vs_id=ni.vs_id
      inner join ReservedIPAddress rii on rii.address_id=ni.ip_address_id
      left  join ReservedIPAddress rie on rie.address_id=ni.ext_address_id
      left  join DeployedVirtualServer dvs on dvs.vs_id=bvs.vs_id
      left  join ManagedServer ms on ms.ms_id=dvs.ms_id
    /* where bvs.is_vrouter=0 */
    order by bvs.dir_id
    go
    Batch file
    osql -S localhost\LABMANAGER -E -i vmlist_all.sql -o vmlist_all.txt -w 1024 -n
    start notepad vmlist_all.txt

  • Kff.where returns 'null'  and causes sql error - looking for a work around

    Hello,
    I am using BI 5.6.3 in EBS (11.5.10.2)
    I have created a kff.where as follows:
    <lexical
    type="oracle.apps.fnd.flex.kff.where"
    name="lp_location_where_clause"
    comment="Comment"
    application_short_name="OFA"
    id_flex_code="LOC#"
    id_flex_num=":lp_location_flex_structure"
    code_combination_table_alias="loc"
    segments="ALL"
    operator="BETWEEN"
    operand1=":p_location_low"
    operand2=":p_location_high"/>
    </lexicals>
    Everything works fine, as long as I have a values for the p_location_low and p_location_high. However, this is a parameter that comes in from a concurrent program and is optional. When the user doesn't pick a value, :p_location_low is the concatenated delimiters for the location '..'.
    When this runs, the kff.where is returning null which causes 'Invalid Relational Operation error' because 'AND null' is not valid.
    Warning in the log is :[091910_025232517][][STATEMENT] !!Warning: FlexAPI returns null for 'x_where_expression' lexical definition...
    Does anyone have a workaround for this since making the parameter required is not an option for my users?
    Thanks for reading.

    In your SQL*Plus session, make sure you
    SQL> set define offbefore trying to create the Java stored procedure. SQL*Plus assumes that any string that begins with an & is a substitution variable unless you tell it that you have no substitution variables (via set define off).
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • My downloads from uTorrent are converting to Appletv but are not there when I look for them. Any suggestions?

    I am downloading movies to my pc and that is not a problem, nor is the conversion to Apple TV but when I go into AppleTV the downloaded movies are not there...they seem to have disappeared into the ether somewhere. Any suggestions? Any and all gratefully accepted. Should add that this has not been a problem in the past.

    We cannot help you with this here.

Maybe you are looking for