Sales Per Person, Per Department Query

Hi All,
I am trying to write a query to allow me to get the Sales Figures per Employee (by Owner Code) per Department. I will then turn this into a Crystal Report so that I can do A Sales Report by Department.
I Have this so far :
SELECT T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal], T0.[OwnerCode], T1.[dept] FROM OINV T0  INNER JOIN OHEM T1 ON T0.OwnerCode = T1.empID WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
However rather than have a number for the Sales Employee and Department I would like to see their names and their department name. Could someone point me in the right direction please and advise the correct joins. I also need to see the pre-VAT (Tax) figure for the Doc Total as well - really not sure what table that is in !
Much appreciated.
Kind regards
Sean Martin
Edited by: Sean Martin on Feb 16, 2011 4:38 PM
Edited by: Sean Martin on Feb 16, 2011 4:38 PM

HI Sean,
Try this:
SELECT T0.DocNum, T0.DocDate, T0.DocDueDate, (T0.DocTotal-T0.VatSum) as [Total before Tax],
       T0.DocToal as [Document Total] ,T0.OwnerCode,T1.firstName,  T1.dept, T2.Name
FROM OINV T0
        LEFT OUTER JOIN OHEM T1 ON T0.OwnerCode = T1.empID
        LEFT OUTER JOIN OUDP T2 On T1.dept=T2.Code
WHERE T0.DocDate >='[%0]' AND T0.DocDate <='[%1]'
Thanks,
Neetu

Similar Messages

  • A query with workingdays per month per persons per period

    Can anyone help me on the way in building a difficult SQL query?
    I work with Oracle SQL. It is intended to calculate over a certain period, to find the working days for each month for each person.
    I have a working query for calculate the number of days for 1 months minus holidays
    Select count (*) NUM_WORK_DAYS
    From (
    Select to_date ('01-01-2010 ',' dd-mm-yyyy ') + ROWNUM-1 as day
    From all_objects
    Where ROWNUM <to_number (to_char (last_day ('01-01-2010 '), DD')) + 1)
    Where to_number (to_char (day, 'd')) between 1 and 5
    And not exists (select NULL
    From HOLIDAY
    Where Holiday.hol=day)
    There is a datetable with the following structure where I can get the periods:
    DATES
    YEAR | MONTH | WEEK | SD
    2010 | 201002 | 201006 | 09/02/2010
    All required months are present
    It is intended that the user give a beginning and a end time specify.
    I have a table of workingdays per person named
    CALENDAR
    CAL | MON | TUE | WED | THU | FRI | SAT | SUN
    Person | Y | Y | N | Y | Y | N | N
    And a table of holidays
    HOLIDAY
    CAL | HOL
    Person | 01/01/2010
    How can I combine the query for working days and build a query that returns for multiple people over multiple months the number of workingdays per month? I will ask the user to give a beginning period and a end period
    I am aware that I ask a lot of your time, but I can not imagine the solution myself. Many thanks in advance
    Gr,
    Els

    You can do something like this:
    SQL> select * from calendar;
        PERSON M T W T F S S
             1 Y Y N Y Y N N
             2 Y Y Y Y Y N N
    SQL> select * from holiday;
        PERSON HOL
             1 12-FEB-10
             2 09-FEB-10
    SQL> define start_day=2010-02-01
    SQL> define end_day=2010-02-20
    SQL> with period as (
      2  select DATE '&start_day' start_date, DATE '&end_day' end_date
      3    from dual),
      4  days as (
      5  select start_date+level-1 day
      6    from dual,period
      7  connect by level <= end_date-start_date+1),
      8  mycal as (
      9  select person, 'monday' day, mon works from calendar union all
    10  select person, 'tuesday' day, tue from calendar union all
    11  select person, 'wednesday' day, wed from calendar union all
    12  select person, 'thursday' day, thu from calendar union all
    13  select person, 'friday' day, fri from calendar union all
    14  select person, 'saturday' day, sat from calendar union all
    15  select person, 'sunday' day, sun from calendar
    16  )
    17  select person, count(0)
    18    from mycal c, days d
    19   where c.day = trim(to_char(d.day,'day'))
    20     and c.works='Y'
    21     and not exists (select 1 from holiday h where h.person=c.person and h.hol=d.day)
    22  group by person;
    old   2: select DATE '&start_day' start_date, DATE '&end_day' end_date
    new   2: select DATE '2010-02-01' start_date, DATE '2010-02-20' end_date
        PERSON   COUNT(0)
             1         11
             2         14The PERIOD view is there only to accept start and end date.
    The DAYS view contains all the days of the period
    The MYCAL view unpivotes the calendar days returning 7 rows for each person, a row per weekday
    Max
    http://oracleitalia.wordpress.com

  • Select one record per person from multiple conditions

    Perhaps been staring at this too long and making changes to try and gather the correct population, but can't seem to figure it out at the moment. Trying to determine logic to select one record per person. If person has more than one record would like to choose the record that matches the sequence priority which is:
    AND CASE WHEN ac.primary_program_ind = 'N'                                       --Existing Students who have a new program (Continuing Law and added Business)
                                   AND ac.academic_period_admitted = ac.academic_period
                                   AND ac.student_population <> 'V'
                                   AND ac.program is not null THEN 'Y'
                                WHEN ac.primary_program_ind = 'Y'                                        --Visitors (Each term considered new)
                                   AND ac.student_population = 'V'
                                   AND ac.academic_period_admitted is not null THEN 'Y'
                                WHEN ac.primary_program_ind = 'Y'                                        --Normal Cases
                                   AND ac.academic_period_admitted is not null THEN 'Y' --= ac.academic_period THEN 'Y'
                       END = 'Y' Meaning that if the person has records that meet more than one of the above cases, it should choose the record matching the First Case of the case statement. If the records do not meet the first case at all then look to see if it meets the second case and if it does choose that record, etc.
    Sample Data:
    SELECT 363 AS PERSON_UID, '1875' AS ID, '201140' AS ACADEMIC_PERIOD, '201040' AS ACADEMIC_PERIOD_ADMITTED, 'UG' AS STUDENT_LEVEL, '' AS EXIST_NEWPROG, 'Y' AS VISITORS, 'Y' AS NORMAL, 'V' AS STUDENT_POPULATION, 'Y' AS PRIMARY_PROGRAM_IND, 'LA' AS PROGRAM FROM DUAL
    UNION SELECT 852, '1962', '201130', '201040', 'GR', '', '', 'Y', 'C', 'Y', 'MS'  FROM DUAL
    UNION SELECT 852, '1962', '201140', '201140', 'GR', 'Y', '', '', 'G', 'N', 'MBA' FROM DUAL
    UNION SELECT 852, '1962', '201140', '201040', 'GR', '', '', 'Y', 'G', 'Y', 'MS' FROM DUAL
    UNION SELECT 659, '1093', '201140', '200840', 'UG', '', '', 'Y', 'T', 'Y', 'BB' FROM DUALSo for the above data on ID '1962', I would like to select the record that has EXIST_NEWPROG = 'Y' and ignore the other rows for that ID. Note:EXIST_NEWPROG, VISITORS, NORMAL I added to sample data, these cols don't actually exist. Put in for easier display purpose to show what case statements are doing. The actual sql statement has many joins and where statements, but hopefully this simplification of the sql will be sufficient to derive a solution.
    WITH MULTIROWS AS
    SELECT 363 AS PERSON_UID, '1875' AS ID, '201140' AS ACADEMIC_PERIOD, '201040' AS ACADEMIC_PERIOD_ADMITTED, 'UG' AS STUDENT_LEVEL, '' AS EXIST_NEWPROG, 'Y' AS VISITORS, 'Y' AS NORMAL, 'V' AS STUDENT_POPULATION, 'Y' AS PRIMARY_PROGRAM_IND, 'LA' AS PROGRAM FROM DUAL
    UNION SELECT 852, '1962', '201130', '201040', 'GR', '', '', 'Y', 'C', 'Y', 'MS'  FROM DUAL
    UNION SELECT 852, '1962', '201140', '201140', 'GR', 'Y', '', '', 'G', 'N', 'MBA' FROM DUAL
    UNION SELECT 852, '1962', '201140', '201040', 'GR', '', '', 'Y', 'G', 'Y', 'MS' FROM DUAL
    UNION SELECT 659, '1093', '201140', '200840', 'UG', '', '', 'Y', 'T', 'Y', 'BB' FROM DUAL
    select *
    from multirows ac
    where  CASE WHEN ac.primary_program_ind = 'N'                                       --Existing Students who have a new program (Continuing Law and added Business)
                                   AND ac.academic_period_admitted = ac.academic_period
                                   AND ac.student_population <> 'V'
                                   AND ac.program is not null THEN 'Y'
                                WHEN ac.primary_program_ind = 'Y'                                        --Visitors (Each term considered new)
                                   AND ac.student_population = 'V'
                                   AND ac.academic_period_admitted is not null THEN 'Y'
                                WHEN ac.primary_program_ind = 'Y'                                        --Normal Cases
                                   AND ac.academic_period_admitted is not null THEN 'Y' --= ac.academic_period THEN 'Y'
                       END = 'Y'

    Hi,
    user1069723 wrote:
    Thanks Frank. I've been incorporating your solution and going over the data, (which is why it has taken so long to respond) and am getting closer, however the approach you provided excludes people who have a "RNum" of 2 or 3, but do not have a 1 at all. So people that only have a 2 and 3 OR only have a 2 or only have a 3 would not be captured, but if there is only one record, they would be missed.
    Here is another set of records of one person.
    SELECT 921 AS PERSON_UID, '8284' AS ID, '201130' AS ACADEMIC_PERIOD, '201030' AS ACADEMIC_PERIOD_ADMITTED, 'UG' AS STUDENT_LEVEL, '' AS EXIST_NEWPROG, 'Y' AS VISITORS, 'Y' AS NORMAL, 'V' AS STUDENT_POPULATION, 'Y' AS PRIMARY_PROGRAM_IND, 'LA' AS PROGRAM FROM DUAL
    UNION SELECT 921, '8284', '201140', '201040', 'UG', '', '', 'Y', 'F', 'Y', 'BB'  FROM DUAL
    Sorry, I can't reproduce the problem.
    If I add the two new rows of sample data that you posted today to the data you posted yesterday, then the query I posted yesterday produces:
    PERSON_UID ID   ACADEM ACADEM ST E V N S P PRO      R_NUM
           659 1093 201140 200840 UG     Y T Y BB           1
           363 1875 201140 201040 UG   Y Y V Y LA           1
           852 1962 201140 201140 GR Y     G N MBA          1
           921 8284 201130 201030 UG   Y Y V Y LA           1Io you get the correct output for the original ids?
    If I DELETE all the rows where id != 8284 I still get the same results for id=8284.
    'm using Oracle 11.1.0.6.0. What version are you running?
    Post your exact code, even iof you think you copied it from thsi site without any changes. Perhaps there was some subtle eidting mistake.
    I would like to select the record for Academic_Period = 201140 for this person. Is the problem that you're getting the wrong row for id=8284, or that you're not getting any output for id=8284?
    Why would you want to get the row with academic_period=201140? (Let's call this row A.) Why don't you want the other row for that person, the one with academic_period=201130? (Let's call this row B.) On both of those rows, primary_program_ind='Y' and academic_period_admitted is not NULL. The only significant difference between those two rows is that student_population='F' on row A, and it's 'V' on row B. Doesn't that mean that row B causes the CASE expression to return 3 ("Normal Case"), while row B makes it return 2 ("Visitor")? Doesn't that mean row B should be preferred to row A?
    Then again, perhaps this is just what you mean by saying that "term" is the main factor in deciding which row to select, and that the CASE expreesion ("New Program" before "Visitors", followed by "Normal Cases") is just a tie-breaker.
    Based on my understanding of the code you provided, this person is being excluded altogether because they do not have a record that evaluates to rnum = 1.ROW_NUMBER never returns a value of 2 or 3 unless it has already returned a value of 1. (At least that's how it's supposed to work, and I've never heard of any bugs concerning it.)
    This record is also complicated because it has two terms, Does "term" mean "academic_period" here?
    in all cases, we would want to select the highest term and then if there is still more than one qualifying record, base the "tie breaker" on the cases. Does this make sense or is my explanation still unclear?It's unclear.
    Maybe you need to add one more line at the beginning of the analytic ORDER BY clause (the 6th line below):
    WITH     got_r_num     AS
         SELECT     m.*
         ,     ROW_NUMBER () OVER ( PARTITION BY  id
                             ORDER BY       
                                             academic_period     DESC,          -- Added
                                             CASE
                                       WHEN  primary_program_ind      = 'N'     --Existing Students who have a new program (Continuing Law and added Business)
                                                       AND   academic_period_admitted      = academic_period
                                                       AND   student_population       != 'V'
                                                       AND   program                is not null
                                            THEN 1
                                                    WHEN  primary_program_ind      = 'Y'     --Visitors (Each term considered new)
                                                       AND   student_population      = 'V'
                                                       AND   academic_period_admitted is not null
                                            THEN 2
                                                    WHEN  primary_program_ind      = 'Y'     --Normal Cases
                                                   AND   academic_period_admitted is not null
                                            THEN 3
                                             END
                           )     AS r_num
         FROM     multirows     m
    --     WHERE     ...     -- If you need any filtering, this is where it goes
    SELECT     *     -- or list all columns except r_num
    FROM     got_r_num
    WHERE     r_num     = 1
    ;

  • I recently updated to ios and moved from Mobile Me to icloud.  Now I have multiple copies of the same contacts on my phone.  How do I get them back down to one per person!

    I recently updated to Ios 5 and moved from MobileMe to the icloud.  Now I have duplicate contacts on my phone - like 8 of each person!  How do I get rid of them?  My calendar is finally in sync....

    I turned off syncing from Itunes and said yes to deleting them from the phone and now I only have one contact per person.
    It only took a few hours to get past the fear of delete
    hope this helps

  • Number of open sales notes/contracts per month

    Kindly inform are there any stanadard reports in SD for following:
    1. Number of open sales notes/contracts per month
    2. Discounts & Credit notes as % of sales
    3. Days sales outstanding report
    4. Number of bounced cheques trends and % of sales
    5. Customer information report
    6. customers segmatation categories report
    will be very thankful to you all.
    thanks
    anya

    for 1& 3 VA05 and XD03--->Sales Summary of Customer
    Regards
    Prabhu

  • Can we save the printing preference of FR reporting per report per user?

    We are using Hyperion Planning and Financial Reporting version 11.1.1.1. Some of our users will generate PDF for printing (HTML format is badly printed out).
    However can we have the option to save the printing preference of each FR report? As some reports are in portrait and some are in landscape format, it is preferred users can setup the printing preference per user per report so that they can choose the paper size and printing orientation.
    Thanks in advance!

    OK; should this be submitted to http://developer.apple.com/bugreporter/?
    I'm unsure about the best setup for this, but here is some brainstorming:
    - In Workgroup Manager or Directory, an administrator can designate a user to 'auto-accept' invitations if the user is available at that time.
    - Ideally, one would be able to establish an ACL for auto-acceptance, so that a user or admin could designate a list of users/groups from whom a user should auto-accept invites.
    - If a user is set to auto-accept, it is reasonable to assume that this user is either unable to use iCal or does not regularly check their calendar, so invites that are not auto-accepted should be handled somehow. For example, a notification could be e-mailed to the user, an invitation accept/decline message could be sent to the iCal account of a designated administrator or delegate, etc.
    I am imagining this for the case of my division, in which we have one person scheduling for lots of people, but I think that the idea of being able to delegate a person to be able to add things to one's calendar without confirmation and to confirm invites from non-privileged users would be useful in other cases as well. For example, a boss wants an administrator/secretary to be able to schedule things on his/her calendar, but does not want this person to be able to see all of the details of existing items on that calendar. I suppose that in this case it would be unclear to which calendar the designate should add the event initially, but I'm sure that for many people the privacy of the boss's calendar is more important than the inconvenience of having to create a throwaway calendar for events created by the delegate.
    If anyone has any thoughts to help refine this, please let me know and I will incorporate that into my writeup.
    Thanks,
    Greg

  • Item Category per customer per Producat

    Hi,
    I wish to define in the CRM business logic determination that will set the item category in an order (item line). The determination should be per customer per product per sales area.
    Any ideas?
    Thank you, Uri

    Dear MoazzaM,
    Using the Exit: MV45AFZZ, in Routine: USEREXIT_MOVE_FIELD_TO_VBAK, we have triggered our custom code to change the Item Category, Plant, Storage Location and Shipping Point. It is working fine at the Sales Order level.
    But we found these are partially not updated properly
    1) There is a Inconsistency in Creation of the Purchase Requisiton, where for the Individual PO, the    Storage Location remains the old one.
    2) When we create the PO from the
    2) In billing, at the item level, the plant and shipping point is also wrong which is not the source one from sales order and delivery, but the delivery details are correct
    3) In accounting doc also, the plant is wrong.
    Below is the piece of Code:
    IMPORT gv_vsbed FROM MEMORY ID 'VSBED'.
    IF gv_vsbed IS NOT INITIAL.
          SELECT SINGLE * FROM *Custom Table*
                    INTO gs_shippoint
                    WHERE auart = xvbak-auart
                    AND   vkorg = xvbak-vkorg
                    AND   vtweg = xvbak-vtweg
                    AND   spart = xvbak-spart
                    AND   vsbed = xvbak-vsbed.
    IF  gv_vsbed NE xvbak-vsbed.
          LOOP AT xvbap INTO lwa_xvbap.
            idx = sy-tabix.
            IF xvbak-vsbed IS NOT INITIAL.
              IF NOT gs_shippoint IS INITIAL AND
                 lwa_xvbap-pstyv NE gs_shippoint-pstyv.
    *** Update the Item category , plant, storage location and Shipping/Receiving point.
                lwa_xvbap-pstyv = gs_shippoint-pstyv.
                lwa_xvbap-werks = gs_shippoint-werks.
                lwa_xvbap-lgort = gs_shippoint-lgort.
                lwa_xvbap-vstel = gs_shippoint-vstel.
                MODIFY xvbap INDEX idx FROM lwa_xvbap.
                UPDATE vbap  FROM TABLE xvbap.
    Any Suggestions
    Regards,
    Kumar

  • Please note that i am seeking some assistance with adding the followng resource: A maximum of 4 resources can be added at an additional cost of $500 per day per resource.

    Hi, Please note that i am seeking some assistance with adding the following resource to a task in Microsoft Project 2010:
    A maximum of 4 resources can be added at an additional cost of $500 per day per resource.

    Hi Clemence,
    Your post has quite little details, but as far as I understand, you want to add 4 resources on a task, each resource costing 500$ a day. Since it is not mentionned if it is generic resources (skill or role) or named resources, I'll assume that it is generic
    resources. Based on this understanding, here is a proposal:
    Go to the resource sheet,
    Create a work generic resource ("type" field set to "work", "generic" field to "yes"), typing in the resource name field the skill name,
    In the max unit field, enter 400% for 4 resources (for just 4 if  your Project 2010 is configured to display units in decimals),
    Since the rate is an hourly rate, make the calculation : 500$ per day / 8 hours a day = 62,5$ per hour,
    Go back to the Gantt Chart, split the window (click "detail" in the view tab of the ribbon),
    Select your task and assign the newly created resource with a given % units.
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • Sample clock vs sample per channel per second

    Referring to this link http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/dbe7ac32661bcf9b86256ac000682154?OpenDocument
    What's the difference between sample clock and sample per channel per second? Looks the same to me.

    The sample clock is the clock that sets the timebase for channel operations on the board.  The samples per channel per second is the actual rate at which data can be transferred on a particular channel.
    Alex A.
    Applications Engineer

  • LMS 4.2 notifications per user per device

    Hello,
    my customer is looking for a notificaiton view in LMS 4.2 per user per device groups, e.g.
    user01 can only see in LMS notifications from devicegroup01
    user02 can only see in LMS notifications from devicegroup02
    Looking for you feedback !!
    Thanks,
    Cengiz

    Asking questions and answering by myself feels quite funny but I just wanted to let you guys know
    about the answer I found.
    The answer is quite easy : ) its a NO ... there is no way for alarms and notifications per user per device.
    There is a defect/enhancement open against this:
    CSCub59168    RBAC has to be created for Alarms and Faults

  • Per-device/per-user AAA authorization with Freeradius

    Hi Folks
    I'm using a Freeradius with local username database (no LDAP) for authentication.(working well)
    I have various network devices in my network, and I would like to have custom authorization per user per device :
    I would like to have 2 types of network admins, and 2 types of network devices, with the following rules :
    -"Core devices" must be granted privilege level 15 for "Core admins"
    -"Access devices" must be granted privilege level 15 for "Access admins" and "Core admins"
    -"Core devices" must be granted privilege level 1 for "Access admins".
    -There is now way "Access admins" can access to configuration mode on "Core devices" with enable command.
    Any help and config example for freeradius and cisco side are very welcome
    thanks
    olivier

    Hello Olivier,
    I would like to suggest you to go to the below link . This document describes the procedure for Per-device user authentication.
    http://wiki.freeradius.org/vendor/Cisco#Per-User-Privilege-Level
    Hope this may help you

  • Sales organization with 0SALES_CUST  in query

    Hello Guys
    I'm using infobject 0SALES_CUST in a query but i'd like to show only N° of customer and not all data about sales organization.
    Now in query it is display : LI/DS/SA01/30000010  where LI DS SA01 are sales org. and 300000010 is the customer.
    I'd like to show only the customer
    do you have any idea?
    Thanks in advance
    Boris

    Thanks Guys for the answers,
    i tried to manage compound in infoObject but i have too many errors becouse the object is already used in Infocubes and query therefore is not possible to change it.
    Probably i can change the display directly in the query but i need to fix another issue before.
    I can not update text for this infoobject 0sales_cust, i activated datasource 0CUST_SALES_TEXT created transformation and infopack but when i update text in PSA  i have red light with this message on all record:
    0CUST_SALES : Data record 670 (' ') : Duplicate data record     RSDMD     191
    For this infoObject i have already update attribute and hierarchy without any problem and now i need to update also the text
    Do u have any idea??
    Kind regards
    Boris

  • Limit on ICL per NP per satellite when using bundled ICLs

    Hi supportforum,
    (IOS XR Configuration 4.2.3)
    configuring an ICL with Bundle-Ether for nv satellite I received the following log message:
    LC/0/0/CPU0:Feb 10 04:48:01.671 : ifo_ea[201]: %PLATFORM-PLAT_ICPE_EA-3-ICL_PROVISIONING_ERROR : Nv satellite interface provisioning on Interchassis Link(ifhandle 0x8002360) failed. Limit is 1 ICL per NP per satellite when using bundled ICLs for that satellite. A different satellite can still have a member link on the same NP
    I can't find any documentation about restrictions or limits for NP configuring ICL bundle-eth.
    Are there, in fact, any limitations about NP?
    Tanks

    This restriction was lifted in 4.3.1
    Thanks,
    Sam

  • 4500 Aggregate policers and Per-Port Per-VLAN QoS

    Hello,
    I want to limit the aggregate traffic of multiple VLANs on a trunk using an aggregate policer. I also need Per-Port Per-VLAN QoS for other VLANs on the same trunk.
    To cut a long story short, will the example config below work?
    qos aggregate-policer pol_aggr_10Mbit 10m 12.5k conform-action transmit exceed-action drop
    policy-map Aggr_10Mbit
    class class-default
    police aggregate pol_aggr_10Mbit
    policy-map Limit_10M
    class class-default
    police 10m 12.5k conform-action transmit exceed-action drop
    interface GigabitEthernetx/y
    switchport trunk encapsulation dot1q
    switchport mode trunk
    ! Aggregate 10Mbit VLANs
    vlan-range 208, 316, 909
    service-policy output Aggr_10Mbit
    ! 10 Mbit VLANs
    vlan range 20, 50-100
    service-policy output Limit_10M
    Regards, Jan

    Your config looks good . Actually Per-port per-VLAN QoS (PVQoS) offers differentiated quality-of-services to individual VLANs on a trunk port. It enables service providers to rate limit individual VLAN-based services on each trunk port to a business or a residence. In an enterprise Voice-over-IP environment, it can be used to rate limit voice VLAN even if an attacker impersonates an IP phone. A per-port per-VLAN service policy can be separately applied to either ingress or egress traffic.

  • Analyzing per process, per filesystem IO

    Hi,
    Assume that by watching sar data for a certain interval I find that one device is used heavily. The next thing I would want to do is find the process generating most I/O at that time on that device.
    The thing I know how to do are:
    1) Find what process is generating I/O using lwp_ru.inblock and lwp_ru.oublock structures (as mentioned in one of the previous answers)
    2) Find how many write operations (and other parameters) were sent to an I/O device (using kstat from that device).
    How difficult would it be to link the two ? To find how much a process was writing to a certain device (say sd0 or something similar). Could this be done by tracing the write calls ? (but then, by knowing the file descriptor how can you obtain the file location).
    Just as vminfo provider complements vmstat data I would like some equivalent to complement iostat data. I realize here things could be more complicated (memory is one, devices are many, different drivers and so on).
    Is there any Sun free documentation (on docs.sun.com) describing in more detail the Solaris kernel, memory system, I/O system and so on ? DTrace makes you ask more questions about all of these.
    Thank you,
    Vlad Grama.

    G'Day,
    "Analyzing per process, per filesystem IO " reminded me of this command,
    # ./psio -f 10
         UID   PID  PPID %I/O    STIME TTY      TIME CMD
    brendan  6293  6281  2.1 06:32:50 pts/6   00:01 find /
           "     "     "  1.3  /dev/dsk/c0d0s0, /
           "     "     "  0.6  /dev/dsk/c0d0s3, /var
           "     "     "  0.2  /dev/dsk/c0d0p0
        root     3     0  0.0 12:09:33 ?       00:43 fsflush
           "     "     "  0.0  /dev/dsk/c0d0s3, /var
        root     0     0  0.0 12:09:32 ?       00:03 schedThe psio command used prex to fetch it's I/O per process data. I've just rewritten it using DTrace, it can be found on http://www.brendangregg.com/psio.html
    I've also just started writing another DTrace program that may help solve your problem. It's also on the website but is short enough to paste here. (I started programming in DTrace about 18 hours ago, expect future versions of this code to be much, much, better):
    First some example output,
    # ./iosnoop.d
      UID   PID  PPID   SIZE DEV       BLOCK   VNODE      INODE CMD
      100  6253  6183   2048 26738691  16      0              0 vi /etc/motd
      100  6253  6183   8192 26738691  336     0              0 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   8192 26738691  336     0              0 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
      100  6253  6183   1024 26738691  2582    e0bd42c0     113 vi /etc/motd
        0     3     0   2048 26738691  1952    0              0 fsflush
        0     3     0   2048 26738691  16      0              0 fsflush
        0     3     0   2048 26738688  16      0              0 fsflushAnd now the iosnoop.d program,
    #!/usr/sbin/dtrace -s
    ** iosnoop.d - A short program to print I/O events as they happen, with
    **      useful details such as UID, PID, inode, command, etc.
    **      Written in DTrace (Solaris 10).
    ** USAGE:       ./iosnoop.d
    ** 12-Mar-2004, ver 0.5. First release, check for newer versions.
    ** Standard Disclaimer: This is freeware, use at your own risk.
    ** ToDo: More details, modes of operation, process different I/O types...
    ** 12-Mar-2004  Brendan Gregg   Created this.
    #pragma D option quiet
    dtrace:::BEGIN {
            printf("%5s %5s %5s %6s %-9s %-7s %-10s %5s %s\n",
             "UID","PID","PPID","SIZE","DEV","BLOCK","VNODE","INODE","CMD");
    fbt:genunix:bdev_strategy:entry
            **  strategy, fetch and store user details
            bufp = (buf_t *)arg0;
            dev = bufp->b_edev;
            blk = bufp->_b_blkno._f;
            str_uid[dev,blk] = curpsinfo->pr_euid;
            str_pid[dev,blk] = pid;
            str_ppid[dev,blk] = curpsinfo->pr_ppid;
            str_args[dev,blk] = (char *)curpsinfo->pr_psargs;
    fbt:genunix:biodone:entry
            **  biodone, fetch all values and print
            bufp = (buf_t *)arg0;
            dev = bufp->b_edev;
            blk = bufp->_b_blkno._f;
            pagep = (page_t *)bufp->b_pages;
            vnodep = (int)pagep == 0 ? 0 : (vnode_t *)pagep->p_vnode;
            vnode =  (int)vnodep == 0 ? 0 : (int)vnodep;
            inodep = (int)vnodep == 0 ? 0 : (inode_t *)vnodep->v_data;
            inode =  (int)inodep == 0 ? 0 : inodep->i_number;
            suid = str_uid[dev,blk];
            spid = str_pid[dev,blk];
            sppid = str_ppid[dev,blk];
            sargs = str_args[dev,blk];
            printf("%5d %5d %5d %6d %-9d %-7d %-10x %5d %s\n",
             suid,spid,sppid,bufp->b_bcount,bufp->b_edev,
             bufp->_b_blkno._f,vnode,inode,stringof(sargs));
    }... Both my strategys have been to target disk block I/O events, rather than kstat or proc structures. By using these probes I can read precise timestamps event by event rather than reading a sum after the fact. It's fairly easy to dump block addresses and timestamps and then plot it in StarOffice or GNUplot - which can really illustrate the problem.
    Check for future versions of these tools, I've only just started with DTrace. (I'd better sleep now, it's 7am :)
    Brendan Gregg
    [Sydney, Australia]

Maybe you are looking for

  • BEx analyzer 7.x: How to determine first data column in result table?

    Hi, we are upgrading to 2004s where the SAPBEXqueries Sheet is not used anymore. Instead there is BExRepositorySheet. Is there a way to determine first data column in result table? Regards, Josko.

  • How can I print the date and time in a photo from iPhoto

    How can I print the date and time in a photo from iPhoto

  • Dynamic variable to get last day of month

    Hi all, I have created one report where in YTD is calculated based on stsyem date. NOw in this report the cal month is in row thus displaying data month wise. But i need one key figure which giving the last day vaue of every month that are displayed

  • Using the + symbol in XML

    Hello all, I am having a small problem with an external XML file. I can't seem to get the + symbol to work in XML files or in text files. OK, let me back up a second, I know how to use the + symbol in the text file by encoding it with %2B, but I'd li

  • Hi i need the explanation for the code below.

    public class RMIClient_CipherKey public RMIClient_CipherKey() public boolean changeKey(String s) int ai[] = new int[s.length()]; for(int i = 0; i < ai.length; i++) switch(s.charAt(i)) case 65: // 'A' ai[i] = 1; break; case 66: // 'B' ai[i] = 2; break