PowerShell script exchange
Post Reply
GarethUK
Influencer
Posts: 22
Liked: 2 times
Joined: Mar 21, 2014 11:41 am
Full Name: Gareth
Contact:

SQL Transaction Log Job Database Protection Status

Post by GarethUK »

Hi,

From a job is it possible to get the SQL Protection status for each protected database within a child SQL Transaction log backup?

I can see each SQL transaction log backup status with the following:

Code: Select all

$job.FindChildSqlLogBackupJob().FindLastSession().logger.getlog().UpdatedRecords | format-table
which gives the following:

Code: Select all

   Status OrdinalId UpdateUsn Title Description   UpdateTimeStyle ObjectStartTime Cookie
   ------ --------- --------------- -----------   --------------- --------------- ------
   ESucceeded83   165  Processing VM xx-xxdb 28/01/2016 17:14:16   ENone   28/01/2016 17:13:48   37bf86c1-5ebe-4d98-871b-9e3f997c2559

---- ETC
But how can I see the status for each database (Protect/Unprotected/Warning/Error etc)?

Regards,


Gareth
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SQL Transaction Log Job Database Protection Status

Post by veremin »

Since we communicate directly with SQL server, updating native db properties, wouldn't it better to query the databases directly, instead of finding necessary information in VB&R session logs? Each time log backup job runs, the db property named "Last Log Backup Time" gets updated. So you might just check this property on existing dbs to see whether the logs have been successfully backed up for them. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests