Hi,
We have a custom scripts for doing nightly full backup and we use the following command to find the databases for which to do the backups:
select name from sys.databases where name not in ('tempdb','model') and state_desc='ONLINE' order by database_id descOR
select name from sys.databases where name not in ('tempdb','model') and state_desc='ONLINE' order by name descSomehow both of these command when run from query analyzer works but when we are running from SQL Server agent job, they miss the backup for few databases and not give any warning/error messages and then suddenly starts working for few days and the stop again and that is causing disruption in our DR strategy.
Any idea what can be the possible issue or is there any other command that we should be using
We see issue on all versions: SQL Server 2008 R2, 2014