Quantcast
Channel: SQL Server High Availability and Disaster Recovery forum
Viewing all articles
Browse latest Browse all 4689

check if database is READ_WRITE then running backup

$
0
0

Hi,

I have this database that is participating in an aoag and I want to have some intelligence in the backup jobs to check if the current db is the primary replica and if it is, to proceed with the backup. But I specifically want to include this section of t-sql in the overall script;

SELECT (DATABASEPROPERTYEX('database_name','Updateability'))

this will return READ_WRITE or READ_ONLY

is there any way to use this to get the job set up?


Viewing all articles
Browse latest Browse all 4689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>