When creating container with external database using this command
New-NavContainer -accept_eula -containerName "plato" `
-artifactUrl (Get-BCArtifactUrl -type OnPrem -country be -version 27.1) `
-updateHosts `
-auth NavUserPassword `
-credential $credential `
-databaseServer "host.containerhelper.internal" `
-databaseCredential $databaseCredential `
-licenseFile "C:\bcartifacts.cache\onprem\27.1.41698.41776\w1\database\Cronus.bclicense" `
-additionalParameters @("--volume", "C:\Users\petkevig\projects\bc-plato\.netpackages:c:\run\Add-ins") `
-databasePrefix 'C-' `
-databaseName "PLATO_APP" `
-multitenant:$true `
-useSqlServerModule:$true `
-replaceExternalDatabases
I get the following issue:
...
backup database [C-tenant] to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\C\C-tenant.bak' with init, stats=10;
restore database [C-default] from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\C\C-tenant.bak' with stats=10, recovery, move 'Demo Database BC (27-0)_Data.MDF', move 'Demo Database BC (27-0)_Log.LDF'
Warning, exception when running: restore database [C-default] from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\C\C-tenant.bak' with stats=10, recovery, move 'Demo Database BC (27-0)_Data.MDF', move 'Demo Database BC (27-0)_Log.LDF'
Exception was: Incorrect syntax near ','.
Waiting... - retrying
Warning, exception when running: restore database [C-default] from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\C\C-tenant.bak' with stats=10, recovery, move 'Demo Database BC (27-0)_Data.MDF', move 'Demo Database BC (27-0)_Log.LDF'
Exception was: Incorrect syntax near ','.
Waiting...... - retrying
Warning, exception when running: restore database [C-default] from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\C\C-tenant.bak' with stats=10, recovery, move 'Demo Database BC (27-0)_Data.MDF', move 'Demo Database BC (27-0)_Log.LDF'
Exception was: Incorrect syntax near ','.
...
you can see restore script is lacking "to" part
The issue is with this code
|
$move = (($files | % { $_.name+[System.IO.Path]::GetExtension($_.physical_name) }) -join "', move '").Replace(".mdf","' to '$dbfolder\$DestinationDatabaseName.mdf").Replace(".ldf","' to '$dbfolder\$DestinationDatabaseName.ldf").Replace(".ndf","' to '$dbfolder\$DestinationDatabaseName.ndf") |
You are using .Replace which is case sensitive .net string method. You should use native powershell -replace param instead, which is not case sensitive
file names in your bak files comes with capital MDF, thus your .replace() call does nothing
S:\s\NAV\NavDatabases\BE\Demo Database BC (27-0)_data.MDF
Best Regards,
Gintautas
When creating container with external database using this command
I get the following issue:
you can see restore script is lacking "to" part
The issue is with this code
nav-docker/generic/Run/HelperFunctions.ps1
Line 258 in cd66271
You are using .Replace which is case sensitive .net string method. You should use native powershell -replace param instead, which is not case sensitive
file names in your bak files comes with capital MDF, thus your .replace() call does nothing
S:\s\NAV\NavDatabases\BE\Demo Database BC (27-0)_data.MDF
Best Regards,
Gintautas