none
System.Data.SqlClient.SqlException: 'get_new_rowversion' while importing bacpac file in to Local SQL Server (SQL Server 2008 R2 SP1)

    Question

  • Hi,

    Exported database from SQL Azure to Local Server. When I tried to Import it in to Local Sql Server, I'm getting error. Please advise how to resolve this issue ASAP.

    Command Used to Export database from SQL Azure

    DacImportExportCli -s xxxxxxxx.database.windows.net -d TestDB -u xxxx-p xxxx -f G:\IMPEXP\TestDB.bacpac -x

    Command Used to Import database in to Local SQL Server

     DacImportExportCli.exe -s xxxxxx -d TestDB -f G:\IMPEXP\TestDB.bacpac -i -e

    OS : Windows Server 2008 R2 Std SP1

    SQL : SQL Server 2008 R2 Version (10.50.2500)

    Denali : Data Tier App framework CTP3 11.0.1440.19

    Denali : Management Objects CTP3 11.0.1440.19

    Denali : Management Objects CTP3 TransactSQL ScriptDom CTP3  11.0.1440.19

    Denali : T-Sql Language Service CTP3 11.0.1440.19


    G:\IMPEXP>DacImportExportCli.exe -s <Server Name> -d <Database Name> -f G:\IMPEXP\Database Name.bacpac -i -e
    Microsoft (R) DAC Import Export Sample version 1.0.2.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    Import started: 9/22/2011 9:15:05 AM
    Connecting to <Server Name>...
    Connection Open.
    PrepareSystemTables: Pending Preparing DAC metadata in the SQL Server instance '
    <Server Name>'
    PrepareSystemTables: Success Preparing DAC metadata in the SQL Server instance '
    <Server Name>'
    CreateDatabase: Pending Creating database 'DBName'
    CreateDatabase: Success Creating database 'DBName'
    ScriptDACObjects: Pending Preparing deployment script
    ScriptDACObjects: Success Preparing deployment script
    CreateDatabaseObjects: Pending Creating schema objects in database 'DBName'
    CreateDatabaseObjects: Failure Creating schema objects in database 'DBName' M
    icrosoft.SqlServer.Management.Common.ExecutionFailureException: An exception occ
    urred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: 'get_new_rowversion' is not a recognized built-in function nam
    e.
       at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(Execut
    eTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchExcepti
    on)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(Str
    ing sqlCommand, ExecutionTypes executionType)
       --- End of inner exception stack trace ---
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(Str
    ing sqlCommand, ExecutionTypes executionType)
       at Microsoft.SqlServer.Management.Dac.ConnectionManager.StandaloneConnectionM
    anager.ExecutionContext.ExecuteNonQuery(String sqlCommand)
       at Microsoft.SqlServer.Management.Dac.SqlScriptExecutionAction.Execute()
       at Microsoft.SqlServer.Management.Dac.SqlScriptExecutionAction.Execute(IExecu
    tionContext executionContext, TransactionalActionManager transactionalActionMana
    ger, IEnumerable`1 actionGroups, ScriptTarget scriptTarget, Boolean rollbackOnFa
    ilure, Boolean sendEvents)
       at Microsoft.SqlServer.Management.Dac.CreateDatabaseObjectsStep.Execute()
       at Microsoft.SqlServer.Management.Dac.TransactionalActionManager.ManagedActio
    nStep.TransactionalStep.DoExecute()
       at Microsoft.SqlServer.Management.Dac.TransactionalActionManager.ManagedActio
    nStep.Execute()
    CreateDatabase: RollbackPending Creating database 'GEARSLive'
    CreateDatabase: RollbackSuccess Creating database 'GEARSLive'
    DAC Exception: Microsoft.SqlServer.Management.Dac.DacException: Unable to import
     bacpac. See inner exception for more details. ---> Microsoft.SqlServer.Manageme
    nt.Common.ExecutionFailureException: An exception occurred while executing a Tra
    nsact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: 'get_new_
    rowversion' is not a recognized built-in function name.
       at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(Execut
    eTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchExcepti
    on)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(Str
    ing sqlCommand, ExecutionTypes executionType)
       --- End of inner exception stack trace ---
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(Str
    ing sqlCommand, ExecutionTypes executionType)
       at Microsoft.SqlServer.Management.Dac.ConnectionManager.StandaloneConnectionM
    anager.ExecutionContext.ExecuteNonQuery(String sqlCommand)
       at Microsoft.SqlServer.Management.Dac.SqlScriptExecutionAction.Execute()
       at Microsoft.SqlServer.Management.Dac.SqlScriptExecutionAction.Execute(IExecu
    tionContext executionContext, TransactionalActionManager transactionalActionMana
    ger, IEnumerable`1 actionGroups, ScriptTarget scriptTarget, Boolean rollbackOnFa
    ilure, Boolean sendEvents)
       at Microsoft.SqlServer.Management.Dac.CreateDatabaseObjectsStep.Execute()
       at Microsoft.SqlServer.Management.Dac.TransactionalActionManager.ManagedActio
    nStep.TransactionalStep.DoExecute()
       at Microsoft.SqlServer.Management.Dac.TransactionalActionManager.ManagedActio
    nStep.Execute()
       at Microsoft.SqlServer.Management.Dac.TransactionalActionManager.ExecuteActio
    nSteps(IEnumerable`1 managedActionSteps)
       at Microsoft.SqlServer.Management.Dac.TransactionalActionManager.Go()
       at Microsoft.SqlServer.Management.Dac.DacStore.Import(Stream stream, Database
    DeploymentProperties deploymentProperties, Boolean skipPolicyValidation)
       --- End of inner exception stack trace ---
       at Microsoft.SqlServer.Management.Dac.DacStore.Import(Stream stream, Database
    DeploymentProperties deploymentProperties, Boolean skipPolicyValidation)
       at Microsoft.SqlServer.Management.Dac.DacStore.Import(DatabaseDeploymentPrope
    rties deploymentProperties, String path, Boolean skipPolicyValidation)
       at DacImportExportCli.Program.ImportAction()
    Import Complete.  Total time: 00:02:04.7111021

    Regards,

    Ranjith

     


    Thursday, September 22, 2011 12:05 PM

All replies

  • Hello Ranjith,

    You are getting this error because the function get_new_rowversion is not supported on non-Azure local SQL Instances. So this is expected when you import into local servers. Unfortunately, you have to adjust the schema, re-export and import it again.

    Currently DACFx only has simpler validation rules to block an import/install upfront if the package can't be deployed on the target server. We are looking at extending them for the future.

    Thanks

    Shireesh

     


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, September 22, 2011 5:03 PM
  • Hi Sireesh,

     

    We found one workarround and sucessfully restored file to Local SQL Instance. Please go through below details and advise.

    1. change the backup file extension from .bacpac to .Zip

    2. Copy file LogicalObjectStream.xml, open and replace 'get_new_rowversion, with some other value, we replace this with 1

    3. save the file 'LogicalObjectStream.xml'

    4. copy back to backup zip folder.

    5 chage the file extension from .zip to .bacback

    6. Execute import comand.

    Regards,

    Ranjith


    Friday, September 23, 2011 4:24 AM
  • Hello Ranjith,

    The work around you suggested is a fine approach if it works for you. The format is open and hence you can edit the file as you did.

     

    Thanks

    Shireesh


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, September 27, 2011 1:25 AM
  • Hello Ranjith,

    The work around you suggested is a fine approach if it works for you. The format is open and hence you can edit the file as you did.

     

    Thanks

    Shireesh


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, September 27, 2011 1:25 AM
  • Thanks Shireesh.

     

    Regards,

    Ranjith

    Tuesday, September 27, 2011 8:45 AM
  • I finally found a way to do this at http://blogs.msdn.com/b/sqlazure/archive/2010/05/17/10014014.aspx.  It will copy all of the tables directly from Azure, but you will need to do the stored procs by hand.

    Tom

    • Proposed as answer by Tom Layson Friday, August 9, 2013 11:55 PM
    Friday, August 9, 2013 11:55 PM