PowerShell script exchange
fcastro
Novice
Posts: 8
Liked: never
Joined: Apr 05, 2012 10:52 am
Full Name: Fausto Castro
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by fcastro » Jul 18, 2012 5:33 pm

i have 2: one for vcenter and another for host
they differ on Path, Id, VmFolderName and Reference (host doesn't start by vm, it is only a number)
if this is the issue i believe you already addressed this earlier. if so can you please provide script or steps on management studio for sqlexpress2008 r2 to have the fix.

thanks

fcastro
Novice
Posts: 8
Liked: never
Joined: Apr 05, 2012 10:52 am
Full Name: Fausto Castro
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by fcastro » Jul 19, 2012 10:29 am

removed through sql the esxi hosts and with only the vcenter in the dbo.BObjects it gives the same error:

GUID:

Lines Words Characters Property
----- ----- ---------- --------
0
Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "Conversion fa
iled when converting from a character string to uniqueidentifier."

regards

murda
Enthusiast
Posts: 38
Liked: never
Joined: Dec 18, 2009 10:05 am
Full Name: murda
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by murda » Jul 19, 2012 2:45 pm

This is my code and when I launch this from the Veeam Powershell I get the following reply.

Code: Select all

asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "TLOVC01.pce.local"
$serverName = "TLOSQL2\Veeam"            
$databaseName = "Veeam"

$vc = Find-VBRViEntity -Name $VCVMName | ?{($_.Reference -notlike "vm-*") -AND ($null -ne $_.Reference)}
      
$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
{
$cmd.ExecuteNonQuery() | Out-Null
}
catch
{
   "GUID: $($vc.Reference)"
   $vc.Reference | Measure-Object -Character
   "Error: $_"
   break
}
finally
{
$conn.Close()
}
GUID:

Lines Words Characters Property
----- ----- ---------- --------
0
Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "ExecuteNonQue
ry requires an open and available Connection. The connection's current state is
closed."

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Jul 19, 2012 6:51 pm

The above code won't work because you never opened the connection to the SQL server, use the original code and make the small edit I mentioned above and report back: http://forums.veeam.com/viewtopic.php?f ... =15#p41616

fcastro
Novice
Posts: 8
Liked: never
Joined: Apr 05, 2012 10:52 am
Full Name: Fausto Castro
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by fcastro » Jul 20, 2012 8:04 am

(info)
Thomas, sent private message of solicited info.

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Jul 20, 2012 4:07 pm

I've been playing around with the script all day and think I know what the problem is, if you could run this one for me and report the error in full

Code: Select all


Add-PSSnapin -Name "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "vc01.vpowercli.local"
#$VCJobName = "VC Backup"
$serverName = "$env:computername\VEEAM"            
$databaseName = "VeeamBackup01"

#$cvc = Get-VBRJob -Name $VCJobName | Get-VBRJobObject -Name $VCVMName
$vc = Find-VBRViEntity -Name $VCVMName | ?{($_.Reference -notlike "vm-*") -AND ($null -ne $_.Reference)}
      
$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%'"

#if ($cvc.Location -eq $vc.Path) {
#	"The VM hasn't moved" | Out-Default
#	Sleep 15
#	Exit
#}

try 
{
   $conn.Open()
}
catch
{
   Write-Warning "ERROR: $_"
}

if ($conn.State -eq "Open") { 
	try
	{
	   $cmd.ExecuteNonQuery() | Out-Null
	}
	catch
	{
	   Write-Warning "ERROR: $_"
	}
	finally
	{
	   $conn.Close()
	}
} else {
	"The connection is closed" | Out-Default
}

fcastro
Novice
Posts: 8
Liked: never
Joined: Apr 05, 2012 10:52 am
Full Name: Fausto Castro
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by fcastro » Jul 23, 2012 10:49 am

results sent

murda
Enthusiast
Posts: 38
Liked: never
Joined: Dec 18, 2009 10:05 am
Full Name: murda
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by murda » Jul 23, 2012 2:21 pm

ThomasMc wrote:The above code won't work because you never opened the connection to the SQL server, use the original code and make the small edit I mentioned above and report back: http://forums.veeam.com/viewtopic.php?f ... =15#p41616
Oké,

I tried this code now:

Code: Select all

asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "TLOVC01.pce.local"
$serverName = "TLOSQL2\Veeam"            
$databaseName = "Veeam"

$vc = Find-VBRViEntity -Name $VCVMName | ?{($_.Reference -notlike "vm-*") -AND ($null -ne $_.Reference)}
      
$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()
}
Still getting the "couldn't open connection" message :?

TLOSQL2 = WIN2008 R2 + SQL 2008 R2
TLOVC01 = WIN2008 R2

Backup name from Veeam job = Backup TLOSQL2

fcastro
Novice
Posts: 8
Liked: never
Joined: Apr 05, 2012 10:52 am
Full Name: Fausto Castro
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by fcastro » Jul 23, 2012 2:26 pm

shouldn't be the veeam database name VeeamBackup?

murda
Enthusiast
Posts: 38
Liked: never
Joined: Dec 18, 2009 10:05 am
Full Name: murda
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by murda » Jul 23, 2012 2:35 pm

If I remember correctly I changed the database name when I installed Backup & Replication.
I just checked again on my DB server and there are 3 DB's.

Veeam
VeeamBackupReporting
VeeamOne

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Jul 23, 2012 5:00 pm

@murda
can you try the updated code that I posted @ http://forums.veeam.com/viewtopic.php?f ... =60#p58549

@fcastro I'll get back to you RE: the PM

murda
Enthusiast
Posts: 38
Liked: never
Joined: Dec 18, 2009 10:05 am
Full Name: murda
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by murda » Jul 24, 2012 11:47 am

ThomasMc wrote:@murda
can you try the updated code that I posted @ http://forums.veeam.com/viewtopic.php?f ... =60#p58549

Code: Select all

Add-PSSnapin -Name "VeeamPSSnapIn" -ErrorAction SilentlyContinue

$VCVMName = "tlovc01.pce.local"
#$VCJobName = "Backup TLOSQL2"
$serverName = "TLOSQL2\Veeam"            
$databaseName = "Veeam"

#$cvc = Get-VBRJob -Name $VCJobName | Get-VBRJobObject -Name $VCVMName
$vc = Find-VBRViEntity -Name $VCVMName | ?{($_.Reference -notlike "vm-*") -AND ($null -ne $_.Reference)}
      
$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%'"

#if ($cvc.Location -eq $vc.Path) {
#   "The VM hasn't moved" | Out-Default
#   Sleep 15
#   Exit
#}

try 
{
   $conn.Open()
}
catch
{
   Write-Warning "ERROR: $_"
}

if ($conn.State -eq "Open") { 
   try
   {
      $cmd.ExecuteNonQuery() | Out-Null
   }
   catch
   {
      Write-Warning "ERROR: $_"
   }
   finally
   {
      $conn.Close()
   }
} else {
   "The connection is closed" | Out-Default
}
gives me the following:
WARNING: 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: 26 - Error
Locating Server/Instance Specified)"

murda
Enthusiast
Posts: 38
Liked: never
Joined: Dec 18, 2009 10:05 am
Full Name: murda
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by murda » Jul 25, 2012 6:59 am

Code: Select all

$serverName = "TLOSQL2\Veeam"  
TLOSQL2 = server hosting Veeam & vCenter DB.
Veeam = Database on TLOSQL2

Is this correct?

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Jul 26, 2012 12:34 am

No it's the server name/ip and instance name

electricd7
Expert
Posts: 117
Liked: 7 times
Joined: Mar 27, 2012 10:13 pm
Full Name: Chad Killion
Contact:

Failed to freeze guest warning, how to resolve with DRS?

Post by electricd7 » Aug 13, 2012 1:45 pm

[merged]

Hello,

I have a job which runs nightly which includes our virtualcenter server. This job has a warning nightly stating " 8/12/2012 10:03:08 PM :: Unable to release guest. Details: VSSControl: Failed to freeze guest, wait timeout". Now I was able to find a knowledge base article KB1051 (http://www.veeam.com/KB1051) describing this problem exactly. The resolution, however, leaves a lot to be desired unless I am missing something. It says we should add the host which manages vCenter manually and run the backup from that host instead of using vCenter for this job. That is all fine and good until you factor in DRS and the fact that you really have no idea which host vCenter is running on from day-to-day. How do I solve this problem in an enterprise running DRS with 14 hosts? Surely there is another way to resolve this?

ED7

Gostev
SVP, Product Management
Posts: 24416
Liked: 3402 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by Gostev » Aug 19, 2012 8:28 pm

Folks, we are looking at handling vCenter VM backup on the product level in the next major release, so that you don't have to jump through the hoops to achieve this. Appeared to be quite a task to implement this in a reliable manner, but I think devs nailed it.

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Aug 19, 2012 9:38 pm

That's awesome news :)

dellock6
Veeam Software
Posts: 5683
Liked: 1603 times
Joined: Jul 26, 2009 3:39 pm
Full Name: Luca Dell'Oca
Location: Varese, Italy
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by dellock6 » Aug 20, 2012 8:08 am

Great news Anton, waiting for it then :)

Luca.
Luca Dell'Oca
Principal EMEA Cloud Architect @ Veeam Software

@dellock6
https://www.virtualtothecore.com/
vExpert 2011 -> 2019
Veeam VMCE #1

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Nov 21, 2012 4:12 pm

Gostev wrote:Folks, we are looking at handling vCenter VM backup on the product level in the next major release, so that you don't have to jump through the hoops to achieve this. Appeared to be quite a task to implement this in a reliable manner, but I think devs nailed it.
Did this make it into 6.5?

Vitaliy S.
Product Manager
Posts: 22747
Liked: 1518 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by Vitaliy S. » Nov 21, 2012 4:58 pm

Since 6.5 is not a major release, then the answer is no ;)

pjbryant
Novice
Posts: 9
Liked: never
Joined: Nov 05, 2012 10:58 am
Full Name: P J Bryant
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by pjbryant » Dec 09, 2012 6:24 pm

hello all, I'm looking into this one as well, but I am using a different "find the host the VC is on" method. that is only a few short lines. In addition I also temporarily disable DRS from moving the VC to a different host so that the job does not subsequently fail (it happened to me once quite early on in testing!)

Code: Select all

#declare the VC name (as appearing in vCentre display, not the NetBIOS name)
$VCVMName = "vCenter"

#connect to the cluster (sort your credentials how you like...)
$VC = Connect-VIServer $VCVMName -User <Username> -Password <Password>
#disable DRS moving of the VC so we connect correctly (this prevents DRS moving the VC guest to another host before the job runs
get-cluster | Set-Cluster -DrsAutomationLevel PartiallyAutomated -confirm:$false

#Find out on which host vCentre 4.1 is running
$VCGuest=get-vm $VCVMName
$ESXiHost = $VCGuest.vmhost.name
$ESXiHost now is the ESX host *currently* running your VC

to enable the DRS automation once the job has been started (and i recommend waiting a few minutes after the job is started)

Code: Select all

#wait 5 minutes for the Job to get going
Start-Sleep -s 300
#set drs automation back to full automated
get-cluster | Set-Cluster -drsautomationlevel FullyAutomated -confirm:$false 

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by ThomasMc » Dec 09, 2012 8:16 pm

I never seen any point in using PowerCLI as the VeeamShell can get what we needed, also why not use the VMotion event to trigger an alarm and run your script? we spoke about that away at the start of this thread :wink:

pbohlken
Novice
Posts: 4
Liked: never
Joined: Jan 09, 2013 3:35 pm
Full Name: Peter Bohlken
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by pbohlken » Jan 09, 2013 3:44 pm

When is an update expected?

I also have the same issues with not able to backup vCenter (quiesce). I already installed the latest patch a few days ago that solves problems with snapshots not being removed.
For use is a solution with a script not a real solution.

Thanks!

Vitaliy S.
Product Manager
Posts: 22747
Liked: 1518 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by Vitaliy S. » Jan 10, 2013 8:36 am

Gostev wrote:Folks, we are looking at handling vCenter VM backup on the product level in the next major release, so that you don't have to jump through the hoops to achieve this. Appeared to be quite a task to implement this in a reliable manner, but I think devs nailed it.
The next major update that should address this behavior is scheduled for this year.

Unison
Enthusiast
Posts: 87
Liked: 16 times
Joined: Feb 17, 2012 6:02 am
Full Name: Gav
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by Unison » Mar 22, 2013 1:48 am

Cant wait for the next major release :) Hopefully this will be addressed. I imagine everyone with a VC on multiple hosts is suffering this problem - its especially painful for us running replication jobs over the WAN - every time your VC is vmotioned......we have to re transport the base image :( - unless we undertake this unsupported hacking of the database.

Its been an identified issue for years now - hopefully the time is right for a permanent solution to this from veeam. Veeam does do some very impressive and tricky things as you all know - so building a little bit of intelligence in that detects the change of a RefID due to a vMotion will be well within the capabilities of the Veeam Dev team :).

Fingers crossed

ogodt
Novice
Posts: 7
Liked: never
Joined: Mar 11, 2013 12:21 pm
Contact:

[MERGED] VSSControl: Failed to freeze guest, wait timeout

Post by ogodt » Apr 09, 2013 1:23 pm

Hi all,

i have a backup job that backs up all my vms ( 11 ) but i get the VSSControl error on my Vcenter i have read http://www.veeam.com/KB1051 but i really cant figure out what to do,
i would like to keep my backup job, because it backs up my entire cluster.

We use Veeam BR 6.5

\Ole

ntrevett
Lurker
Posts: 1
Liked: never
Joined: Aug 09, 2013 8:25 am
Full Name: Nigel Trevett
Contact:

[MERGED] : Backing up vCenter Database Server Best Practice

Post by ntrevett » Aug 09, 2013 8:40 am

Hi,
What is considered the "Best Practice" deployment of a virtual SQL server for a virtual vCenter server so to be able to back it up with Veeam's B&R?
Is it supported by Veeam and Microsoft if you backup a Mirror Target (SQL 2008) or an Always-on replica (SQL 2012)?
I've seen the KB recommending a backup via the host - surely this is more of a work-around!

Thanks in advance for your help
Nigel

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

Re: HOWTO: Backing up vCenter host issues

Post by veremin » Aug 09, 2013 9:03 am

Hi, Nigel.

You have been merged to the existing discussion regarding vCenter VM backup, so, kindly take a look at the answers provided above.

For now one option to go is, indeed, to add a vCenter VM to backup/replication job through a standalone server. However, please be aware that the upcoming version of Veeam Backup and Replication will handle the process of vCenter VM backup more effectively.

Thanks.

Tim783
Influencer
Posts: 13
Liked: never
Joined: Jul 20, 2012 2:05 pm
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by Tim783 » Sep 05, 2013 9:40 am

Gostev wrote:Folks, we are looking at handling vCenter VM backup on the product level in the next major release, so that you don't have to jump through the hoops to achieve this. Appeared to be quite a task to implement this in a reliable manner, but I think devs nailed it.
Hi Gostev,

Did this end up being fixed in v7? I am running v7 and am still unable to backup one of our SQL servers that hosts the vcenter database.

Have to add at the host level to get a successful backup.

Thanks

Vitaliy S.
Product Manager
Posts: 22747
Liked: 1518 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: HOWTO: Backing up vCenter host issues

Post by Vitaliy S. » Sep 05, 2013 11:43 am

Yes, this issue has been addressed in v7. If you still experience issues with backing up vCenter Server through the vCenter Server, please contact our technical team for logs review. Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests