Tech Blog – Scripts
Contents:
# SQL Server
# PowerShell
# Linux
# AWS CLI
# Redshift
SQL Server
Diagnostic
# Glenn Berry’s Diagnostic Queries
A go to resource for diagnostic queries.
Operational
# Heal Logins.
# Kill SPIDs.
# Kill All User SPIDs.
# BCP with XP_CmdShell.
# Add Primary Key Constraint.
# Move TempDB Files.
# Batch Deletions.
# Shrink DB In Chunks.
# Create Database.
# Create Table & Insert Data.
# Disable All Agent Jobs.
Data/ETL
# Selecting Dates & Times.
# Show Only The Domain Of An Email Address.
# Get Rightmost Word In Column.
# Get Row Counts By Date.
# Converting VARCHAR To DATE.
# Splitting And Grouping By Months.
# Find String in all Columns & Databases.
PowerShell
Operational
# Count Rows within a .CSV File.
# Check a Port is Open.
# Disk Management.
# Set IP Address.
# Create Windows Firewall Rule.
# Map Network Drive.
# Compress & Password Protect Files.
# Send an Email.
Linux
# General Info.
# Hardware Info.
# Performance Info.
# User & Group Management.
# Directories & File Manipulation.
AWS CLI
# List Security Groups
# List S3 Buckets
# List Cloudformation Stacks
# List IAM Users
#
# List Glue Jobs
# Delete EBS Snapshots by Date
# Copy a Local Folder to S3
# Copy a File to and from S3
# Copy a S3 Bucket to Another Region
# Delete S3 Files, Folders & Buckets
# List Sizes of all S3 Buckets
# List IAM Users & Roles by ARN
RedShift
# Show all Tables, Views & External Tables
# Show Users & Groups
# Show Running Queries
# Show Queued Queries
# Show Top Tables by Size
# Show Table Diagnostic Info
# Show Objects Owned by Users
# Show Definition of Views & Materalized Views
# Copy Command
# IAM Role Table Permissions