Microsoft SQL Server DBA Scripts
- SQL Server: How to compare your objects between two Databases
- SQL Server: Script to check Network or Connect permission of User
- SQL Server: Script to find the total size of the Indexes
- SQL Server: How to find a time when was SQL Server Restarted
- SQL Server: Find Stored Procedures which use Dynamic SQL and Temporary Table
- SQL Server: Auto Generate Database Detach and Attach Scripts
- SQL Server: Script to find a list of Weekends between two Dates
- SQL Server: Script to take full backup for all the Databases
- SQL Server: Script to find the Largest Object of a Database
- SQL Server: Script to find the Size of Indexes
- SQL Server: Script to find the list of Triggers
- SQL Server: Script to check the file exists or not (Using xp_fileexist )
- SQL Server: Script to PINTABLE and UNPINTABLE (Keep data in Cache)
- SQL Server: Script to configure the Database Mail
- SQL Server 2012: Script to check the status of Distributed Always On Availability Group
- SQL Server 2012: Script to monitor Automatic Seeding of Always On Availability group
- SQL Server: Script to find the list of Startup Procedures
- SQL Server: Script to check Newly Allocated Pages to the Table
- SQL Server: Script to Drop a Table from all Databases
- SQL Server: Script to Unlock a Database User
- SQL Server: Find the Service Account Name, under SQL services are running
- SQL Server: Script to rename all Tables of a Database
- SQL Server: Script to find a list of CHECK Constraints of Database
- SQL Server: Script to find Unused Indexes of Database
- SQL Server: Script to find Database USER LOGIN Information
- SQL Server: Check the status of running Database Backup
- SQL Server: Find total number of Sessions of a Database
- SQL Server: Script to get the definition of Trace
- SQL Server: Script to check If Mirroring enable for Database
- SQL Server: Script to get the SSIS Packages of MSDB
- SQL Server 2016: sys.dm_db_column_store_row_group_physical_stats to find fragmentation of Columnstore Indexes
- SQL Server 2016: sys.dm_column_store_object_pool to find memory pool usage by Columnstore Indexes
- SQL Server 2014: sys.column_store_row_groups to find information on Columnstore row groups
- SQL Server 2016: Script to get information of Cached Functions (Total Execution Time)
- SQL Server 2014: Monitor Memory Optimized Tables which stored in Memory
- SQL Server: Script to find the Forwarded Records count of a Table
- SQL Server: Use sp_MSforeachtable to apply a T-SQL command to every table of current Database
- SQL Server: Script to find untrusted or invalid Foreign Keys
- SQL Server: Script to check the size of Query Plan Cache
- SQL Server: When DBCC DROPCLEANBUFFERS fails, script to find dirty pages from Memory
- SQL Server: Script to find SOS_SCHEDULER_YIELD wait type usage
- SQL Server: Script to check the Allocation Units of a Table
- SQL Server: Script to execute Update Statistics for all Databases
- SQL Server: Script to find Open Transaction to avoid Deadlock
- SQL Server: T-SQL Script to identify current Authentication Mode
- SQL Server: Find Log Sequence Number (LSN) from Database Backup Files
- SQL Server 2012: T-SQL script to convert a Database to Partial Contained Database
- SQL Server 2012: Script to enable Contained Database at Instance Level
- SQL Server: Execute CHECKPOINT and SHUTDOWN your Database Server immediately
- SQL Server: Script to find bad Sessions or Processes
- SQL Server: Script to find Open Connections and CPU Usage of each Client Programs
- SQL Server: Script to monitor the Corrupt Database Pages
- SQL Server 2012: List of important views to Monitor the AlwaysOn Availability Groups
- SQL Server 2012: Script to monitor Status and Health of AlwaysOn Availability Groups
- SQL Server 2016: Script to find last statement executed by a SPID using sys.dm_exec_input_buffer
- SQL Server 2012: Script to find all System Objects related to File Table
- SQL Server: Script to find Outdated Index Statistics
- SQL Server: How to find auto created Statistics Objects?
- SQL Server: sp_updatestats to update the Database Statistics
- SQL Server: Find Statisitcs Information of the Database Objects
- SQL Server: Enable Auto Create and Auto Update Statistics
- SQL Server: T-SQL Script to change Schema of all the Tables
- SQL Server: Who dropped a Table and Which Table has been dropped
- SQL Server: Script to find waiting Queries which are block by other running Queries
- SQL Server: Script to find TOP 20 most used or executed SQL Queries
- SQL Server: Script to find top 20 Stored Procedure, which are utilizing more CPU
- SQL Server: Script to grant EXECUTE stored procedure permission to a Database USER
- SQL Server: Script to find Memory Utilization for each database
- SQL Server: Script to find the CPU Information from Registry
- SQL Server: Script to find top 20 running query, which are utilizing more CPU
- SQL Server: Script to rename Database Name, Table Name, Column Name
- SQL Server: Generate Shrink Script for each Database File
- SQL Server: Script to find Memory usage and allocation
- SQL Server: Script to find Redundant and Duplicate Indexes
- SQL Server: Script to find disable foreign key tables
- SQL Server: Script to find Large Object Data Type Columns
- SQL Server: Script to find a Table which has more than 25 columns
- SQL Server: Script to find a Table which has more than 10 Indexes
- SQL Server: T-SQL Script to Rebuild all Indexes of a Database
- SQL Server: Script to find SQL Agent JOB and JOB Schedule Information
- SQL Server: Script to find all Running SQL Server Agent JOB
- SQL Server: Script to find PORT information of an Instance
- SQL Server: Script to find Databases from all the Instances
- SQL Server: Script to find last Restored Log backup file of the Secondary database in Log Shipping
- SQL Server: Script to find all Backup History Information
- SQL Server: Encrypted DDL Trigger to Track all Database Changes
- SQL Server: PowerShell Function to find System Admin Roles
- SQL Server 2012: All Database and Log backups using PowerShell
- SQL Server: Important System Tables for Alerts, SQL Jobs, Operators
- SQL Server: Important System Tables for Backup and Restore
- SQL Server: The Important Performance Counters (dm_os_performance_counters)
- SQL Server: Find the total row count and size of the Tables
- SQL Server: How to read database error log using T-SQL (xp_readerrorlog)
- SQL Server: Script to find Installation Date, time and Authentication Mode
- SQL Server: Script to find Heap Table without having an Index
- SQL Server: Script to find the status of Trace is running or not
- SQL Server: Script to change the Recovery Model of a Database
- SQL Server: Script to find Index Average Fragmentation in Percentage
- SQL Server: Script to make Database Read Only and Read Write
- SQL Server 2012: Script to find uncontained objects of a Database
- SQL Server: The TempDB is Full, Shrink it or Move it
- SQL Server 2012: Introduced dm_db_log_space_usage to find a Log size
- SQL Server: Script to check all Database Autogrowth Settings
- SQL Server: Script to find all the Tables without having a Primary Key
- SQL Server: Script to Remove Extra Spaces from a String
- SQL Server: Script to find and change Compatibility Level of Database
- SQL Server: Script to Remove Trailing Character from Number Column
- SQL Server: Script to find Identity Column of a Database
- SQL Server: Script to find Status of all Database Trigger
- SQL Server: Script to find Estimated Finish Time of The Backup Database
- SQL Server: Script to find Estimated Finish Time of The Restore Database
- SQL Server: Script to find the last Executed Query using SPID
- SQL Server: Script to find the size of Database Files and Log Files
- SQL Server: Script to List all Dynamic Management Views and Functions
- SQL Server: Script to Hide all Databases in SSMS
- SQL Server: Script to Enable and Disable XP_CMDSHELL Configuration
- SQL Server: Script to find CPU Pressure using Signal Wait Time
- SQL Server: Script to find total Row Count of All Tables in a Database
- SQL Server: Script to find Missing Indexes
- SQL Server: A Different command to check Basic Security Audit
- SQL Server: Script to find the Location of Database Backup Files
- SQL Server: Script to find all Columns information of a Database
- SQL Server: Script to find all Default values with Columns
- SQL Server: Script to find Last Backup Time for All Databases
- SQL Server: Script to find a different Server Property (Host, Instance, Edition, Version)
- SQL Server: Script to find usage of Database Indexes
- SQL Server: Script to find Index Operational Stats
- Find Free and Occupied space by SQL Server Database
- Open transactions in SQL Server
- Script to find last DDL changes in SQL Server
- Script to find Running Process and Session in SQL Server
- How to Find Foreign key References in SQL Server
- Find out most recently modified Stored Procedure and Table in SQL Server
- SQL Server CPU usage per Different Objects
- Script to Find Slowest Running Query in SQL Server
- SQL Script to find Cross Database Object Dependency in SQL Server
- SQL Script to find Object Dependency in SQL Server
- How to find any Text, Column, Comment, Object Name in SQL Server Objects
- Query to Find Missing Number and ID in SQL Server
- Insert script for all Countries

