New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy-DbaDatabase sometimes chooses incorrect path for restore step #3225
Comments
Hi @Bendy22 could you run And then My guess is that it's getting the path of the real full backup rather than the one that Copy-DbaDatabase is performing. Tests may not work if there's been another full since the last fail. Don't know if you'd be able to rerun the copy if so? |
These databases do not get regular backups. They are QA databases and I guess my predecessors decided they can restore from production or whatnot if need be. This fact may be part of the issue, but Copy-DbaDatabase takes a copy-only backup and most of the other databases work even though they seem to be in the same boat. Thanks for looking at this! I update my email in github so I should get notifications now whereas I didn't get notification for your update yesterday. |
Hi, |
Running into this issue again. I will attempt separate backup and restore steps for the databases that suffer from this problem for now. Thanks in advance for your help on getting this fixed. |
same problem. The restore process is attempting to find the backup from the last sceduled backup location rather than the network share specified in the command. Never had any problems with this until I updated DBATools... writeErrorStream : True |
Hi, same here.
I can succesfully restore backup files which are left after Copy-DbaDatabase error with |
Hi, just updated to version 0.9.517 and still get the same error. writeErrorStream : True |
that's different ... seems you have backups done by an external party ... unless you have files named Backup{ |
Yeah, we use MS DPM ... |
Yeah "we do have files named like that" or "yeah, we use DPM which doesn't leave files around" ? |
I am sorry, but I am no longer have access to the client with this environment where I can re-test. |
d'oh! down to @duncfair thank you both for responding and thanks niph for handling it |
Looks like my PR tag didn't make it into this one. This was one of the issues that the the Get-DbaBackuphistory/Backup-DbaDatabase fixes should fix as it was most likely either:
|
fantastic news, thank you, @Stuart-Moore! Marking as closed. |
@niphlod |
Thanks for fixing this! |
Based on my experience, most of the backups made by third-party tools are pretty easy to identify (and ignore, if they stand in the way). There are two identifiers which we could use to filter out irrelevant backups (that's what I did back when I used T-SQL to generate restore scripts). First of all, it should not be a snapshot. Some of the backup providers would snapshot SQL Server databases during host backups and the resulting backup entries would interfere with the backup LSN chain: The second part is a backup type, which in most cases we use is a disk drive backup, not a virtual device. This one actually is supported by the function parameter |
hum, not really. We can tame more doing -DeviceType Disk (at least for the moment since backup-dbadatabase doesn't support anything else) and/or -Since (notloolongago), but the problem with get-dbabackuphistory and forks will still be there, just in more and more restricted corners, without solving the root cause (which would be a PITA, but it's technically solvable) |
Hi Chrissy,
I am at another company site working on a project that includes the migration of multiple db’s (It was only supposed to be 2).
Go live is tonight but we have been using the copy-dbafatabase command extensively (and successfully) as recently as 3 days ago. Any updates since then?
Thanks,
Duncan
Best Regards,
Duncan Fairweather
805-907-8869
…________________________________
From: Chrissy LeMaire <notifications@github.com>
Sent: Thursday, November 15, 2018 5:23 PM
To: sqlcollaborative/dbatools
Cc: duncfair; Mention
Subject: Re: [sqlcollaborative/dbatools] Copy-DbaDatabase sometimes chooses incorrect path for restore step (#3225)
Can you test this again @janeztr<https://github.com/janeztr> , @duncfair<https://github.com/duncfair> or@Bendy22<https://github.com/Bendy22> ? We've made a lot of mods since.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#3225 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AYZ6N9DKCe9795hF_EmfioDakO4_PFKSks5uvhOZgaJpZM4SDDCq>.
|
awesome, that's great news @duncfair - thank you! No changes since then, looks like stuart's earlier changes worked 🎉 |
Hi, 0.9.533 update resolved my issue, thx! |
fantastic! thanks for the update @janeztr 💯 |
Bug Report
I am using
Copy-DbaDatabase
to migrate several databases from clustered instances of SQL 2008 R2 to SQL 2016. Most of the databases work fine, but there are a few on each instance that fail. The backup step works fine and backs up to the-NetworkShare
path I provide. But for a few databases, they do not use the-NetworkShare
path for the restore step and seem to use some old path that the original database was restored from on the source instance.General Troubleshooting steps
Copy-DbaDatabase -Source DCPTSQLC01INT03.decepticons.amsod\EIQ -Destination AP11DBC01N09 -Database CustomerDefault -BackupRestore -NetworkShare \\backupa.gc.local\source11\DCPT -Force
I'm using
-Force
so I don't have to delete the destination database that I have restored manually in the past in case the command actually completes.The basic error is:
WARNING: [Invoke-DbaAdvancedRestore][15:18:04] Failed to restore db CustomerDefault, stopping | Exception calling "SqlRestore" with "1" argument(s): "Restore failed for Server 'AP11DBC01N09'. "
Running
$error[0] | select *
gives mepowershell -NoProfile
)?Version Information
Steps to Reproduce
Run the above
Copy-DbaDatabase
command on the misbehaving databases and it will fail every time.dbatoolslog.zip
Get-DbatoolsLog
)Problem to solve
Copy-DbaDatabase should always use the path given in the
-NetworkShare
parameter for the restore step.Additional information
I believe the path in the large error above is a full file path and not a folder path. When I run this command on the other misbehaving databases, I get paths terminating in .bak files. So I believe CustomerDefault_EIQRestore was a filename with no extension and not a folder.
The text was updated successfully, but these errors were encountered: