d365collaborative / d365fo.tools

Tools used for Dynamics 365 Finance and Operations
MIT License
250 stars 102 forks source link

Creating backup from Tier1 fails the second time #605

Closed dennismdejong closed 2 years ago

dennismdejong commented 2 years ago

We have successfully creating a first time backup with the command: New-D365Bacpac -ExportModeTier1 -BackupDirectory J:\MSSQL_BACKUP -NewDatabaseName BaseLine -BacpacFile "J:\MSSQL_BACKUP\BaseLine_20211202.bacpac" -Verbose

If we run it a second time it fails:

VERBOSE: [08:12:33][Invoke-TimeSignal] The command 'New-D365Bacpac' was already taking part in time measurement. The entry has been update with current date and time. VERBOSE: [08:12:33][Test-TrustedConnection] Capabilities based on the centralized logic in the psm1 file. VERBOSE: [08:12:33][New-D365Bacpac] Invoking the Tier 1 - SQL backup & restore process VERBOSE: [08:12:33][Get-SQLCommand] Building the SQL connection string. VERBOSE: [08:14:17][Invoke-SqlBackupRestore] Total time spent inside the function was 00:01:43.4071232 VERBOSE: [08:14:17][New-D365Bacpac] Invoking the Tier 1 - Clear SQL objects VERBOSE: [08:14:17][Get-SQLCommand] Building the SQL connection string. [08:14:17][Get-SQLCommand] Something went wrong while working with the sql server connection objects | Exception setting "ConnectionString": "The value's length for key 'password' exceeds it's limit of '128'." WARNING: [08:14:17][Get-SQLCommand] Stopping because of errors The property 'CommandText' cannot be found on this object. Verify that the property exists and can be set. At line:4107 char:5

[08:14:17][Invoke-ClearSqlSpecificObjects] Something went wrong while clearing the SQL specific objects in the database. | You cannot call a method on a null-valued expression. WARNING: [08:14:17][Invoke-ClearSqlSpecificObjects] Stopping because of errors. | Something went wrong while clearing the SQL specific objects in the database. You cannot call a method on a null-valued expression. At line:4126 char:13

You cannot call a method on a null-valued expression. At line:4129 char:9

The output of $error:

You cannot call a method on a null-valued expression. At line:4129 char:9

You cannot call a method on a null-valued expression. At line:4126 char:13

Stop-PSFFunction : Something went wrong while clearing the SQL specific objects in the database. At line:4121 char:9

The property 'CommandText' cannot be found on this object. Verify that the property exists and can be set. At line:4107 char:5

Stop-PSFFunction : Stopping because of errors At line:2994 char:9

Stop-PSFFunction : Something went wrong while removing the Database. At line:27590 char:9

Remove-D365Database : A parameter cannot be found that matches parameter name 'Name'. At line:1 char:21

You cannot call a method on a null-valued expression. At line:4129 char:9

You cannot call a method on a null-valued expression. At line:4126 char:13

Stop-PSFFunction : Something went wrong while clearing the SQL specific objects in the database. At line:4121 char:9

The property 'CommandText' cannot be found on this object. Verify that the property exists and can be set. At line:4107 char:5

Stop-PSFFunction : Stopping because of errors At line:2994 char:9

You cannot call a method on a null-valued expression. At line:4129 char:9

You cannot call a method on a null-valued expression. At line:4126 char:13

Stop-PSFFunction : Something went wrong while clearing the SQL specific objects in the database. At line:4121 char:9

The property 'CommandText' cannot be found on this object. Verify that the property exists and can be set. At line:4107 char:5

Stop-PSFFunction : Stopping because of errors At line:2994 char:9

dennismdejong commented 2 years ago

I should have ran it in elevated mode the second time as well