-
- Novice
- Posts: 3
- Liked: never
- Joined: May 02, 2017 7:54 am
- Full Name: Rasmus Bertelsen
- Contact:
Running SQL jobs
from powershell i want to monitor running sql jobs.
From findchildsqllogbackupjob i can get the findlastsession().sessioninfo
But as i see it, it shows failures and warnings on the last session, which is not the running log job?
is there a way to monitor warnings and failures in the current running sql log job ?
From findchildsqllogbackupjob i can get the findlastsession().sessioninfo
But as i see it, it shows failures and warnings on the last session, which is not the running log job?
is there a way to monitor warnings and failures in the current running sql log job ?
-
- Product Manager
- Posts: 20397
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Running SQL jobs
If you want to catch errors within running SQL log backup job session, you will need to parse task sessions, using code similar to the following:
Thanks.
Code: Select all
Asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of backup job"
$LastSession = $job.FindChildSqlLogBackupJob().FindLastSession()
$LastSession.GetTaskSessions().logger.getlog().UpdatedRecords | where {$_.Status -eq "EFailed"} | sort starttime | select starttime, title
-
- Novice
- Posts: 3
- Liked: never
- Joined: May 02, 2017 7:54 am
- Full Name: Rasmus Bertelsen
- Contact:
Re: Running SQL jobs
It's not working as intended.
I have a SQL job with a error, which im able to read out.
But i have another job with a warning, and it just shows ENone or ESucceeded - so something isn't working.
I have a SQL job with a error, which im able to read out.
But i have another job with a warning, and it just shows ENone or ESucceeded - so something isn't working.
-
- Product Manager
- Posts: 20397
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Running SQL jobs
Can you elaborate on what you're trying to achieve?
Based on the description provided:
- There is a running SQL Transaction log backup job
- There are different errors and warnings in current task session statistics window
- The SQL Transaction log backup job doesn't have a final result, as it's still running
- Therefore, you want to catch errors and warning from task sessions statistics window
Right?
Based on the description provided:
- There is a running SQL Transaction log backup job
- There are different errors and warnings in current task session statistics window
- The SQL Transaction log backup job doesn't have a final result, as it's still running
- Therefore, you want to catch errors and warning from task sessions statistics window
Right?
-
- Novice
- Posts: 3
- Liked: never
- Joined: May 02, 2017 7:54 am
- Full Name: Rasmus Bertelsen
- Contact:
Re: Running SQL jobs
Yes 100% correct
-
- Product Manager
- Posts: 20397
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Running SQL jobs
Then, you should leverage the script provided above and modify code slightly in case it does not meet your requirements.
This is what script does:
- Takes the latest SQL transaction log backup session
- Parses its task sessions to find entities having Failed state
- Outputs those sessions titles along with creation times
If you think that some session get output wrongly, remove "where" and "select" code sections, get a list of all sessions and see what filter you can use to meet your requirements.
Thanks.
This is what script does:
- Takes the latest SQL transaction log backup session
- Parses its task sessions to find entities having Failed state
- Outputs those sessions titles along with creation times
If you think that some session get output wrongly, remove "where" and "select" code sections, get a list of all sessions and see what filter you can use to meet your requirements.
Thanks.
Who is online
Users browsing this forum: No registered users and 11 guests