Eitan Blumin EitanBlumin
-
Madeira Data Solutions
- Israel
- https://www.eitanblumin.com/
View Fix_ServerName_To_MachineName.sql
DECLARE @MachineName NVARCHAR(60) | |
SET @MachineName = CONVERT(nvarchar,SERVERPROPERTY('ServerName')); | |
IF @MachineName IS NULL | |
BEGIN | |
PRINT 'Could not retrieve machine name using SERVERPROPERTY!'; | |
GOTO Quit; | |
END | |
DECLARE @CurrSrv VARCHAR(MAX) |
View zendesk_set_primary_and_secondary_sla.ps1
param | |
( | |
[string] $PrimaryNinja = "Jane Doe", | |
[string] $SecondaryNinja = "John Smith" | |
) | |
$global:zendesk_user_name = "myaccount@mydomain.com/token" # The /token part is obligatory when using Zendesk's API | |
$global:zendesk_password = "put_your_zendesk_API_token_here" | |
$global:zendesk_address = "https://your_zendesk_subdomain_here.zendesk.com" | |
$global:primarySLAgroupname = "SLA Primary" |
View Find_SQL_TCP_Port.sql
USE master | |
GO | |
-- Using SQL Error Logs: | |
xp_readerrorlog 0, 1, N'Server is listening on', N'any', NULL, NULL, N'asc' | |
-- will also return records for DB Mirroring endpoints | |
-- also, this won't work if error log was cycled | |
GO | |
-- Using currently connected connections: |
View Check_SQLServerUpdates.ps1
param ( | |
[version] $BuildNumber = "9.00.5324" | |
) | |
#Run this script with -ExecutionPolicy Bypass | |
Install-Module -Name SQLServerUpdatesModule | |
Import-Module SQLServerUpdatesModule | |
$ErrorActionPreference = "SilentlyContinue" |
View zendesk_change_ticket_status.ps1
param | |
( | |
[int] $ticketid, | |
[validateset ("new","open","pending","solved","closed","delete","same")] [string] $newstatus, | |
[string] $admincomment = "" | |
) | |
# Global Zendesk Settings: | |
$global:zendesk_address = "https://yourcompany.zendesk.com" |
View DeadlockTrace_Info.sql
declare @filename nvarchar(200) | |
select @filename = convert(nvarchar(200), value) | |
from ::fn_trace_getinfo(null) | |
where property = 2 | |
and convert(nvarchar(200), value) LIKE '%deadlocks%' | |
PRINT @filename | |
select StartTime, convert(xml, TextData) AS Deadlock_Graph, ServerName |
View QueryStore_Health Extended Event Session.sql
-- Get some metadata about query_store extended events | |
/* | |
select * | |
from sys.dm_xe_object_columns | |
where object_name like '%query_store%' | |
and name not in ('UUID','VERSION','CHANNEL','KEYWORD') | |
*/ | |
/* | |
query_store_persist_on_shutdown_failed |
View Calculate Max Memory for SQL.sql
-- Max Memory Calculation | |
-- Based on Tiger Toolbox script BP_Check (Copyright Pedro Lopes) | |
DECLARE @sqlmajorver int, @systemmem int, @systemfreemem int, @maxservermem int, @numa_nodes_afinned int, @numa int | |
DECLARE @mwthreads_count int, @mwthreads int, @arch smallint, @sqlcmd nvarchar(4000) | |
DECLARE @MinMBMemoryForOS INT, @RecommendedMaxMemMB INT | |
SET @sqlmajorver = CONVERT(int, (@@microsoftversion / 0x1000000) & 0xff); | |
SET @arch = CASE WHEN @@VERSION LIKE '%<X64>%' THEN 64 WHEN @@VERSION LIKE '%<IA64>%' THEN 128 ELSE 32 END; | |
SELECT @maxservermem = CONVERT(int, [value]) FROM sys.configurations (NOLOCK) WHERE [Name] = 'max server memory (MB)'; |
View Roll_Forward_Transaction_Log_Backups.sql
DECLARE | |
@TransactionLogBackupFolder VARCHAR(4000) = 'C:\SqlDBBackupsMyDB' | |
, @FileNameQualifier VARCHAR(4000) = 'MyDB_%.trn' | |
, @DatabaseName SYSNAME = 'MyDB' | |
, @PerformRecovery BIT = 0 | |
SET NOCOUNT ON; | |
DECLARE @Output AS TABLE (Msg NVARCHAR(MAX)); | |
DECLARE @CMD VARCHAR(4000) |
View Multi_Threading_ServiceBroker_Example.sql
/* | |
=================================================== | |
Service Broker Sample 1: Parallel Querying | |
=================================================== | |
Copyright: Eitan Blumin (C) 2012 | |
Email: eitan@madeira.co.il | |
Source: www.madeira.co.il | |
Disclaimer: | |
The author is not responsible for any damage this | |
script or any of its variations may cause. |
OlderNewer