PowerShell script exchange
Post Reply
Kiranpn
Enthusiast
Posts: 27
Liked: 2 times
Joined: Mar 18, 2021 4:48 am
Full Name: Kiran Pradhan
Contact:

Not able to stop Oracle RMAN Job after stopping VMware backup

Post by Kiranpn »

Hi Team,
I am not able to stop "Oracle RMAN Backup" job after stopping "VMware backup Job" with below powershell script.

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue   # 1.Adding VeeamSnapin
Connect-VBRServer -Server "localhost"-Port "9392"                # 2.Connect Veeam Server

$OracleRMANbackup = Get-VBRPluginJob  #3.Get Oracle RMAN JOB powershell> Get-VBRPluginJob
Disable-VBRPluginJob -Job $OracleRMANbackup  #4.Disable Oracle Rman Job

Get-Vbrjob | Stop-Vbrjob                                                                            #5.Get Vmware backup job and Stop Jobs 
Start-Sleep -s 30                                                                                   #6.Wait for 30seconds
Get-Vbrjob | Disable-Vbrjob                                                                         #7.Disable all Vmware backup job 

Disconnect-VBRServer                                                         #8.Disconnect Server
Start-Sleep -s 30                                                            #9.Wait for 30seconds
Get-Service -computername ABC -Name MSSQLSERVER | Stop-Service      #10.Stop SQL Server

#This Powershell scripts stops the Veeam backup job and VeeamSql service before updating the window
#Kiran Pradhan



HOWEVER, if I run Separately below script it stops "Oracle RMAN Job"

Code: Select all

$OracleRMANbackup = Get-VBRPluginJob  #3.Get Oracle RMAN JOB powershell> Get-VBRPluginJob
Disable-VBRPluginJob -Job $OracleRMANbackup  #4.Disable Oracle Rman Job
Regards,
Kiran Pradhan
PetrM
Veeam Software
Posts: 3261
Liked: 526 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by PetrM » 1 person likes this post

Hi Kiran,

I see in your script that you disable VMware jobs after Oracle RMAN jobs but not vice versa. Anyway, could you please clarify what exactly is not working: the job remains in running state or do you see an error message? Do you encounter the issue every time when you try to stop the job or it works sometimes?

Thanks!
Kiranpn
Enthusiast
Posts: 27
Liked: 2 times
Joined: Mar 18, 2021 4:48 am
Full Name: Kiran Pradhan
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by Kiranpn »

Hi PetraM,
Thank you for the reply.
I need to stop all the jobs before doing windows update.
1.When I run full script it stops "Oracle RMAN Job" but doesn't go to next step which is to stop "Vmware Job".
2.I encounter issue each time.
3.If I run those two script (One for Oracle and another for Vmware) seperately, it stops the both job that means; there is no problem with the individual script.

I am getting this error message:

Backup job session:
Job "BCJ Production 1 2 3 & 2008 '0' of '0' bytes processed, object '0' of '0', 00:00:00 remaining, Files remaining\total: 0 B; Avg. rate:0 KB/s

Regards,
Kiran Pradhan
soncscy
Veteran
Posts: 643
Liked: 312 times
Joined: Aug 04, 2019 2:57 pm
Full Name: Harvey
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by soncscy » 3 people like this post

I think your issue is very likely that the job is still stopping.

Your script logic has a flaw in that it assumes a job for sure stops after 30 seconds, which is not guaranteed. You should instead issue the stop command as you do, then check the status in a loop with Get-VBRJob | Where-Object {$_.IsRunning -ne $false}. If anything is returned by this, then you should re-issue the wait command.

You will probably want to build a counter into it for every minute and I'd say if the job hasn't stopped after 30 minutes, the script should break there and send a message that you need manual intervention, because something is preventing the job from stopping gracefully and it needs a human decision at that point.
Kiranpn
Enthusiast
Posts: 27
Liked: 2 times
Joined: Mar 18, 2021 4:48 am
Full Name: Kiran Pradhan
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by Kiranpn »

Thank you, soncscy.
It is working but taking very long time to disable the backup copy job. It is taking more than 2 hours to disable the back up copy job.

Regards,
Kiran
PetrM
Veeam Software
Posts: 3261
Liked: 526 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by PetrM »

Hi Kiran,

Do you see the same problem if you disable the job not from the script, for example manually? If this is the case, I'd suggest to open a support request.

Thanks!
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by oleg.feoktistov »

Kiran,

If you cannot reproduce this problem through the UI, like Petr suggested, please post your entire script here so that we could take a look.

Thanks,
Oleg
Kiranpn
Enthusiast
Posts: 27
Liked: 2 times
Joined: Mar 18, 2021 4:48 am
Full Name: Kiran Pradhan
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by Kiranpn »

Hi Oleg, Petrm
I can disable manually and my script stops them as well but it is just taking more than 2 hours to stop the job.
We are trying to stop and disable all jobs before we are doing our regular windows update.
Currently, we are doing everything manually, we are trying to stop Veeam with the script so it can be automated before doing Windows update.

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue   # 1.Adding VeeamSnapin
Connect-VBRServer -Server "localhost"-Port "9392"                # 2.Connect Veeam Server

Get-Vbrjob | Stop-Vbrjob -RunAsync                                                                           #5.Get Vmware backup job and Stop Jobs 
Start-Sleep -s 30                                                                                   #6.Wait for 30seconds
Get-Vbrjob | Disable-Vbrjob                                                                         #7.Disable all Vmware backup job 


Disconnect-VBRServer                                                         #8.Disconnect Server
Start-Sleep -s 30                                                            #9.Wait for 30seconds
Get-Service -computername VEEAMBKPSQL -Name MSSQLSERVER | Stop-Service      #10.Stop SQL Server
                                                                          
#This Powershell scripts stops the Veeam backup job and VeeamSql service before updating the window  
#Kiran Pradhan
PetrM
Veeam Software
Posts: 3261
Liked: 526 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by PetrM »

Hi Kiran,

Does it take more than 2 hours to stop all jobs or just a specific one? And mind me asking whether there is an option to reschedule Windows updates so that to install them out of backup window, when there are no jobs running per schedule?

Thanks!
Kiranpn
Enthusiast
Posts: 27
Liked: 2 times
Joined: Mar 18, 2021 4:48 am
Full Name: Kiran Pradhan
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by Kiranpn »

Thank you PeterM, it is just taking more than 2 hours to stop a few specific backup copy job.

Regards,
Kiran
PetrM
Veeam Software
Posts: 3261
Liked: 526 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by PetrM »

Hi Kiran,

Well, let's try to understand why does stop of backup copy job take more than 2 hours, please open a support request and share case ID with us.

Nevertheless, I'd appreciate it if you had time to review another question above: is there an option to reschedule Windows updates so that to install them out of backup window, when there are no jobs running per schedule?

Thanks!
Kiranpn
Enthusiast
Posts: 27
Liked: 2 times
Joined: Mar 18, 2021 4:48 am
Full Name: Kiran Pradhan
Contact:

Re: Not able to stop Oracle RMAN Job after stopping VMware backup

Post by Kiranpn » 1 person likes this post

Thank you PetrM,
We have decided to reschedule the backupcopy job and disabled during windows patching time. So, we don't need to stop it through powershell script.

Regards,
Kiran Pradhan
Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests