This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @FileName NVARCHAR(4000) | |
SELECT @FileName = | |
LEFT(target_data.value('(EventFileTarget/File/@name)[1]','nvarchar(4000)') , | |
CHARINDEX('system_health',target_data.value('(EventFileTarget/File/@name)[1]','nvarchar(4000)') )-1) + 'system_health*.xel' | |
FROM ( | |
SELECT | |
CAST(target_data AS XML) target_data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
QUOTENAME(DB_NAME(iovfs.[database_id])) [DatabaseName] | |
,iovfs.[file_id] [FileID] | |
,mf.[name] [LogicalName] | |
,mf.[type_desc] [FileType] | |
,SUM(iovfs.[num_of_bytes_read]) [Read_bytes] | |
,SUM(iovfs.[num_of_bytes_written]) [Written_bytes] | |
,SUM(iovfs.[num_of_bytes_read])/1048576 [Read_MiB] | |
,SUM(iovfs.[num_of_bytes_written])/1048576 [Written_MiB] | |
,SUM(iovfs.[num_of_reads]) [Read_Count] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
--http://jongurgul.com/blog/detailed-table-index-breakdown-buffered/ | |
This script builds on the Detailed Table and Index script to further show the buffered metrics. This script will give you a comprehensive breakdown of your tables and indexes, which is shown with schema(s),table(s),index type(s),index size(s),row count(s) as well as the filegroup(s) and partition(s) information. | |
Also in this script I have included two columns called TippingPoint* which relate to the rough bounderies where a nonclustered index is no longer selective enough. I have applied the formula to the clustered index for ease. For more detail on an indexes tipping point please see Kimberly Tripp's article. | |
http://www.sqlskills.com/BLOGS/KIMBERLY/category/The-Tipping-Point.aspx | |
*/ | |
SELECT | |
DB_NAME() [DatabaseName] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE sp_server_diag_event_parser | |
as | |
--SP_SERVER_DIAGNOSTICS Dynamic Parser for "events", v1.23 | |
--You may use this at will, you may share it provided this header remains. | |
-- Copyright 2012 Michael Bourgon | |
-- Commercial use or sale prohibited without permission. Personal, Internal Company, or Private use is fine. | |
-- If you're just running this as your job as a DBA, enjoy. | |
-- Please feel free to share, and feel free to send corrections or enhancements - thebakingdba.blogspot.com | |
-- Thanks to Marc_S on Stackoverflow for the help on parsing XML. | |
-- Thanks to Stack Overflow for forcing me to come up with a good question - so I found the flawed derived table slowdown. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************************************************************************************************************************************************************************ | |
************************************************************************************************************************************************************************************************************************************ | |
Author : Kin Shah | |
Purpose : Find Autogrowth Settings | |
Posted On : http://dba.stackexchange.com/a/82633/8783 | |
http://dba.stackexchange.com/a/53917/8783 | |
Disclaimer | |
The views expressed on my posts on this site are mine alone and do not reflect the views of my company. All posts of mine are provided "AS IS" with no warranties, and confers no rights. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************************************************************************************************************************************************************************ | |
************************************************************************************************************************************************************************************************************************************ | |
Author : Kin Shah | |
Bug Identified The incuded columns were not generated as a part of original script. | |
and Fixed : Modified the script to include the included columns. | |
Disclaimer | |
The views expressed on my posts on this site are mine alone and do not reflect the views of my company. All posts of mine are provided "AS IS" with no warranties, and confers no rights. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************************************************************************************************************************************************************************ | |
************************************************************************************************************************************************************************************************************************************ | |
Author : Kin Shah | |
Purpose : Checks weak passwords on a sql server instance using PWDCOMPARE() | |
The list of weak passwords can be updated as per your needs. | |
Below is the source of WEAK passwords : | |
-- Ref: http://security.blogoverflow.com/category/password/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- download it from http://sqlblog.com/files/folders/release/tags/who+is+active/default.aspx | |
EXEC sp_WhoIsActive | |
@filter = '', | |
@filter_type = 'session', | |
@not_filter = '', | |
@not_filter_type = 'session', | |
@show_own_spid = 0, | |
@show_system_spids = 0, | |
@show_sleeping_spids = 1, | |
@get_full_inner_text = 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- Search through tables to find specific text | |
- Written by Luis Chiriff (with help from SQL Server Central) | |
- [email protected] @ 24/11/2008 @ 11:54 | |
*/ | |
-- Variable Declaration | |
Declare @StringToFind VARCHAR(200), @Schema sysname, @Table sysname, @FullTable int, @NewMinID int, @NewMaxID int, | |
@SQLCommand VARCHAR(8000), @BaseSQLCommand varchar(8000), @Where VARCHAR(8000), @CountCheck varchar(8000) , @FieldTypes varchar(8000), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script is used to shrink a database file in | |
increments until it reaches a target free space limit. | |
Run this script in the database with the file to be shrunk. | |
1. Set @DBFileName to the name of database file to shrink. | |
2. Set @TargetFreeMB to the desired file free space in MB after shrink. | |
3. Set @ShrinkIncrementMB to the increment to shrink file by in MB | |
4. Run the script |
OlderNewer