SQL Baseline Build-knowledge preparation

Source: Internet
Author: User


    1. 1,sqldiag is a successor of PSSdiag. SQL Nexus is a tool used to load and analyze performance data collected by SQLdiag
    2. The SQLDIAG function is to collect the following information.
    • Hardware and software information for Windows Server (extracted via MSINFO32 utility)
    • Windows performance counters, event logging
    • SQL Server Profiler Tracking
    • SQL Server error logging
    • SQL Server blocking information
    • SQL Server Assignment Information
    • Custom information.
    • Available PSSDIAG graphical configuration: http://diagmanager.codeplex.com/

3,sqldiag Information

  • exists in the \program Files\Microsoft SQL Server\90\Tools\Binn Directory
  • The log files are placed under the \program Files\Microsoft SQL Server\90\tools\binn\sqldiag directory.
  • Specifies that the configuration file generates the address: Sqldiag-pc:\sqldiag, which produces the following configuration file

    • Msdiagprocs.sql: Initialization of a SQL Server instance is mostly an object created on the tempdb system library.
    • SQLDiag.Xml: Default read configuration file, provide standard data collection, including Perfmon,sqlserver error handling, setting status, etc.
    • Sd_detailed.xml: Set SQLDiag.Xml more detailed information
    • Sd_general.xml: Set SQLDiag.Xml condensed information
    • Sqldiag_schema.xsd: Used to write, modify, and validate existing XML configuration files
  • 4,sqldiag.xml configuration. In each node, Eventlogcollector: Collects system information, Perfmoncollector collects monitoring system, instances collects SQL Server information
  • The default instances event is each trace event information, and the corresponding event can be viewed in sys.trace_events.
  • The only drawback of sqldiag is that it does not periodically query system views,

    So if you add the Perfstatsscript.sql monitor script output, it's more comprehensive.
    Perfstatsscript: Description: Set up two stored procedures,
    1) sp_perf_stats09:– lists the most time-consuming requests and finds the source of the blockage, #tmp_requests: queries the current active request, task, and other basic information – #tmp_requests2: According to #tmp_requests query the current active transaction, The blocked process
    2) sp_perf_stats_infrequent09: Collects performance counters for SQL Server, such as memory management, CLR, etc. sys.dm_os_performance_counters,cpu operation, I/O conditions
    Executes SP_PERF_STATS09 every 10 minutes, sp_perf_stats_infrequent09 per hour

    Custom Execution SQL
    <customtask enabled= "true" Groupname= "BYRONSP" taskname= "Reuseplanpercentage" type= "Tsql_command" point= "Startup "Wait=" Onlyonshutdown "cmd=" exec tempdb.dbo.GetTable "/>
    Output results in:
    Sqldi\taskname_startup.out

    SQL is executed once and it's over, and if you want to do it multiple times,

    The sppollsp stored procedure is called and executed periodically.
    If object_id (' DBO.SPPOLLSP ') is not null– added to Msdiagprocs.sql
    DROP PROC DBO.SPPOLLSP
    GO
    PRINT '

    RAISERROR (' = = = = = Set Stored procedure DBO.SPPOLLSP to repeat calls to other stored procedures ', 0, 1)
    With NOWAIT
    GO

    CREATE PROC dbo.sppollsp @spName sysname, @interval char (8) = ' 00:01:00 '
    As
    DECLARE @SQL NVARCHAR (200)
    SET @SQL = ' EXEC ' [email protected] + '; WAITFOR DELAY ' + @interval + '
    While 1=1
    EXEC (@SQL)
    GO

    SQLdiag parameters
    such as: sqldiag-pc:\sqldiag/b +00:01:00/e +00:10:00/n 1/l
    The execution starts in 1 minutes and stops after 10 minutes. Continuous operation

    Run as a service until 10:19 ticks stop
    Sqldiag-p "C:\sqldiag"-e20120508_10:23:00-n2-r
    net start SQLdiag

    Unloading:
    net stop SQLdiag
    Sqldiag-u

    Log file to CSV file:
    Relog SQLDIAG. Blg-f Csv-o "C:\sqldiag\SQLDIAG_00001\a
    . csv "

    Relog sqldiag.blg-q-o counter.txt-Check Register

    /I Configuration_file
    Sets the configuration file to be used by the SQLDIAG. By default,/I is set to SQLDiag.Xml.

    /O Output_folder_path
    Redirects the SQLdiag output to the specified folder. If the/O option is not specified, the SQLDIAG output is written to a subfolder named SQLdiag under the SQLdiag Startup folder. If the SQLDIAG folder does not exist, SQLDIAG will attempt to create the folder.

    /P Support_folder_path
    Set the Support folder path. By default, the/P setting holds the folder for the SQLdiag executable file.

    /b [+]start_time
    Specify the date and time to begin collecting diagnostic data in the following format:

    Specify the date and time to begin collecting diagnostic data in the following format:

    YYYYMMDD_HH:MM:SS

    with + and without a date (using only HH:MM:SS), you can specify a time relative to the current date and time. For example, if you specify/b +02:00:00, SQLdiag will start collecting information after 2 hours.

    Do not insert a space between + and the specified start_time.

    /E [+]stop_time
    Specify the date and time to stop collecting diagnostic data in the following format:

    Using the/b +02:00:00/e +03:00:00 to specify the start time and end time, the SQLDIAG will start collecting information after 2 hours and after 3 hours of information collection stop collecting and exiting.

    /R
    Register SQLdiag as a service. Any command-line arguments that you specify when you register SQLdiag as a service are reserved for later use to run the service.

    /u
    Revoke the SQLDIAG service registration.

    /n output_folder_management_option, such as: sqldiag/n 1
    Sets whether SQLdiag overwrites or renames the output folder when it starts. The available options are:

    1 = Overwrite output folder (default)

    2 = When SQLdiag is started, the output folder is renamed to Sqldiag_00001, Sqldiag_00002, and so on. After renaming the current output folder, SQLdiag writes the output to the default output folder SQLdiag.

    /L: Continuous Operation SQLdiag

    5, the General setting outline is: Record two hours, record every 4 seconds, record a day, every 30 seconds record, record 5 days, every 180 seconds to record once, so as not to affect the system performance, and can show the system lasting changes.

  • The perfmon information to be collected is increased below perfmoncounters:

1, Memory
<perfmonobject name= "\memory" enabled= "true" >
<perfmoncounter name= "\available MBytes" enabled= "true"/>
<perfmoncounter name= "\page faults/sec" enabled= "true"/>
<perfmoncounter name= "\pages/sec" enabled= "true"/>
</PerfmonObject>
PAGES/SEC: The frequency at which the disk reads or writes, the average value should be less than 20
Available MBytes: Less than 10% of the physical intrinsic, performance impact, more than 100M is a serious performance problem
2, disk
<perfmonobject name= "\physicaldisk (*)" enabled= "true" >
<perfmoncounter name= "\% Disk Time" enabled= "true"/>
<perfmoncounter name= "\avg. Disk Queue Length" enabled= "true"/>
<perfmoncounter name= "\current Disk Queue Length" enabled= "true"/>
</PerfmonObject>
% Disk Time: The percentage of read/write operations, if the average >70%, indicating that there is a problem with the hard disk, can further query whether the memory is insufficient, when using the RAID device, this value may >100%, at this time to see PhysicalDisk: The value of the Avg.Disk Queue length counter, the lower the better.
Current Disk Queue Length: A request that is waiting for disk access, less than 2, the lower the better.
3, processor
<perfmonobject name= "\processor (*)" enabled= "true" >
<perfmoncounter name= "\% Processor Time" enabled= "true"/>
<perfmoncounter name= "\% Privileged Time" enabled= "true"/>
</PerfmonObject>
% Processor Time: Duration value should be less than 80
Privileged time: Percentage of times to execute Windows system core commands, which lasts less than 10
4, Memory file
<perfmonobject name= "\paging File (*)" enabled= "false" >
<perfmoncounter name= "\% Usage" enabled= "false"/>
</PerfmonObject>
% Usage: The ratio value is higher than 70%, indicating that memory is being added.

SQL Baseline Build-knowledge preparation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.