Solved

Issue with RESTORE-CVSQLDATABASE -OutofPlace

  • 22 July 2021
  • 5 replies
  • 96 views

Badge +1

I’m trying to script a process to automate my restore testing of SQL Server database backups from Commvault.  The process will one-by-one restore each production database from all of my production servers to a utility server where I can run checkdb and other validation processes against the database and log the results.  I’m doing this all through powershell and using the Commvault powershell module RESTORE-CVSQLDATABASE to do the restore with the -OutofPlace flag and the other needed paramaters to tell it where to restore. So far it works fine as long as the original database data file directory and log file directories match my utility server.  Not so fine when they don’t.  It will throw an error in Commvault saying that it cannot find the datafile directory (H:\MSSQL\Data…..etc).  Of course there is no H drive on my utility server but that should be taken care of with the -DataFilePath "E:\MSSQL\Data" -LogFilePath "F:\MSSQL\Log" parameters I’ve passed in right?  Here’s the actual syntax of the command I’m using:

$jobids = (Restore-CVSQLDatabase -DatabaseObject $dbobject -OutofPlace -DestClientName $RestoreServer -DestInstanceName $RestoreServer -DestDatabaseName $DBName -DataFilePath "E:\MSSQL\Data" -LogFilePath "F:\MSSQL\Log" -Force).jobIds

Where $RestoreServer is my utility server name

Since there is not a lot of documentation on how to use the -OutofPlace parameters I’m making assumptions on their usage.  Anyone have any clues as to why this wouldn’t work?

icon

Best answer by CGarcia 23 July 2021, 04:26

View original

5 replies

Badge +2

The usage of Restore-CVSQLDatabase based on your assumptions is correct. Can you tell me what service pack or feature release your commserver is running?

Badge +1

@CGarcia Version 11 SP18.18

Badge +2

Unfortunately, the backend support for the out of place restore wasn’t fully implemented until 11.19.

Badge +1

@CGarcia Thanks for that info.  I’ll see if I can get my sysadmins to get that upgraded.

Badge

@AECI DBA  It’s very difficult to find example of SQL restore with PowerShell from Commvault.  Are-you welling to share your script? Or How explain how create the variable $dbobject ?

Best Regards

  

Reply