Check Microsoft SQL Availailbity Group database failover status

With the following script databases in an Microsoft Availability Group cluster can be checked if they are failover ready. Run this script at all the SQL nodes that are past of the Availability Group. When the statys is displayed ‘1’ the database is ready for an failover.

 

Delen via: Facebooktwittergoogle_pluspinterestlinkedinmail

Memory usage per Microsoft SQL database

The following script can be used to determine the memory usage per database:

 

 

Delen via: Facebooktwittergoogle_pluspinterestlinkedinmail

Script to backup all database Microsoft SQL node

The following script can be used to backup all databases on an Microsoft SQL node:

 

Delen via: Facebooktwittergoogle_pluspinterestlinkedinmail

Shrink all database logfiles Microsoft SQL server

Recently I ran into a problem with a specific backup vendor. Microsoft SQL was not noticed when backups occur. This caused the SQL logfiles not to auto-shrink after a backup. The logfiles of all the databases on the cluster were rapidly growing. The database were in full logging mode because the databases are mirrored between SQL nodes with SQL Availability Groups.

To make the shrinking an easy job I have written an SQL script that generates an SQL script to shrink all logfiles on a specific SQL node. The following scripts generates an output script of all shrink actions:

The script generates a script that performs these 5 actions on every logfile on the cluster:

  • Backup database
  • Backup logfile
  • Shrink logfile
  • Backup logfile
  • Shrink logfile

The output of the script can also partially be used to perform scripted shrinking on a specific database.

Delen via: Facebooktwittergoogle_pluspinterestlinkedinmail