• RML Utilities for SQL Server工具


            今天学习了一下RML Utilities工具,觉得这个工具确实比较好的跟SQL Server Profiler工具结合起来使用,确实挺好的。工具的下载地址
            SQL Server 的重播标记语言 (RML) 实用程序:https://support.microsoft.com/zh-cn/kb/944837
            RML Utilities for SQL Server (x86) –  https://www.microsoft.com/en-us/download/details.aspx?id=8161
            RML Utilities for SQL Server (x64) –  https://www.microsoft.com/en-us/download/details.aspx?id=4511

            有些机器会提示安装:Microsoft ReportViewer--https://www.microsoft.com/zh-CN/download/confirmation.aspx?id=35747



            我下载的是x64版本的,在使用该先要有个trc文件,让用用该工具进行分析trc文件,下面是操作步骤

            STEP1:生成trc文件

            开启SQL SERVER PROFILER, 对服务起进行跟踪一段时间,生成a.trc 文件,将文件放在D盘根目录下面: G:a.trc

            STEP2:打开RML Utilities Command Prompt工具
           该工具在:开始-->所有程序-->RML Utilities for SQL Server-->RML Cmd Prompt" 或者进入安装目录(我的安装目录是:C:Program FilesMicrosoft CorporationRMLUtils),打开的界面如图:
         

    STEP3:开启本地SQL server 服务
         我装的是SQL SERVER 2012, 当然也可以通过参数配置指定远程服务器,只要指定的用户有响应的权限。

    STEP4:运行导入命名     
         先要创建输出目录D: race

    1. [RML] D:\Program Files\Microsoft Corporation\RMLUtils>ReadTrace -I"G:a.trc" -o"G: race" -S"127.0.0.1RTWO2" -d"crm" -E -U"sa" -P"******"

        具体参数说明(-I:输入文件,-o:输出文件,-S:服务器,-d:数据库,-E:windows认证),下面会介绍, 输出结果如下

    [RML] D:\Program Files\Microsoft Corporation\RMLUtils>ReadTrace -I"G:a.trc" -o"G: race" -S"127.0.0.1RTWO2" -d"crm" -E -U"sa" -P"******"


    06/05/16 15:44:12.525 [0X000007A4] I/O Completion manager started
    06/05/16 15:44:12.525 [0X00001304] Attempting DOD5015 removal of [G: raceRead
    06/05/16 15:44:12.527 [0X00001304] Readtrace a SQL Server trace processing util
    Version 9.04.0051 built for x64.
    Copyright ? 1997-2014 Microsoft. All Rights Reserved
    06/05/16 15:44:12.527 [0X00001304] Computer: 127.0.0.1
    06/05/16 15:44:12.527 [0X00001304] Base Module: C:Program FilesMicro
    06/05/16 15:44:12.527 [0X00001304] Process Id: 7296
    06/05/16 15:44:12.527 [0X00001304] Active proc mask(0): 0x000000FF
    06/05/16 15:44:12.527 [0X00001304] Architecture: 9
    06/05/16 15:44:12.527 [0X00001304] Page size: 4096
    06/05/16 15:44:12.527 [0X00001304] CPUs: 8
    06/05/16 15:44:12.527 [0X00001304] Processor groups: 1
    06/05/16 15:44:12.527 [0X00001304] Highest node: 0
    06/05/16 15:44:12.528 [0X00001304] Proximity: 00 Node: 00
    06/05/16 15:44:12.528 [0X00001304] ---------------------------------------
    06/05/16 15:44:12.528 [0X00001304] Group: 0
    06/05/16 15:44:12.528 [0X00001304] ---------------------------------------
    06/05/16 15:44:12.528 [0X00001304] Processor(s): 0x00000003 Function un
    06/05/16 15:44:12.528 [0X00001304] Processor(s): 0x0000000C Function un
    06/05/16 15:44:12.528 [0X00001304] Processor(s): 0x00000030 Function un
    06/05/16 15:44:12.528 [0X00001304] Package mask: 0x000000FF
    06/05/16 15:44:12.528 [0X00001304] Processor(s): 0x000000C0 Function un
    06/05/16 15:44:12.528 [0X00001304] Processor(s): 0x000000FF assigned to
    06/05/16 15:44:12.529 [0X00001304] Current time bias: -480 minutes -8.00 hours
    06/05/16 15:44:12.529 [0X00001304] -IG:a.trc
    06/05/16 15:44:12.533 [0X00001304] -oG: race
    06/05/16 15:44:12.535 [0X00001304] -S127.0.0.1RTWO2
    06/05/16 15:44:12.541 [0X00001304] -dcrm
    06/05/16 15:44:12.544 [0X00001304] -E
    06/05/16 15:44:12.546 [0X00001304] -Usa
    06/05/16 15:44:12.549 [0X00001304] -P******
    06/05/16 15:44:12.551 [0X00001304] Using language id (LCID): 1024 [Chinese (Sim
    06/05/16 15:44:12.557 [0X00001304] Attempting to cleanup existing RML files fro
    06/05/16 15:44:12.560 [0X00001304] Using extended RowsetFastload synchronizatio
    06/05/16 15:44:12.562 [0X00001304] Establishing initial database connection
    06/05/16 15:44:12.564 [0X00001304] Server: 127.0.0.1RTWO2
    06/05/16 15:44:12.567 [0X00001304] Database: crm
    06/05/16 15:44:12.569 [0X00001304] Authentication: SQL
    06/05/16 15:44:12.604 [0X00001304] Using SQLOLEDB version 11.0.2100.60
    06/05/16 15:44:12.605 [0X00001304] Connected to SQL Server Version, Major: 10,
    06/05/16 15:44:12.606 [0X00001304] Creating or clearing the performance databas
    06/05/16 15:44:14.878 [0X00001304] Processing file: G:a.trc (
    06/05/16 15:44:14.884 [0X00001304] Validating core events exist
    06/05/16 15:44:14.886 [0X00001304] WARNING: The 'EventSequence' column for even
    06/05/16 15:44:14.888 [0X00001304] WARNING: The 'EventSequence' column for even
    06/05/16 15:44:14.891 [0X00001304] WARNING: The 'EventSequence' column for even
    06/05/16 15:44:14.894 [0X00001304] WARNING: The 'EventSequence' column for even
    06/05/16 15:44:14.898 [0X00001304] WARNING: The 'EventSequence' column for even
    06/05/16 15:44:14.902 [0X00001304] WARNING: The 'EventSequence' column for even
    06/05/16 15:44:14.904 [0X00001304] WARNING: The 'EventSequence' column is missi
    06/05/16 15:44:14.907 [0X00001304] Validating necessary events exist for analys
    06/05/16 15:44:14.910 [0X00001304] WARNING: The following trace events were not
    06/05/16 15:44:14.912 [0X00001304] WARNING: Event 10 (POST_RPC_EVENT_CLASS) doe
    06/05/16 15:44:14.915 [0X00001304] WARNING: Event 12 (POST_LANG_EVENT_CLASS) do
    06/05/16 15:44:14.917 [0X00001304] WARNING: Event 13 (PRE_LANG_EVENT_CLASS) doe
    06/05/16 15:44:14.920 [0X00001304] WARNING: The quality of the performance anal
    06/05/16 15:44:14.925 [0X00001304] Validating necessary events exist for RML br
    06/05/16 15:44:14.927 [0X00001304] WARNING: Event [Server: Server Memory Change
    06/05/16 15:44:14.930 [0X00001304] WARNING REPLAY: The following trace events w
    arnings:Attention, Transactions:SQLTransaction, Transactions:DTCTransaction, Tr
    ompleted, Transactions:TM:Save Tran starting, Transactions:TM:Save Tran complet
    replay needs. Lack of these events can lead to severe replay problems.
    06/05/16 15:44:14.934 [0X00001304] ERROR: RML output has been disabled because

    Trace flag -T28 disables the check allowing RML output processing. *** Use with
    06/05/16 15:44:15.212 [0X00001304] Events Read: 1000 Queued: 346 Processed/sec:
    06/05/16 15:44:15.215 [0X00001304] ********************************************
    06/05/16 15:44:15.215 [0X00001304] WARNING: Found [TRACE_PAUSE_EVENT] in trace
    06/05/16 15:44:15.215 [0X00001304] To process further events extract them with
    06/05/16 15:44:15.215 [0X00001304] ********************************************
    06/05/16 15:44:15.241 [0X00001304] Reads completed
    06/05/16 15:44:15.241 [0X00001304] Signaling worker threads to complete final a
    06/05/16 15:44:15.243 [0X00001304] Waiting for the worker threads to complete f
    06/05/16 15:44:15.250 [0X00001304] Performing general cleanup actions.
    06/05/16 15:44:15.250 [0X00001304] Reducing cached memory in background
    06/05/16 15:44:15.251 [0X00001304] Total Events Processed: 1088
    06/05/16 15:44:15.251 [0X00001304] Total Events Filtered: 0
    06/05/16 15:44:15.262 [0X00001304] Table ReadTrace.tblUniqueBatches: loaded ~13
    06/05/16 15:44:15.262 [0X00001304] Table ReadTrace.tblUniqueStatements: loaded
    06/05/16 15:44:15.263 [0X00001304] Table ReadTrace.tblUniquePlans: loaded ~0 ro
    06/05/16 15:44:15.265 [0X00001304] Table ReadTrace.tblUniquePlanRows: loaded ~0
    06/05/16 15:44:15.272 [0X00001304] Table ReadTrace.tblBatches: loaded ~571 rows
    06/05/16 15:44:15.273 [0X00001304] Table ReadTrace.tblStatements: loaded ~0 row
    06/05/16 15:44:15.276 [0X00001304] Table ReadTrace.tblPlans: loaded ~0 rows
    06/05/16 15:44:15.278 [0X00001304] Table ReadTrace.tblPlanRows: loaded ~0 rows
    06/05/16 15:44:15.281 [0X00001304] Table ReadTrace.tblInterestingEvents: loaded
    06/05/16 15:44:15.286 [0X00001304] Table ReadTrace.tblConnections: loaded ~336
    06/05/16 15:44:15.295 [0X00001304] WARNING: One or more warning conditions exis
    06/05/16 15:44:15.298 [0X00001304] INFO: Cleaning up unique batch hash table
    06/05/16 15:44:15.299 [0X00001304] INFO: Cleaning up unique statement hash tabl
    06/05/16 15:44:15.300 [0X00001304] INFO: Cleaning up unique plan hash table
    06/05/16 15:44:15.301 [0X00001304] INFO: Cleaning up unique procedure hash tabl
    06/05/16 15:44:15.303 [0X00001304] Indexing tables...
    06/05/16 15:44:15.937 [0X00001304] Doing post-load data cleanup...
    06/05/16 15:44:16.413 [0X00001304] Computing partial aggregates...
    06/05/16 15:44:16.826 [0X00001304] Building analysis indexes ...
    06/05/16 15:44:16.842 [0X00001304] Data load completed.
    06/05/16 15:44:16.843 [0X00001304] Using execution path: C:Program FilesMicro
    06/05/16 15:44:16.846 [0X00001304] Launching [C:Program FilesMicrosoft Corpor
    06/05/16 15:44:16.885 [0X00001304] Launch failure exit code: 259
    06/05/16 15:44:16.885 [0X00001304] Attempt to launch Reporter failed. Check th
    06/05/16 15:44:16.887 [0X00001304] ********************************************
    * ReadTrace encountered one or more ERRORS. An error condition typically *
    * stops processing early and the ReadTrace output may be unusable. *
    * Review the log file for details. *
    *******************************************************************************
    06/05/16 15:44:16.890 [0X00001304] ***** ReadTrace exit code: -23
    06/05/16 15:44:16.931 [0X00001304]
    06/05/16 15:44:16.933 [0X00001304] INFO: Cleaning up unique batch hash table
    06/05/16 15:44:16.933 [0X00001304] INFO: Cleaning up unique statement hash tabl
    06/05/16 15:44:16.934 [0X00001304] INFO: Cleaning up unique plan hash table
    06/05/16 15:44:16.935 [0X00001304] INFO: Cleaning up unique procedure hash tabl
    06/05/16 15:44:16.935 [0X00001304] INFO: Cleaning up connection info hash table


         STEP5:查看报表
         上面的第4步完成后,会自动打开Reporter应用程序


         通过报表,可以看到你的跟踪在跟踪这段时间内服务器的相关压力情况,具体每个界面就不一一截图了。

         STEP6: 本地数据库MID中增加了对象
         执行第4步的命令时,会在参数-d配置的 MID数据库中创建一些对象




    下面是ReadTrace中的一些参数说明:

    USAGE:
            NOTE: All command line arguments are case sensitive

    -- 输入文件
    -I  File name of the first .TRC or .XEL file to process [REQUIRED].  Note:  XEL
    processing is 'BETA' and limited.

    -- 文件在压缩文件内
    -i  If specified, indicates that the .TRC file(s) to process are present inside
    a CAB/ZIP/RAR file with this file name

    -- 输出文件(要全路径的),默认是当前目录
    -o  Full path of directory to place output files [default is current directory]

    --数据库服务器(生成的数据库对象保存在该服务器上),默认local
    -S  Name of SQL Server 2005 server to connect to when loading performance analys
    is data [default is (local)]

    --指定数据库(用与存放分析的数据),未指定会创建PerfAnalysis数据库
    -d  Database to use when loading performance data [default is PerfAnalysis].
        User specified below must have CREATE DATABASE permission (if DB doesn't
        exist) or be part of the db_owner role if the database already exists.

    -- 登录数据库服务器为windows授权模式
    -E  Connect to SQL using Windows Authentication [default]

    --登录数据库服务器的用户
    -U  Connect to SQL using this user name

    --登录数据库服务器的密码
    -P  Password for the user specified in -U option

    -- 禁用执行分析
    -a  Disable performance analysis

    -f  Do not produce .RML output files for each Session and Request
    -Q  Do normalization parse using quoted_identifier OFF symantics.  (Default is O
    N)
    -r# Read at most this # of files (including the first) [default is all files
        until a break in the rollover file sequence is detected].
    -M  Mirror trace events by Session to the specified output directory (All Sessio
    ns
        will be output even if Session filter is specified)
    -MF Mirror trace events by Session to the specified output directory (Only Sessi
    ons
       matching filter parameters will be output)
    -MS Mirror trace events to a single .TRC file in the specified output directory.


    -M[FS] or -M[SF] Combine mirror filtering with single .TRC file output
        *** NOTE: The mirroring option may be overwritten because the source metadat
    a information indicates such a change. ***
    -A  'INCLUDE or EXCLUDE' events with Application Names
    -C  'INCLUDE or EXCLUDE' events with Database Names when possible
    -H  'INCLUDE or EXCLUDE' events with Host Names
    -s# 'INCLUDE or EXCLUDE' events from specified Sessions
    -X# 'INCLUDE or EXCLUDE' events based on Event Class value
    -x# 'INCLUDE or EXCLUDE' events based on SubClass value
    -B### Time bias: Adjusts the start and end times, as read by (+-)### minutes.
    -b  Provide a designated start time in required format 2000-05-25 11:46:20:060
    -e  Provide a designated stop time in required format  2000-05-25 11:46:20:060
    -D  Skip date on log file output
    -L  Integer value representing the language id
    -Y  Optional scratch path used by Expander when handling compressed files.  If y
    ou processing lots of files from a nested archive this can increase performance.


    -?  Show usage of command line parameters


    EXAMPLES:
    ReadTrace -Iserver__sp_trace.trc -ic: emp races.cab -oc: empoutput -f
    ReadTrace -I"c:my traces80AllEvents.trc" -o"c:my output"
    ReadTrace -IoutputSQLSRV1__sp_trace_20.trc -ic: emppssdiag.zip -oc: emprea
    kout -f -r2
    NOTE: Command line parameters must start with hyphen or slash and must not have
    a space between the switch and parameter value.
  • 相关阅读:
    centos配置WordPress(Apache+mysql+php)
    sublime text3配置Python2、Python3的编译环境
    Python3——字典
    Python3基础——函数
    Python3基础——递归
    Python3基础——字符串类型
    activiti会签直接写死人员
    delete执行速度优化
    C盘空间满了怎么办
    python运算符
  • 原文地址:https://www.cnblogs.com/Corydon-Cao/p/5560914.html
Copyright © 2020-2023  润新知