Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Failed to import target model DBName. Detailed message Unable to reconnect to database.

Answered Failed to import target model DBName. Detailed message Unable to reconnect to database.

  • Thursday, May 10, 2012 12:39 PM
     
     

    When attempting to publish my database project I continually get the following error message.

    Failed to import target model DBName. Detailed message Unable to reconnect to database.

    However, I am able to publish the same project to the same target database over the same network but from a different computer.


All Replies

  • Tuesday, May 22, 2012 11:50 PM
    Owner
     
     

    Hey David,

    Thanks for reporting the issue. Let's see if we can get to the bottom of this. Have you tried publishing the .dacpac file that is a result of building the project via SqlPackage.exe, our command-line deployment tool? The .dacpac file can be found in %Project directory%/bin/%Debug or Release%/<ProjectName>.dacpac after you build the project.

    If it works through the command-line tool, we can isolate the issue to the project system. Let me know if you are able to give this a try!

    Thanks,

    Adam


    Adam Mahood - Program Manager Data-Tier Application Framework (DACFX)/SQL Server Data Tools

  • Friday, June 15, 2012 12:37 AM
     
     

    I am seeing a similar issue in our environment and it is random.  In just about every case if we rerun the command a second time it succeeds.  So far any tracing i have run on the server side (both xevents / profiler) has not truned up anything. 

    I am skeptical that there are really connectivity issues because we run lots of databases on this server and the only report of connection failures I am hearing about are from the deployment tools.

    Are there any switches that allow better logging from sqlpackage?  Or good ways to troubleshoot this?

    Here is an example of our command line.

    [227.85]: From . running C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe /Action:Publish /SourceFile:"C:\some.dacpac" /TargetDatabaseName:"databasename" /TargetServerName:"myserver" /p:IgnoreFilegroupPlacement=True /p:IgnoreFileAndLogFilePath=True /p:IgnorePartitionSchemes=True /p:UnmodifiableObjectWarnings=False /p:BlockOnPossibleDataLoss=False /p:CommentOutSetVarDeclarations=False /Variables:DefaultDataFileGrowth="20%" /Variables:DefaultDataFileSize="10" /Variables:DefaultLogFileGrowth="20%" /Variables:DefaultLogFileSize="10" /Variables:DomainName="domain" /Variables:master="master"

    [228.85]: Publishing to database 'somedatabase' on server 'myserver'.
    [323.07]: *** Could not deploy package.
    [323.07]: Failed to import target model somedatabase. Detailed message Unable to reconnect to database.
    [323.08]: Unable to reconnect to database.
    [323.08]: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

  • Saturday, June 16, 2012 6:59 PM
    Moderator
     
     Answered Has Code

    Most likely the problem is that the QueryTimeout used by default is 60 seconds, if you have a large database or some degree of blocking or locking it is easy to go over this, which explains the second try works, because data is in the cache as result of the first attempt.

    You can try setting the QueryTimeout, you have to do this in the Registry, we do not allow you to pass this on the command line (I asked for this improvement to be added).

    reg.exe add HKCU\Software\Microsoft\VisualStudio\10.0\
    SQLDB\Database /v QueryTimeoutSeconds /t REG_DWORD /d 0 /f

    Let me know if this help,


    -GertD @ www.sqlproj.com


  • Monday, June 18, 2012 10:59 PM
     
     
    Thanks Gert.  I will give that a try.  It would be nice to have this exposed as a command line option to sqlpackage.exe.