This file contains 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 @sql varchar(max); | |
IF EXISTS (SELECT 1 FROM tempdb.sys.tables WHERE NAME='HISTOGRAM') | |
BEGIN | |
DROP TABLE tempdb.dbo.HISTOGRAM; | |
END | |
IF (SELECT CURSOR_STATUS('global','statcur')) >= -1 | |
BEGIN | |
DEALLOCATE statcur | |
END | |
IF (SELECT CURSOR_STATUS('global','histo_cur')) >= -1 |
This file contains 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 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 | |
s.session_id, | |
r.request_id, | |
DB_NAME(r.database_id) as request_database_name, | |
s.login_name, | |
r.command, | |
w.exec_context_id, | |
w.blocking_session_id, | |
w.blocking_exec_context_id, | |
s.login_time, |
This file contains 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 TABLE #results | |
( | |
DatabaseName SYSNAME , | |
VLFcount INT | |
); | |
-- Create the SQL Server 2012-compatible table. We'll drop the column if it's not 2012 | |
CREATE TABLE #stage | |
( | |
RecoveryUnitId INT , | |
FileID INT , |
This file contains 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 YOUR DATA | |
/* | |
http://meta.stackoverflow.com/questions/198915/is-there-a-direct-download-link-with-a-raw-data-dump-of-stack-overflow-not-a-t/199303#199303 | |
*/ | |
USE [stack_raw] | |
GO | |
/****** Object: Table [dbo].[Badge] Script Date: 12/20/2014 3:08:08 PM ******/ | |
SET ANSI_NULLS ON | |
GO |
This file contains 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 | |
TOP(100) | |
collection_date = GETDATE(), | |
database_name = DB_NAME(CAST(pa.dbid AS INTEGER)), | |
database_name_exec = DB_NAME(CAST(pa.dbid_execute AS INTEGER)), | |
qs.total_worker_time, | |
qs.execution_count, | |
qs.sql_handle, | |
qs.plan_handle, | |
qs.creation_time, |
This file contains 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
-- XE Definition | |
CREATE EVENT SESSION [page_splits] ON SERVER | |
ADD EVENT sqlos.wait_info( | |
ACTION (sqlos.task_time,sqlserver.sql_text,package0.collect_system_time) | |
WHERE ([sqlserver].[database_id]=(18))), | |
ADD EVENT sqlos.wait_info_external( | |
ACTION (sqlos.task_time,sqlserver.sql_text,package0.collect_system_time) | |
WHERE ([sqlserver].[database_id]=(18))), | |
ADD EVENT sqlserver.page_split( | |
ACTION(sqlos.task_time,sqlserver.sql_text,package0.collect_system_time) |
This file contains 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 @CounterPrefix NVARCHAR(30) | |
SET @CounterPrefix = CASE | |
WHEN @@SERVICENAME = 'MSSQLSERVER' | |
THEN @CounterPrefix + '' | |
ELSE 'MSSQL$'+@@SERVICENAME+':' | |
END; | |
SELECT | |
server_name = @@SERVERNAME, | |
server_instance = @@SERVICENAME, | |
object_name, |
This file contains 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
# Makefile for building PyLucene | |
# | |
# Supported operating systems: Mac OS X, Linux and Windows. | |
# See INSTALL file for requirements. | |
# See jcc/INSTALL for information about --shared. | |
# | |
# Steps to build | |
# 1. Edit the sections below as documented | |
# 2. make | |
# 3. make install |
This file contains 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 view dbo.TheView | |
AS | |
select * from linkedserver.db.dbo.TheView | |
GO |