powershell - Exception calling “ImportBacPac” with “2” argument(s): “Could not import package” -


i know has been asked earlier, not see answer hence posting again.

as part of ps(ver 4.0) importbacpac hitting following error intermittently exception calling "importbacpac" "2" argument(s): "could not import package." , exception “invalid operation”. machine has sql 2014 , bacpac exported on sql 2014 only, there no mismatch way , using windows authentication import. thing error not consistent , happens @ times only. idea going on here?

added code

function perform-restore([string]$dbname, [string]$connectionstring, [string]$sqlserverversion,       [string]$bacpacfilepath) { load-dacfx -sqlserverversion $sqlserverversion  $dacserviceinstance = new-object microsoft.sqlserver.dac.dacservices ($connectionstring)  $bacpacpackageinstance = [microsoft.sqlserver.dac.bacpackage]::load($bacpacfilepath)  try {     **$dacserviceinstance.importbacpac($bacpacpackageinstance, $dbname)** } catch {     throw "restore failed" } }  function load-dacfx([string]$sqlserverversion) {   $majorversion = get-sqlservermajoreversion -sqlserverversion $sqlserverversion    $dacfxlocation = "${env:programfiles(x86)}\microsoft sql server\$majorversion\dac\bin\microsoft.sqlserver.dac.dll"  try {       [system.reflection.assembly]::loadfrom($dacfxlocation) | out-null } catch {     throw "$localizeddata.dacfxinstallationerror" } } 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -