bseltz-cohesity / scripts

Cohesity REST API examples in PowerShell and Python
Apache License 2.0
103 stars 41 forks source link

restoreSQLDBs log time out of range #89

Closed nwageler closed 1 year ago

nwageler commented 1 year ago

Our Source SQL Server has databases that were recreated. For example, Cohesity Recovery UI shows:

'MyDB1' created on Dec 15, 2022 'MyDB1' created on Dec 21, 2022

When using restoreSQLDBs.ps1 to restore 'latest' (e.g. Jan 18, 2023) or any date range after Dec 21, it will not select the correct iteration of 'MyDB1':

./restoreSQLDBs.ps1 -vip mycluster `
                    -username myusername `
                    -domain mydomain.net `
                    -sourceServer sqlserver1.mydomain.net `
                    -targetServer sqlserver2.mydomain.net `
                    -allDBs `
                    -overWrite `
                    -latest
Connected!
log time is out of range
Valid range is 12/18/2022 22:00:02 to 12/18/2022 22:00:02
bseltz-cohesity commented 1 year ago

Hi @nwageler I think I may have found the issue. Can you please download the latest version of the script here: https://github.com/bseltz-cohesity/scripts/tree/master/sql/restoreSQLDBs

nwageler commented 1 year ago

Yes that was it! The script is now locating and restoring the correct database versions. Thanks @bseltz-cohesity !