Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

TSQL to check if a DB is the primary in log shipping

$
0
0

Hi,

 I have a server that has several DBs .. some are log shipping(ls_) and others are not. The current TRAN backup script just does a:

select name from sys.databases

where name !=  'ls_xxxx'

and name != 'ls_yyyyy'

Is there a way to check a status byte or something so I can remove the hard coded names?

select name from sys.sysdatabase

where status   =  'I log ship'  -- ;)

I checked several places, but found nothing. Finding other status like RECOVERING et al ... is easy

thanks

eric


Viewing all articles
Browse latest Browse all 5123

Trending Articles



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