You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a production server called PROD01. It stores backups in it's local B:\ drive. When creating an image using the following command (using a production database and using the dev server as the restore surrogate)
This is the line that ultimately is the culprit. It's due to the fact that this reports the backup file in relation to the source server, so eg B:\SQL\Full\MyDatabase.bak. The dev server doesn't have this path (more specifically, this runs local to the script location, not the destination sql host, so if running locally on my machine, if I don't have B drive with this path, this will still fail, regardless of if the dev instance has access to it)
I have a solution that will replace B:\SQL\Full\MyDatabase.bak with UNC admin path \\PROD01\B$\SQL\Full\MyDatabase.bak. This works for our case specifically, but I'm not too familiar with the nuances of using the admin paths and drive$. I think ideally, the backup drives would be on a share, and we should replace the local drive letter with whatever that share is (although I'm not sure if it's possible to do that programmatically without giving the command specific locations)
I can submit a PR for my fix as a stop gap until someone can work out a more permanent solution
The text was updated successfully, but these errors were encountered:
We have a production server called PROD01. It stores backups in it's local B:\ drive. When creating an image using the following command (using a production database and using the dev server as the restore surrogate)
New-DcnImage -SourceSqlInstance PROD01 -DestinationSqlInstance DEV01 -ImageNetworkPath \\dev01\g$\dbaclone-images\ -Database MyDatabase -UseLastFullBackup
This fails with a data access error
$lastFullBackup = Get-DbaDbBackupHistory -SqlInstance $SourceSqlInstance -SqlCredential $SourceSqlCredential -Database $db.Name -LastFull
This is the line that ultimately is the culprit. It's due to the fact that this reports the backup file in relation to the source server, so eg
B:\SQL\Full\MyDatabase.bak
. The dev server doesn't have this path (more specifically, this runs local to the script location, not the destination sql host, so if running locally on my machine, if I don't have B drive with this path, this will still fail, regardless of if the dev instance has access to it)I have a solution that will replace
B:\SQL\Full\MyDatabase.bak
with UNC admin path\\PROD01\B$\SQL\Full\MyDatabase.bak
. This works for our case specifically, but I'm not too familiar with the nuances of using the admin paths anddrive$
. I think ideally, the backup drives would be on a share, and we should replace the local drive letter with whatever that share is (although I'm not sure if it's possible to do that programmatically without giving the command specific locations)I can submit a PR for my fix as a stop gap until someone can work out a more permanent solution
The text was updated successfully, but these errors were encountered: