Showing all posts tagged: 'SQL'

A 6-post collection

Database deployment automation with DbUp

How do you manage your database deployments? You'll be surprised but this is one subject that seems to be a problem in many places I've worked. It all depends, of course, on how you run your deployments in general. So, what are the usual options? Manual - you copy all the files to your target server(s) manually and you deploy your database scripts by running them separately on each database server. Scripted - you use scripts, like PowerShell, to semi-automate your deployments by taking the steps from the manual process described above and running them in an automated way. …[read more]

Backing up SQL Server to Azure Storage account using T-SQL

One of the cool things of SQL Server 2012, is the ability to backup any database to Azure. This frees DBA’s from having to maintain tapes for offsite backups. Think of it as your Disaster Recovery on the cheap (and easy) The setup is incredibly simple and I would urge you to take advantage of this feature as soon as possible. If you don’t have an Azure account, you can get one here In order to be able to backup to Azure, you need to configure a credential to store the Windows Azure Storage authentication details. You can …[read more]

SQL Server Always On Availability Groups – Issue with preferred replica for log backups

Over the last couple of days I’ve been trying to customize Ola Hallegren’s script in order to perform backups on an Always On Availability Group running on Azure (blog to follow soon)[1]. I managed to get everything working apart from the Log Backups and the culprit was fairly easy to find. In Ola’s DatabaseBackup stored proc, there is a section of code that checks whether the specified backup type (full, diff, log) can run on the current server as per below: IF @Version >= 11 AND @Cluster IS NOT NULL BEGIN SELECT @CurrentAvailabilityGroup =, …[read more]

Configuring SQL Server Always On Availability Groups in Azure - Part 1

One of the coolest features in Azure is the fact that you can create Always On Availability Groups and configure a Listeners in order to provide high availability and redundancy to your back-end SQL Server solution. If you want to know more about AlwaysOn and what it can do for you, you can go here. Up until recently, Always On was a bit “hacky” on Azure as we had to use workarounds, especially for the Listener part, which is one of the most important feature as far as applications are concerned. However, the latest patches and updates to Windows Server …[read more]

Configure Database Mail on SQL Server Azure VM using T-SQL

Emails are an integral part for any SQL Administrator who wishes to stay on top of thins. Emails can be used to send alerts on job failures, run and report on diagnostics or return a query result set that your users may be interested in. Today we will look on how to configure SQL Server to send emails from an Azure VM. However, there is little to no difference between this configuration and an on premise SQL Server. However, Azure doesn't offer smtp servers by default so you have to use a third party provider. For this example, we will …[read more]