Skip to content

Instantly share code, notes, and snippets.

View sqlpadwan's full-sized avatar

Douglas Correa sqlpadwan

View GitHub Profile
e84fdb8f7ea293023754c9ef12a01914ea6cfc06
function Send-S3Files {
<#
.SYNOPSIS
Send the files from a local path to AWS S3
.DESCRIPTION
The function will copy all files from a specific path to AWS S3
.EXAMPLE
Send-S3Files -BucketName 'backups' -Region 'sa-east-1' -AKey '####' -SKey '####' -LocalSource 'c:\temp' , 'd:\backups'
#>
[CmdletBinding()]
-- Clear Wait Stats
-- DBCC SQLPERF('sys.dm_os_wait_stats', CLEAR);
-- Isolate top waits for server instance since last restart or statistics clear (Query 32) (Top Waits)
-- New SQL Server 2012-2014 specific version
-- QDS_PERSIST_TASK_MAIN_LOOP_SLEEP is new for SQL Server 2014
-- QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP is new for SQL Server 2014
-- WAIT_XTP_HOST_WAIT is new for SQL Server 2014
-- WAIT_XTP_OFFLINE_CKPT_NEW_LOG is new for SQL Server 2014
@sqlpadwan
sqlpadwan / buffer_descriptors.sql
Created March 11, 2018 19:59
DMV to get information about how the buffer pool is.
SELECT
OBJECT_NAME ([p].[object_id]) AS [ObjectName],
[p].[index_id],
[i].[name],
[i].[type_desc],
[au].[type_desc],
[DirtyPageCount],
[CleanPageCount],
[DirtyPageCount] * 8 / 1024 AS [DirtyPageMB],
[CleanPageCount] * 8 / 1024 AS [CleanPageMB]
@sqlpadwan
sqlpadwan / sp_AllocationMetadata.sql
Created March 11, 2018 19:55
Paul Randal procedure to see inside storage data
/*============================================================================
File: sp_AllocationMetadata.sql
Summary: This script cracks the system tables to provide top-level
metadata about a table or index
SQL Server Versions: 2005 onwards
------------------------------------------------------------------------------
Written by Paul S. Randal, SQLskills.com
@sqlpadwan
sqlpadwan / job_history.sql
Last active March 11, 2018 20:01
Getting the last 5 days job history
SELECT
name,
steps.step_name,
command,
steps.server,
database_name,
hist.run_date,
hist.run_time,
hist.run_duration,
hist.run_status,
@sqlpadwan
sqlpadwan / alerts.sql
Last active April 4, 2018 18:33
DMVs most used
-- Get SQL Server Agent Alert Information (Query 5) (SQL Server Agent Alerts)
SELECT name
, event_source
, message_id
, severity
, [enabled]
, has_notification
, delay_between_responses
, occurrence_count