Posts

Showing posts from June, 2016

Troubleshooting SQL Server log file size with AlwaysOn - Shrinking the logs

The SQL Server logs filled up my hard drive and the database stopped working! Crap!

So some backups were missed and now the log file has filled up the disk. Here is how to shrink the logs.
It's panic time, so lets get some triage done.  
Is this on a Virtual Machine? 
Can you expand the disk size to get your database running again while you figure out the rest?  You might need to go that route if everything has ground to a halt.

Backup the database and logs, shrink the log file

If you don't have your backup priority set for the primary replica/server, do that first.

1. Backup the database on the primary server
2. Backup the transaction logs on the primary.  This will truncate the logs on the primary and all secondary servers
3. Right click on the database to go "Tasks" -> "Shrink" -> "Files"
4. From the "File Type" menu, select "Log" and press OK
Only shrink the logs, you can't shrink the database while your connected to a Alway…