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?
Best answer by CGarciaView original