Querying on Maintenance Plan's content tables

Hello,
Currently, i'm trying to know if there is any task in any maintenance plan for a specific database name on SQL Server 2008 and so on. I want to do it for doing a performance check-up of my server and of my associated website (asp.net).
I'm able to know if there is any maintenance plan and their name and associated subplans' name but i can't retrieve any details of it.
Here, a query which get a list of all Maintenance Plan on a database server :
SELECT 
   p.name                                      
as 'Maintenance Plan'
   ,isnull(p.[description],'')                
as 'Description'
   ,p.[owner]                                  
as 'Plan Owner'
   ,sp.subplan_name                        
as 'Subplan Name'
   ,sp.subplan_description              
as 'Subplan Description'
   ,j.name                                    
as 'Job Name'
   ,j.[description]                            
as 'Job Description'  
FROM msdb..sysmaintplan_plans p
   INNER JOIN msdb..sysmaintplan_subplans sp  
ON p.id = sp.plan_id
   INNER JOIN msdb..sysjobs j                  
ON sp.job_id = j.job_id
WHERE j.[enabled] = 1
Thanks for all your help.

Try this
select distinct msdb.dbo.sysmaintplan_plans.name AS PlanName ,
msdb.dbo.sysmaintplan_subplans.subplan_name AS SubplanName,
msdb.dbo.sysmaintplan_logdetail.line1 AS DetailLevel1,
msdb.dbo.sysmaintplan_logdetail.line2 AS DetailLevel2,
msdb.dbo.sysmaintplan_logdetail.line3 AS DetailLevel3,
msdb.dbo.sysmaintplan_logdetail.line4 AS DetailLevel4
from msdb.dbo.sysmaintplan_plans
left join msdb.dbo.sysmaintplan_subplans on msdb.dbo.sysmaintplan_subplans.plan_id = msdb.dbo.sysmaintplan_plans.id
left join msdb.dbo.sysmaintplan_log on msdb.dbo.sysmaintplan_log.plan_id = msdb.dbo.sysmaintplan_plans.id
left join msdb.dbo.sysmaintplan_logdetail on msdb.dbo.sysmaintplan_logdetail.task_detail_id = msdb.dbo.sysmaintplan_log.task_detail_id
Thanks
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

Similar Messages

  • Query pn maintenance plan

    Hiiiiiiii Experts,
    Need ur help.what is the diffrence between single cycle plan and strategy based plan.what should be the desicion point that what type of plan i should use.
    Regards
    Brijesh

    Hi,
    In Single cycle plan, The same activity must be executed at regular inervals (same inspection tasks at the same intervals).
    Here no tasks & intervals being changed.
    for ex: Inspection of boilers every six years, as per pressure vessel regulation.
    In Strategy plan, Maintenance work and inspections are performed in different cycles.
    We can make a list of tasks to be carried in particular equipment, and segregate those tasks in different intervals like 1 month, Quarterly, Half yearly & yearly.
    for ex: service record for a car.
    1. Check fan belt: every 12 months
    2. Change fan belt: every 24 months
    3. Check air filter: every 6 months
    4. Change Air filters: every 12 months
    thanks & regards
    kamal

  • BI content for Maintenance Plan and Maintenance Item

    Dear community,
    we use in OLTP the transaction IP06 (Maintenance Item) and IP03 (Maintenance Plan) in module PM.
    Can anyone tell me the matching BI content in BW system 7.0 to import most of those fields from ERP?
    Not only master data, also transaction data (e.g. like scheduling list).
    I've already searched help.sap.com but didn't find a matching datasource.
    Regards

    Dear Srinivas,
    I've already run a systemtrace to find out the tables:
    The following tables are involved: MPOS, MMPT, MPLA and MHIO, MHIS.
    In BI-Content I just find MPOS in the DataSource 0PM_MAINTPOS_ATTR and 0PM_MAINTPOS_TEXT. That is ok for master data.
    The other tables I couldn't find in BI-Content.
    But maybe the BI-Content does not use these tables. Maybe there is used a view which I don't see in the trace.
    Regards.

  • Query to get details from Maintenance plans

    Hi All,
    Could some one please let me know, if there is any way to check whether
    all  databases option is selected under the maintenance plan other than using GUI. Below is the print screen for reference.
    Maintenance plan includes rebuild Index, checkdb and  update statistics steps, I have to check whether the All databases option is selected for each individual task.
    I have a requirement wherein, I have to check this thing on around 5000 servers.
    It would be great if someone lets me know the script to check this setting, so that it will save my time.
    I have used below queries and tables to get the data, but they don't have the information which i'm looking for
     sysdbmaintplan_databases
    Contains one row for each database that has an associated upgraded database maintenance plan.
    sysdbmaintplan_history
        Contains one row for each upgraded database maintenance plan action performed.
    sysdbmaintplan_jobs
        Contains one row for each upgraded database maintenance plan job.
    sysdbmaintplans
        Contains one row for each upgraded database maintenance plan
        select * from sysdbmaintplan_jobs
        SELECT name,subplan_name,subplan_description
        FROM msdb.dbo.sysmaintplan_plans AS s
        INNER JOIN msdb.dbo.sysmaintplan_subplans AS sp ON sp.plan_id=s.id
        Order by name,subplan_name
     SELECT s.name AS MaintenancePlanName,
    sp.subplan_name AS SubplanName,
    subplan_description AS SubplanDescription,
    sj.name AS JobName,
    sj.enabled AS JobStatus,
    ss.name AS ScheduleName
    FROM msdb.dbo.sysmaintplan_plans AS s
    LEFT JOIN msdb.dbo.sysmaintplan_subplans AS sp ON sp.plan_id = s.id
    LEFT JOIN msdb.dbo.sysjobs AS sj ON sj.job_id = sp.job_id
    LEFT JOIN msdb.dbo.sysschedules AS ss ON sp.schedule_id = ss.schedule_id
    ORDER BY s.name,
    sp.subplan_name
    Thanks in Advance.
    Regards, Kranthi

    On a different note,  i think you can script the maintenance plan - ssis package and then insert into sysssiscatalog table and i think this will create the ssis - maintenance plan on the server. not sure ..this is just thought.... they can be compatibility
    issue.
    also, you can use the history - maintenance plans to get the data you need. but the caveat is the maintenance plan should have and history should exist and 'extended log  information' must be checked on the plan. this can be done - checking a text box
     in the plan properties.
    try this query.. i used top 1 ..so, you can try... if all databases are used in the plan..it will just show all  but if only some are used, i split that into multiple rows,(you might not need this)..there are some many other combinations possible,,
    such selecting on some tables etc...  you can query all that information from history tables, 
    try this query 
    use msdb
    go
    select top 1 @@SERVERNAME [servername],case when d.Succeeded=1 then 'Success' when d.succeeded=0 then 'Failed' End as Result,
    name,b.subplan_name,D.line1,D.line2,replace(D.line3,'Databases: ','') as [DBs],D.line4,D.line5,D.start_time,D.end_time,D.command,d.Succeeded
    into #test
    from sysmaintplan_plans a inner join sysmaintplan_subplans b on a.id=b.plan_id
    inner join sysmaintplan_log c on c.plan_id=b.plan_id and c.Subplan_id=b.subplan_id
    inner join sysmaintplan_logdetail d on d.task_detail_id=c.task_detail_id
    ORDER BY D.start_time DESC
    GO
    SELECT [ServerName],name,subplan_name,line2,
    Split.a.value('.', 'VARCHAR(100)') AS String
    FROM (SELECT [ServerName],name,subplan_name,line2,
    CAST ('<M>' + REPLACE([DBs], ',', '</M><M>') + '</M>' AS XML) AS Dbs
    FROM #test) AS A CROSS APPLY Dbs.nodes ('/M') AS Split(a);
    drop table #test
    anyways, on a side note, if you really have 5000 sql servers, you should looking at some tool or scripts to do this maintanence tasks than the builtin maintenance tasks as they provide better managebility. also, it is highly likely that you have multiple version,
    which makes it even harder to script out....
    Hope it Helps!!

  • Table name to display status for maintenance plan with active /inactive status

    i need status table which display only active/inactive status of the maintenance plan.

    really it helps me ..........
    thanks raymond 
    regards,
    priya

  • Table for maintenance plan and maintenance cycle and Unit

    Hello,
    I need to know the table where the values are stored for maintenance plan, maintenance cycle and Unit.
    I know that we can get the maintenance cycle and unit from MMPT table.
    Question 1
    If the maintenance plan has only a single cycle then the data is stored in above table MMPT, but if a maintenance plan has mutiple cycles like 1 maintenance plan has maintenance cycle as 364 Days and 1092 days then the data is not stored in MMPt table.
    Question 2
    Requirement is I need to develop a report where in I need maintenance order, maintenance plan and the relevant maintenance cycle and unit. Supose an maintenance order is created for the above maintenance plan which has 2 maintenance cycle how can I identify for which maintenance cycle the order is created.
    Regards,
    Narendra

    Hi,
    Please review PM tables
    PM/SM/SD Tables
    MPOS                       Maintenance Items
    AFAB     Network - Relationships
    PLKO     Task list
    PLAS
    AFFH     Operations
    PRT assignment data for the work order
    AFFL     Work order sequence
    AFFT     Order process instructions
    AFFV     Order process instruction values
    AFFW     Goods movements with errors from confirmations
    AFIH     Maintenance order header
    AFKO     Order header data PP orders
    AFPO     Order item
    AFRC     Table of planned changes to conf.: Automatic goods receipt
    AFRD     Default values for collective confirmation
    AFRH     Header information for confirmation pool
    AFRU     Order completion confirmations
    AFRV     Pool of confirmations
    AFVC     Operation within an order
    AFVU     DB structure of the user fields of the operation
    AFVV     DB structure of the quantities/dates/values in the operation
    MPOS     Maintenance ITEM
    AFWI     Subsequently posted goods movements for confirmations
    AUFK     Order master data
    AUFM     Goods movement for order
    MPLA     Maintenance Plans
    BGMK     Master warranty header
    BGMP     Master warranty item
    BGMS     Text item master warranty
    BGMT     Master warranty text
    BGMZ     Warranty counter information
    CRHD     Work Center Header
    CRTX     Text for the Work Center or Production Resource/Tool
    EQKT     Equipment short texts
    EQST     Equipment link to BOM
    EQUI     Equipment master data
    EQUZ     Equipment time segment
    HIKO     Order master data history
    IFLO     Functional Location (View)
    IFLOT     Functional location (TABLE)
    IFLOTX     Functional location: Short texts
    IHGNS     Plant maintenance permit segment
    IHPA     Plant Maintenance: Partners
    IHSG     Object-related permits in Plant Maintenance
    ILOA     PM object location and account assignment
    IMPTT     Measuring point (table)
    IMRG     Measurement document
    KAKO     Capacity Header Segment
    KONP     Conditions (Item)
    KONV     Conditions (Procedure Data)
    OBJK     Plant Maintenance Object List
    QMEL     Quality notification
    QMFE     Quality notification - items
    QMIH     Quality message - maintenance data excerpt
    QMMA     Quality notification - activities
    QMSM     Notification - Tasks
    QMUR     Quality notification - causes
    STPOA     Name is does not have an A at the end; BOM items
    T001     Company Codes
    T001L     Storage Locations
    T001W     Plants
    T077D     Customer account groups
    T003O     Order Types
    T352R     Maintenance revisions
    T353I_T     Maintenance activity type description
    T356     Priorities
    T357G     Permits
    T357G_T     Table 357G texts
    T370A     Activity category for PM lists
    TINCT     Customers: Incoterms: Texts
    TVKO     Organizational Unit: Sales Organizations
    TVKOS     Organizational Unit: Divisions per Sales Organization
    TVKOV     Org. Unit: Distribution Channels per Sales Organization
    TVTA     Organizational Unit: Sales Area(s)
    VIAUFKST     Order selection view
    MMPT Cycle detail
    Regards
    Carlos

  • Table for Due packages in maintenance plan

    Hi experts,
    I have one requirement in Preventive maintenance cycle.
    I want the printout of the Operations of preventive maintenance order in our own specified format.
    We have developed a new one as per our requirement. But I want to mention which package maintenance order it is in the print out.
    Ex:
    I have one maintenance plan with the task list which is having the following packages
    1M, 3M, 6M, 1Y.
    After scheduling the plan, i get one filed in the maintenance plan, scheduling call item tab, like
    Plan Date  Due Packages, this filed I want in the printout.
    I have a logic to get that in reference with the  following field as input from the maintenance order,
    Maintenance Plan
    Maintenance Item,
    Call number.
    But I am not able to find the table for the filed DUE_PACKAGES.
    Can anyone please help, how to get this field value in the printout.
    Thanks in advance.
    If any clarifications required, please revert.
    Regards,
    Praveen B

    Praveen,
    The Packages are not transferred to the order in the standard system.
    Two common work-arounds are:
    - Put the Package name in the short or long text of the task list operation
    - Put the Package name in the operation user-fields
    PeteA

  • Table name with feild Duration of Task/Frequency , Change in Duration/Frequency for maintenance plan

    hi experts,
    i need a table for maintenance plan which has field
    1) Duration of Task/Frequency
    2) Change in Duration/Frequency
    below i have elaborated my requirements.
    among those fields i have got the table name mpos,mpla,plpo except the above listed two feilds.
    i have to create a report with these requirements.
    anyone tell me in which table can i get that 6 and 7th fields.
    Requirement1:
    Maintenance Plan Number 
    Operation Code 
    Standard Teode(assigned to Plan)
    Standard Text Key description
    Cost Center
    Duration of Task/Frequency
    Change in Duration/Frequency
    Created Date
    Created By 
    Changed On 
    Changed By
    Requirement 2: layout of the report should be modifiable with the existing fields.
    Requirement 3: A transaction will be created to access the report.
    Requirement 4: In the report, Maintenance Plan number will be hyperlinked which will divert to AMP screen (display view of maintenance Plan) once clicked on it.
    Requirement 4: Report should contain all created and changed Maintenance Plan details.
    Requirement 5: Initial selection parameter for the report will be only Date. Based on the entered date, records created or changed during the duration should be picked up in the report.
    Requirement 6: Change in frequency will only be picked for single cycle plan. Strategic Plan will not be considered in case frequency change made in it.
    Requirement 7: Change By and Created By should be the complete name instead of User ID.
    regards,
    priya

    can anyone answer for my above question?
    regards,
    priya

  • Maintenance plan table

    hi
    plz any body can tell me which table showing maintenance plan deactive
    Regards
    KP..

    hi
    you cannot directly access the same ,get the object number of the maintenance plan using MPLA and pass the object no in JEST and check whether status I0320( object deactivated) is present
    regards
    thyagarajan

  • IF Auto Update Statistics ENABLED in Database Design, Why we need to Update Statistics as a maintenance plan

    Hi Experts,
    IF Auto Update Statistics ENABLED in Database Design, Why we need to Update Statistics as a maintenance plan for Daily/weekly??
    Vinai Kumar Gandla

    Hi Vikki,
    Many systems rely solely on SQL Server to update statistics automatically(AUTO UPDATE STATISTICS enabled), however, based on my research, large tables, tables with uneven data distributions, tables with ever-increasing keys and tables that have significant
    changes in distribution often require manual statistics updates as the following explanation.
    1.If a table is very big, then waiting for 20% of rows to change before SQL Server automatically updates the statistics could mean that millions of rows are modified, added or removed before it happens. Depending on the workload patterns and the data,
    this could mean the optimizer is choosing a substandard execution plans long before SQL Server reaches the threshold where it invalidates statistics for a table and starts to update them automatically. In such cases, you might consider updating statistics
    manually for those tables on a defined schedule (while leaving AUTO UPDATE STATISTICS enabled so that SQL Server continues to maintain statistics for other tables).
    2.In cases where you know data distribution in a column is "skewed", it may be necessary to update statistics manually with a full sample, or create a set of filtered statistics in order to generate query plans of good quality. Remember,
    however, that sampling with FULLSCAN can be costly for larger tables, and must be done so as not to affect production performance.
    3.It is quite common to see an ascending key, such as an IDENTITY or date/time data types, used as the leading column in an index. In such cases, the statistic for the key rarely matches the actual data, unless we update the Statistic manually after
    every insert.
    So in the case above, we could perform manual statistics updates by
    creating a maintenance plan that will run the UPDATE STATISTICS command, and update statistics on a regular schedule. For more information about the process, please refer to the article:
    https://www.simple-talk.com/sql/performance/managing-sql-server-statistics/
    Regards,
    Michelle Li

  • Maintenance Plans Execution Failure

    I'm using SQL Server 2008R and I experince the following error on every package I create and execute:
    "Executing the query "DECLARE @Guid UNIQUEIDENTIFIER      EXECUTE msdb..sp..." failed with the following error: "The INSERT statement conflicted with the FOREIGN KEY constraint "FK_sysmaintplan_log_subplan_id".
    The conflict occurred in database "msdb", table "dbo.sysmaintplan_subplans", column 'subplan_id'.  The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set
    correctly, parameters not set correctly, or connection not established correctly. "
    Do you have any experience?
    Below, the complete error messege
    Executed as user: *******. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.4000.0 for 64-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  6:37:47 AM  Error: 2014-02-01 06:37:47.81    
    Code: 0xC002F210     Source: {A77A0D78-E4F8-48DA-9933-68E53270789C} Execute SQL Task     Description: Executing the query "DECLARE @Guid UNIQUEIDENTIFIER      EXECUTE msdb..sp..." failed
    with the following error: "The INSERT statement conflicted with the FOREIGN KEY constraint "FK_sysmaintplan_log_subplan_id". The conflict occurred in database "msdb", table "dbo.sysmaintplan_subplans", column 'subplan_id'. 
    The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.  End Error  Warning: 2014-02-01
    06:37:47.81     Code: 0x80019002     Source: OnPreExecute      Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised
    (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.  End Warning  Progress: 2014-02-01 06:37:48.37    
    Source: Check Database Integrity Task      Executing query "USE [*******]  ".: 50% complete  End Progress  Progress: 2014-02-01 06:37:51.58     Source: Check Database Integrity Task     
    Executing query "DBCC CHECKDB(N'*******')  WITH NO_INFOMSGS...".: 100% complete  End Progress  Progress: 2014-02-01 06:37:51.58     Source: Check Database Integrity Task      Executing query
    "USE [*******]  ".: 50% complete  End Progress  Progress: 2014-02-01 06:37:54.19     Source: Check Database Integrity Task      Executing query "DBCC CHECKDB(N'*******')  WITH
    NO_INFOMSG...".: 100% complete  End Progress  Error: 2014-02-01 06:37:54.20     Code: 0xC0024104     Source: Check Database Integrity Task      Description: The Execute method
    on the task returned error code 0x80131501 (An exception occurred while executing a Transact-SQL statement or batch.). The Execute method must succeed, and indicate the result using an "out" parameter.  End Error  Error: 2014-02-01 06:37:54.20    
    Code: 0xC0024104     Source: {23A7637D-F19B-4BDA-BF4E-D82C1A7F3682}      Description: The Execute method on the task returned error code 0x80131501 (An exception occurred while executing a Transact-SQL statement
    or batch.). The Execute method must succeed, and indicate the result using an "out" parameter.  End Error  Warning: 2014-02-01 06:37:54.20     Code: 0x80019002     Source: OnPostExecute     
    Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified
    in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.  End Warning  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  6:37:47 AM  Finished: 6:37:54 AM  Elapsed:  6.692 seconds.  The
    package execution failed.  The step failed.
    Thank you in advance for the help.
    Martino Pavone

    Hi,
    The cause of this problem was that the job had become orphaned. We can prove this by doing the following test.
    use msdb
    go
    select * from dbo.sysjobs
    go
    sysjobs in MSDB which stores the information for each scheduled job to be executed by SQL Server Agent.
    Copy the job ID for the job that had stopped working and check in sysmaintplan_subplans for the same job ID.
    use msdb
    go
    select * from sysmaintplan_subplans where job_id = <JOBID of that job that is a part of the maintenance plan which has stopped execution>
    go
    sysmaintplan_subplans in MSDB is updated by the SQL Server which contains the information like the job id ,Plan_id ,Sub_plan name, subplan_id.
    If the job ID is present in the sysjobs but not in the sysmaintplan_subplans table then the job becomes orphaned.
    You may get an output which returns no rows and returns only the column names. Or get the below error:
    Msg 8169, Level 16, State 2, Line 1
    Conversion failed when converting from a character string to uniqueidentifier.
    To work around this problem, manually create the record of the maintenance plan that you import. See the below KB article for details:
    BUG: Error message when you try to save a maintenance plan in SQL Server Management Studio: "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)"
    http://support.microsoft.com/kb/922651
    Thanks.
    Tracy Cai
    TechNet Community Support

  • How to find maintenance plan if we knows functional location/Document No?

    Hi All,
      It is an SAP MRO related Question.
      Here i have functional location(ILOA-TPLNR) and Document Number (DRAW-DOKNR) Then how we can find corresponding maintenance plan ( MMPT-WARPL). Or Otherwise let me know the connection between these three fields interms of functional / Data base table connections.
    Thanks in Advance.

    Sorry for late reply.
    1st link (storing file hash/MD5) is not a solution for me as i have many Office documents
    2nd link doesnt have nay answers
    Archive Folder is not a solution. How can i find if current item SPFile has content changes?
    I already have my custom fields with each SPListItem. How can i find in itemUpdating/ed that if file content is changed? to make my custom field ture?
    Syed Shoaib Adil Senior SharePoint Developer Boston, Ma, USA

  • How to improve the query performance or tune query from Explain Plan

    Hi
    The following is my explain plan for sql query. (The plan is generated by Toad v9.7). How to fix the query?
    SELECT STATEMENT ALL_ROWSCost: 4,160 Bytes: 25,296 Cardinality: 204                                         
         8 NESTED LOOPS Cost: 3 Bytes: 54 Cardinality: 1                                    
              5 NESTED LOOPS Cost: 2 Bytes: 23 Cardinality: 1                               
                   2 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 13 Cardinality: 1                          
                        1 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   4 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 10 Cardinality: 1                          
                        3 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cost: 1 Cardinality: 1                     
              7 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTIES Cost: 1 Bytes: 31 Cardinality: 1                               
                   6 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Cost: 1 Cardinality: 1                          
         10 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              9 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         15 NESTED LOOPS Cost: 2 Bytes: 29 Cardinality: 1                                    
              12 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                               
                   11 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                          
              14 TABLE ACCESS BY INDEX ROWID TABLE ONT.OE_ORDER_HEADERS_ALL Cost: 1 Bytes: 17 Cardinality: 1                               
                   13 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Cardinality: 1                          
         21 FILTER                                    
              16 TABLE ACCESS FULL TABLE ONT.OE_TRANSACTION_TYPES_TL Cost: 2 Bytes: 1,127 Cardinality: 49                               
              20 NESTED LOOPS Cost: 2 Bytes: 21 Cardinality: 1                               
                   18 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                          
                        17 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   19 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Bytes: 9 Cardinality: 1                          
         23 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              22 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         45 NESTED LOOPS Cost: 4,160 Bytes: 25,296 Cardinality: 204                                    
              42 NESTED LOOPS Cost: 4,150 Bytes: 23,052 Cardinality: 204                               
                   38 NESTED LOOPS Cost: 4,140 Bytes: 19,992 Cardinality: 204                          
                        34 NESTED LOOPS Cost: 4,094 Bytes: 75,850 Cardinality: 925                     
                             30 NESTED LOOPS Cost: 3,909 Bytes: 210,843 Cardinality: 3,699                
                                  26 PARTITION LIST ALL Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18          
                                       25 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_HEADERS Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18     
                                            24 INDEX SKIP SCAN INDEX XLA.XLA_AE_HEADERS_N1 Cost: 264 Cardinality: 1,398,115 Partition #: 29 Partitions accessed #1 - #18
                                  29 PARTITION LIST ITERATOR Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32           
                                       28 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_LINES Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32      
                                            27 INDEX RANGE SCAN INDEX (UNIQUE) XLA.XLA_AE_LINES_U1 Cost: 1 Cardinality: 1 Partition #: 32
                             33 PARTITION LIST ITERATOR Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35                
                                  32 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_DISTRIBUTION_LINKS Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35           
                                       31 INDEX RANGE SCAN INDEX XLA.XLA_DISTRIBUTION_LINKS_N3 Cost: 1 Cardinality: 1 Partition #: 35      
                        37 PARTITION LIST SINGLE Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 38                     
                             36 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_EVENTS Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 39 Partitions accessed #2               
                                  35 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_EVENTS_U1 Cost: 1 Cardinality: 1 Partition #: 40 Partitions accessed #2          
                   41 PARTITION LIST SINGLE Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 41                          
                        40 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_TRANSACTION_ENTITIES Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 42 Partitions accessed #2                    
                             39 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_TRANSACTION_ENTITIES_U1 Cost: 1 Cardinality: 1 Partition #: 43 Partitions accessed #2               
              44 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 1 Bytes: 11 Cardinality: 1                               
                   43 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1

    damorgan wrote:
    Tuning is NOT about reducing the cost of i/o.
    i/o is only one of many contributors to cost and only one of many contributors to waits.
    Any time you would like to explore this further run this code:
    SELECT 1 FROM dual
    WHERE regexp_like(' ','^*[ ]*a');but not on a production box because you are going to experience an extreme tuning event with zero i/o.
    And when I say "extreme" I mean "EXTREME!"
    You've been warned.I think you just need a faster server.
    SQL> set autotrace traceonly statistics
    SQL> set timing on
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');
    no rows selected
    Elapsed: 00:00:00.00
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            243  bytes sent via SQL*Net to client
            349  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processedRepeated from an Oracle 10.2.0.x instance:
    SQL> SELECT DISTINCT SID FROM V$MYSTAT;
           SID
           310
    SQL> ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    Session altered.
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');The session is hung. Wait a little while and connect to the database using a different session:
    COLUMN STAT_NAME FORMAT A35 TRU
    SET PAGESIZE 200
    SELECT
      STAT_NAME,
      VALUE
    FROM
      V$SESS_TIME_MODEL
    WHERE
      SID=310;
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0Seems to be using a bit of time for the hard parse (hard parse elapsed time). Wait a little while, then re-execute the query:
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0The session is not reporting additional CPU usage or parse time.
    Let's check one of the session's statistics:
    SELECT
      SS.VALUE
    FROM
      V$SESSTAT SS,
      V$STATNAME SN
    WHERE
      SN.NAME='consistent gets'
      AND SN.STATISTIC#=SS.STATISTIC#
      AND SS.SID=310;
         VALUE
           163Not many consistent gets after 20+ minutes.
    Let's take a look at the plan:
    SQL> SELECT SQL_ID,CHILD_NUMBER FROM V$SQL WHERE SQL_TEXT LIKE 'select 1 from du
    al%';
    SQL_ID        CHILD_NUMBER
    04mpgrzhsv72w            0
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('04mpgrzhsv72w',0,'TYPICAL'))
    select 1 from dual where regexp_like   (' ','^*[ ]*a')
    NOTE: cannot fetch plan for SQL_ID: 04mpgrzhsv72w, CHILD_NUMBER: 0
          Please verify value of SQL_ID and CHILD_NUMBER;
          It could also be that the plan is no longer in cursor cache (check v$sql_p
    lan)No plan...
    Let's take a look at the 10053 trace file:
    Registered qb: SEL$1 0x19157f38 (PARSER)
      signature (): qb_name=SEL$1 nbfros=1 flg=0
        fro(0): flg=4 objn=258 hint_alias="DUAL"@"SEL$1"
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    CVM: Considering view merge in query block SEL$1 (#0)
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    Subquery Unnest
    SU: Considering subquery unnesting in query block SEL$1 (#0)
    Set-Join Conversion (SJC)
    SJC: Considering set-join conversion in SEL$1 (#0).
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    PM:     PM bypassed: Outer query contains no views.
    FPD: Considering simple filter push in SEL$1 (#0)
    FPD:   Current where clause predicates in SEL$1 (#0) :
              REGEXP_LIKE (' ','^*[ ]*a')
    kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
    predicates with check contraints:  REGEXP_LIKE (' ','^*[ ]*a')
    after transitive predicate generation:  REGEXP_LIKE (' ','^*[ ]*a')
    finally:  REGEXP_LIKE (' ','^*[ ]*a')
    apadrv-start: call(in-use=592, alloc=16344), compile(in-use=37448, alloc=42256)
    kkoqbc-start
                : call(in-use=592, alloc=16344), compile(in-use=38336, alloc=42256)
    kkoqbc-subheap (create addr=000000001915C238)Looks like the query never had a chance to start executing - it is still parsing after 20 minutes.
    I am not sure that this is a good example - the query either executes very fast, or never has a chance to start executing. But, it might still make your point physical I/O is not always the problem when performance problems are experienced.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Maintance jobs with Maintenance plans - troubleshooting

    Some of our old servers have maintenance jobs created with inbuilt mainteance plans. We find difficulty in troubleshooting these kind of jobs when it fails. Can anyone shed a detailed analysis of how to troubleshoot these jobs which are created with maintenance
    plan like where to look, any system table/view that could help etc. The job history gives very minimal details and often result in cropped off messages.
    I was told that if we alter the maintenace plans associated with the jobs and save it. It will break the job, is it so?

    For SQL server 2000
    You can check the failure logs either from jobs or Maintenance plan history
    In enterprise manager, expand the server group
    Expand the management folder and select the database maintenance plans
    Right click the maintenance plan that failed and select the Maintenance plan history
    Check for the failure occurred and double click the failed row to see more details or on failure
    Similarly from SQL server 2005 onwards maintenance plan history, you can check from maintenance plan
    In SSMS, connect to SQL instance
    Expand the Management folder and select the maintenance plans
    Select the maintenance plan and click on maintenance plan history and check for the failure
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • Backup Maintenance Plan on SQL AlwaysOn Availability Group Secondary Read-Only node

    I have 3 node SQL 2012 AlwaysOn Availability nodes with the 3rd node as Read-Only.
    The backup job within SQL Maintenance plan is failing with the following error:
    Failed:(-1073548784) Executing the query "declare @backupSetId as int
    select @backupSetId =..." failed with the following error: "Cannot open backup device 'C:\\SQLDBName_backup_2014_06_08_170156_9292095.bak'. Operating system error 2(The system cannot find the file specified.).
    VERIFY DATABASE is terminating abnormally.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    I have verified the SQL AlwaysOn Backup preference to be "Prefer Secondary"
    Is there any special steps/settings I need to do to setup and run the backups using maintenance plan in SQL AlwaysOn?

    Hi,
    I'm marking the reply as answer as there has been no update for a couple of days.
    If you come back to find it doesn't work for you, please reply to us and unmark the answer.
    Thanks.
    Tracy Cai
    TechNet Community Support

Maybe you are looking for

  • Adobe Photoshop Elements 11 People Recongnition

    So maybe I'm using this wrong or maybe this is just how it works.  I have about 5,000 photos, I imported them all into Photoshop Elements 11.  On the main screen, I click Add People and it starts going through all my photos,  but I seem to be getting

  • Voice Message lag after 2.02 update

    updated to 2.02, now voice messages lag...example, received a call this afternoon at 2:00, voice message notification did not show up until 6:00...sometimes the lag is longer...anyone else experience similar problems?

  • Best method to access archived data

    We are archiving off General Ledger data from JRNL_LN and JRNL_HEADER from our production system to a reporting environment. The customer wants to have a content reference that will allow them to read the archived journal data in the other environmen

  • HT4759 How do I edit my iCloud account.

    HOw do I edit my iCloud account.

  • Want to change the SQL Server Agent Job History Text Files Location

    We have SQL Server 2014 installed on a couple servers, but they were not consistent on directory paths during the installs. I am trying to get the servers to all match. On one server, SQL Server the Agent Log and Job History files were being written