bseltz-cohesity / scripts

Cohesity REST API examples in PowerShell and Python
Apache License 2.0
102 stars 40 forks source link

specifying source dB does not work #131

Closed eoyduett closed 10 months ago

eoyduett commented 11 months ago

Hi

specifying source dB does not work

tested with both the INSTANSNAME/db_name and just db__name.

Database db_name not found!

restoreSQLDBs.ps1

input: .\restoreSQLDBs.ps1 -sourceServer some_server -sourceInstance SQL12345 -targetServer some_server -targetInstance sql67891 -vip ip -username some_user -password some_password -mfaCode mfa_code -mdfFolder c:\some_folder -sourceDBnames some_db_name -latest

bseltz-cohesity commented 11 months ago

Which script are you referring to?

eoyduett commented 11 months ago

restoreSQLDBs.ps1

bseltz-cohesity commented 11 months ago

The script is working fine for me using similar inputs that you used. Please confirm that you can perform the same restore via the Cohesity UI, and confirm that the server names, instance names, and database names you are specifying are all correct.

eoyduett commented 11 months ago

restoring the same db with the same options works from the ui, same source and destination.

if i just remove the -sourceDBnames parameter and add the parameter for -allDBs the restore is working from the script.

bseltz-cohesity commented 11 months ago

Please send screenshots to Cedric of the search result page in the UI, and the successful recovery details and options pages in the UI

eoyduett commented 11 months ago

done

bseltz-cohesity commented 11 months ago

I have updated the script to page the search results. This should get past the huge JSON response due to the very high number of databases on the server. Please let me know if that helps: https://github.com/bseltz-cohesity/scripts/tree/master/sql/restoreSQLDBs

Note: this script will still perform one DB restore at a time, so still may not meet your needs. I am working on a v2 rewrite that will perform bulk restores using the 6.8.x bulk restore feature.

eoyduett commented 11 months ago

hi, yes tested again now with the new script, it works!

bseltz-cohesity commented 11 months ago

I have published a new v2 version of the script here: https://github.com/bseltz-cohesity/scripts/tree/master/sql/restoreSQLv2 it will restore multiple databases per restore task (100 per task by default, configurable). Please let me know how it works for you.

eoyduett commented 10 months ago

wow nice, i will test this ASAP!

is it possible to use a timeframe parameter with alldb's parameter so that you don't spend time restoring db's that were deleted a long time ago in a DR situation where you only need to restore the db's that were active yesterday, etc

bseltz-cohesity commented 10 months ago

Done. I have added a -newerThan parameter (when restoring allDBs, only include databases backed up in the last X days), e.g. -newerThan 7

eoyduett commented 10 months ago

hm, ok? comment deleted.

bseltz-cohesity commented 10 months ago

Your screenshot was visible during web page loading, so I deleted it for your safety. Let's use email when troubleshooting