Comprehensive data protection for all workloads
Post Reply
Lion Kim
Novice
Posts: 3
Liked: 1 time
Joined: Jun 05, 2020 1:55 am
Full Name: KIM DONG-KYU
Contact:

[Share Information] Veeam Surebackup Custom Script

Post by Lion Kim » 1 person likes this post

Dear Tim.
I'm a Git Lion. (Beam Partner)

I will share how to validate Oracle services in Surebackup feature.
(I looked for a way to run the script on the validation VM, but couldn't find it.)

Here is the scenario of the problem I encountered:
1. A target showing symptoms of disk (superblock) corruption was backed up within a VM (VMware) in the customer hypervisor environment.
2. This issue was identified when performing a recovery.
3. Recovery through disk forensics (contact recovery company)

[Test Lab Configuration]
1. Oracle Server Backup
2. Surebackup Configuration(Guide reference)
> https://helpcenter.veeam.com/docs/backu ... ml?ver=120
3. Surebackup Application Configuration
1) test VM select -> Edit
2) Test Scripts Tab select -> add
3) Use the following test script select
a) Name : custom naming
b) Path : bottom powershell code file select
c) arguments : -ip %vm_ip% -fexist "/veeam/oracle_start.sh" // example
"-fexist path = file in Source VM"

(Please understand the code that is not optimized.)

Code: Select all

###/veeam/oracle_start.sh###
#!/bin/bash
su - oracle << EOF
sqlplus "/as sysdba" << SQL
startup;
exit
SQL
lsnrctl start
EOF
######################

Code: Select all

===This is a Powershell script that will run on the VEEAM server after configuring SureBackup.===
<#
accepts certifs automatically
#>
param(
$fexist = "/veeam/oracle_start.sh",
$plink = "C:\Program Files\Veeam\Backup and Replication\Backup\Putty\plink.exe",
#test lab vm information
$ip = "192.168.0.5",
$username = "root",
$password = "veeam"
)

write-host "Running $fexist @ $ip"
$argplink = @("-v", $ip, "-l", $username, "-pw", $password, "bash /veeam/oracle_start.sh")

$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $plink
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.RedirectStandardInput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = $argplink

$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$p.StandardInput.Write("yes")
$p.WaitForExit()

$stdout = $p.StandardOutput.ReadToEnd()
$stderr = $p.StandardError.ReadToEnd()

if($stdout) {
    write-host ("Output: {0}" -f $stdout.trim())
    exit 0
} else {
    write-host "No output returned or something went wrong... dumping $stderr"
    $stderr >> c:\bin\log.txt
    exit 1
}
===============================================
Thanks for reading.
Mildur
Product Manager
Posts: 8735
Liked: 2296 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: [Share Information] Veeam Surebackup Custom Script

Post by Mildur » 1 person likes this post

Hi Kim

Thanks for sharing. If you like, you may also share it in our community or on VeeamHub:
Community: https://community.veeam.com/script-library-67
VeeamHub: https://github.com/VeeamHub/powershell

Best,
Fabian
Product Management Analyst @ Veeam Software
Lion Kim
Novice
Posts: 3
Liked: 1 time
Joined: Jun 05, 2020 1:55 am
Full Name: KIM DONG-KYU
Contact:

Re: [Share Information] Veeam Surebackup Custom Script

Post by Lion Kim »

Dear Fabian.

Good day.

To reflect your request, we have uploaded it to Git as shown below.
https://github.com/VeeamHub/powershell/pulls
(I don't really use Git, so I'm not sure if it's right to request this.)

Thank you.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 104 guests