HOWTO: Backing up vCenter host issues

PowerShell script exchange

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby daryanx » Sun Nov 20, 2011 11:40 pm

I am successfully running it as a scheduled task on the Veeam server every hour. I hadn't even thought about firing it on the vMotion event.... I might give it a go as I like that this is event driven
daryanx
Influencer
 
Posts: 10
Liked: never
Joined: Wed Jun 01, 2011 5:02 am
Full Name: Paul Hutton

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby smartsys » Mon Nov 21, 2011 8:25 am

To Gostev:

Please add this as a feature in the Veeam Software.
It would absolutely be a great PLUS if Veeam is able to detect the vCenter server itself and automatically update the location the VM is running.
smartsys
Influencer
 
Posts: 17
Liked: 4 times
Joined: Tue Sep 14, 2010 8:27 am
Full Name: Jeroen Leeflang

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Sun Dec 11, 2011 11:47 am

I was putting together a new version of this for v6 and noticed that my new script has issues with CBT on backups after its been ran(Replications don't seem effected) can anyone else confirm this for the old script?

Things to look out for
Next run was a full even though marked as incremental or
Cannot use CBT: Soap fault.
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Gostev » Sun Dec 11, 2011 1:03 pm

This is known issue affecting upgraded jobs, it is described in the sticky topic in main forum. It has nothing to deal with this script - will happen even if you run the job manually or on schedule. Thanks!
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Sun Dec 11, 2011 1:22 pm

Ah, Thanks for the info :)

v6 tidy up

Code: Select all
asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "vcenter01.lab.local"
$serverName = "$env:computername\VEEAM"           
$databaseName = "VeeamBackup"

$vc = Find-VBRViEntity -Name $VCVMName | ?{$_.Reference -notlike "vm-*"}
     
$conn = New-Object System.Data.SQLClient.SQLConnection
$conn.ConnectionString = "Server=$serverName;Database=$databaseName;Integrated Security=SSPI;"

$cmd = New-Object System.Data.SQLClient.SQLCommand
$cmd.Connection = $conn
$cmd.CommandText = "UPDATE [BObjects] set host_id = '$($vc.ConnHost.Id)',
object_id = '$($vc.Reference)',
path = '$($vc.Path)' WHERE object_name = '$VCVMName' AND object_id NOT LIKE 'vm%'"

try
{
   $conn.Open()
}
catch
{
   Write-Warning "Couldn't open connection"
   break
}

try
{
   $cmd.ExecuteNonQuery() | Out-Null
}
catch
{
   Write-Warning "Update failed"
}
finally
{
   $conn.Close()
}


I went back to Seths original SQL update as I timed it against the Datatable way and the difference was negligible
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Ian Cook » Tue Mar 06, 2012 4:34 pm

Hi, thanks for this it looks just the job for the issues we have been experiencing.

Im a bit new to PowerShell with Veeam, and when i run the V6 script above i get a "couldnt open connection" error, the database is SQL 2005 Express (only a small deployment) the account im running the script as is the dbo of the Veeam database, and i am running the script on the Veeam server itself, so DB and VBR6 are all on the same VM. I can run the Find-VBRViEntity command from powershell and get successful results. It looks almost like it cant connect to the SQL instance. The server is Windows 2008 R2 SP1, with all the MS updates applied. Have i missed something obvious ?

Thanks in advance for any assistance you can provide.

Ian
Ian Cook
Influencer
 
Posts: 10
Liked: never
Joined: Thu Oct 06, 2011 8:03 am
Full Name: Ian Cook

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Wed Mar 07, 2012 1:50 pm

Is your SQL server using Windows authentication?
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Ian Cook » Wed Mar 07, 2012 3:45 pm

Hi Thomas, yes it is using Windows Authentication.

Thanks

Ian
Ian Cook
Influencer
 
Posts: 10
Liked: never
Joined: Thu Oct 06, 2011 8:03 am
Full Name: Ian Cook

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Thu Mar 08, 2012 2:30 pm

I've never tested it on Win 2008 but that should cause us any issues, points of interest on the script are

Code: Select all
$serverName = "$env:computername\VEEAM"           
$databaseName = "VeeamBackup"
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Ian Cook » Thu Mar 08, 2012 4:39 pm

ThomasMc wrote:I've never tested it on Win 2008 but that should cause us any issues, points of interest on the script are

Code: Select all
$serverName = "$env:computername\VEEAM"           
$databaseName = "VeeamBackup"


Thanks Thomas, yes i had changed the values to match the computername, the database and instance are default so the rest is fine.

Ian
Ian Cook
Influencer
 
Posts: 10
Liked: never
Joined: Thu Oct 06, 2011 8:03 am
Full Name: Ian Cook

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Wed Mar 14, 2012 8:18 pm

Change
Code: Select all
try
{
   $conn.Open()
}
catch
{
   Write-Warning "Couldn't open connection"
   break
}


to
Code: Select all
try
{
   $conn.Open()
}
catch
{
   "Error: $_"
   break
}

and paste the results
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Ian Cook » Mon Mar 19, 2012 5:20 pm

Hi Thomas, sorry for the slow reply, been a bit busy this week.

Ran the updated script, and this is the output
Code: Select all
"Error: Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

I have already been through the settings to allow remote connections, as its SQL Express 2008

Thankis again for the assistance

Ian
Ian Cook
Influencer
 
Posts: 10
Liked: never
Joined: Thu Oct 06, 2011 8:03 am
Full Name: Ian Cook

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby ThomasMc » Tue Mar 20, 2012 10:58 am

Hi Ian, just so that I'm on the same page

Windows Server 2008 - OS
Veeam Server v6
SQL Express 2008 - Local DB

All on the same machine
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: HOWTO: Backing up vCenter host issues

Veeam Logoby Ian Cook » Thu Mar 29, 2012 9:46 am

Hi Thomas, really sorry for the slow responses, been busy on another project.

Yes

Windows Server 2008 R2 SP1
Veeam V6 HF3
SQL Express 2008 Local DB

Thanks

Ian
Ian Cook
Influencer
 
Posts: 10
Liked: never
Joined: Thu Oct 06, 2011 8:03 am
Full Name: Ian Cook

Workarounds for backing up vCenter SQL database

Veeam Logoby krag » Mon Apr 09, 2012 9:37 pm

[merged]

I've hit the issue in this KB article: http://www.veeam.com/kb_articles.html/KB1051. When we run VSS aware backups against our main SQL server the job fails as the VSS snapshot times out, this is because the vCenter database is on this server.

As per the KB article, if I add the IP address of the ESXi host to the backup then it works but we then lose the ability to use VMware DRS or if we manually move the VM to another host for maintenance the job will fail.

So the solution is to run the vCenter database on a separate server but then that's either SQL Express on the vcenter host itself (which is against VMware recommendations as we have over 60 VMs) or we have to pay for another SQL license which isn't cheap especially when we have a reliable production SQL cluster working fine.

Does anyone have any suggestions?
krag
Lurker
 
Posts: 1
Liked: never
Joined: Wed Mar 07, 2012 8:07 pm
Full Name: Craig Ward

PreviousNext

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests