Category Script
ConfigurationSQL Server TempDB configuration check - TempDB is heavily used database in every instance, time to check it.
T-SQL
CPU, Datafiles, MAXDOP, Optimization, tempdb
DatabasesSQL Server Datafile auto-growth events - Looks for auto-growth events in default SQL Server trace.
T-SQL
Data sizing, Datafiles, Disk drives, Volumes
DatabasesSQL Server Set simple recovery model - Switch recovery model to SIMPLE for all databases in loop.
T-SQL
AlwaysOnSQL Server Is database part of an Availability Group? - Check databases membership in Availability Groups.
T-SQL
Availability Group, Listener, Replica
DatabasesSQL Server Set Single-User mode - Set database to SINGLE_USER mode do something and set MULTI_USER mode.
T-SQL
ALTER, MULTI_USER, SINGLE_USER
DatabasesSQL Server Set Read-Only mode - Set database to read only mode do something and set read write mode.
T-SQL
ALTER, NO_WAIT, Read-Only, Read-Write
DatabasesSQL Server Set multiple database mode - Generate script for changing mode for multiple databases.
T-SQL
IMMEDIATE, Multi-User, Read-Only, ROLLBACK
StatisticsSQL Server Update statistics for all databases - Easily update statistics with one line function.
T-SQL
Optimization, Performance, Resample, Stats
IndexesSQL Server Index usage - Check how are your indexes doing in the database.
T-SQL
b-tree, Clustered, Nonclustered, Scans, Seeks, Updates
IndexesSQL Server Index list - Get information about all existing indexes in given database.
T-SQL
Index, Optimization
DatabasesSQL Server Collect DBCC CHECKDB results - Get more more handful information about corrupted database.
T-SQL
Consistency, DBCC, Integrity, Restore
DatabasesSQL Server Search for value - You want to find some value within whole database, in all tables and columns?
T-SQL
Columns, Search, Tables
Disk drivesHost server Disk drives size - Returns information about space on disk drives used by databases in instance.
T-SQL
Disk drives, Volumes
DatabasesSQL Server Size of each database - Returns size of all databases all database files with its location and state.
T-SQL
Data sizing, Datafiles
DatabasesSQL Server Size summary - Returns summary of all data within SQL Server instance grouped by type.
T-SQL
Data sizing, Datafiles, tempdb
DatabasesSQL Server Last schema changes - Shows information about schema changes done in databases by DDL operations.
T-SQL
Datafiles, DDL, Schema changes
DatabasesSQL Server Batch database drop - You need to drop more databases quickly.
T-SQL
Cleanup, Cursor, Drop database, Remove database
AlwaysOnSQL Server Check actual replica - You want to execute script against database only if actual database is primary replica?
T-SQL
Automation, Availability Group, Replica, SQL Server
AlwaysOnSQL Server Suspend & resume data movement - Sometimes you need to reinitialize data movement in Availability Group.
T-SQL
Availability Group, Data movement, SQL Server, Synchronization
BackupDisaster recovery Backup locations - Returns list of backups created over all databases, with location, timings and size information.
T-SQL
Backup, Recovery, Restore
AlwaysOnSQL Server Connectivity issues - Return actual state of local replica connectivity to other replicas in Availability Group.
T-SQL
Availability Group, Connectivity, Replica

Unfortunately nothing found

Sorry, I couldn't find any script related to your search

I can't help you with your issue now, but if you will be successfull and want to share some script which helped you, use contact channels and your script can be there filling this empty results.

Would be nice, what do you think?

Script library is meant to be some place where you can just search and find some useful script that can help you, including description of results and more. Lets check it out!

Motivation

Every day I’m using some scripts to make life simpler, to avoid repeating actions or just to have some fun. During the years I’ve collected many scripts (most of them are T-SQL)  but kept them in one OneNote document, and frequently asked to provide them to the colleagues, students, mates and so on. So finally I decided to make them available online as some kind of library with search and filtering options.

Most scripts you can find there are collected from internet forums or books. During the years I was not collecting all the authors of the script so sorry if you find your script here without linking your page. Let me know and I will fix it immediately. Some of the script are written by me so maybe it includes longer description or maybe blog post.

If you want to add some your stuff, no problem. Just let me know you are interested and maybe we will help DBAs, developers, administrators or students to save some time in daily routines.

 

 

So just few instructions how to use this library, it was designed to be intuitive but get this help article handy only for first use, but trust me it is nothing special to work with.

Help content

Searching

The main idea is to find script you are looking for am I right? Just use search field for whatever you look for and if you are lucky table will contain some useful scripts for your problem.

Showcase of searching using main search field

 

Filtering

If you want to shorten focus of scripts listed to your problem you can use advanced filtering, what you can see there depends on actual version and maybe actually there are more filtering options than in below video guide.

Showcase of using advanced filtering

TIP: You can use shortcut to filter by category when clicking category in table, only thing that happen is to use advanced filtering and filter by clicked category – so it is only shortcut 🙂

 

Script details

Once you will find script that should fit your search you can click its name to open modal with its details divided in tabs, copy its body or open its body in new window with raw text.

Showcase of opening script details dialog

 

Script body

You can use shortcut to open just script body which you can directly copy and paste where do you need. You can go to script details directly from this dialog using details link in right bottom modal footer.

Showcase of opening script body shortcut

TIP: You can use link to open script details in separate window by clicking icon next to its name in modal header. On the separate script page, you can leave comments. I will see how it goes with comments and will bring them somewhere handy in the future if needed.

Script in separate tab shortcut icon

 

More ideas

If you have some idea how to make this library more efficient and user friendly I will be glad if you share your ideas with me and I will try to do my best to make it happen. Feel free to contact me if you have any questions or anything. Thank you for visiting.