Importing database from Azure getting error message "Warning SQL72012: The object [myDatabase_Data] exists in the target..."

  • I exported a Azure SQL database to my local drive as , of course, a bacpac.

    When I go to import into my sql server instance which is installed on an Azure VM, I am getting an error message.

    Could not import package.
    Warning SQL72012: The object [myDatabase_data exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
    Warning SQL72012: The object [myDatabase_Log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
    Error SQL72014: .Net SqlClient Data Provider: Msg 12824, Level 16, State 1, Line 5 The sp_configure value 'contained database authentication' must be set to 1 in order to alter a contained database.  You may need to use RECONFIGURE to set the value_in_use.
    Error SQL72045: Script execution error.  The executed script:
    IF EXISTS (SELECT 1
               FROM   [master].[dbo].[sysdatabases]
               WHERE  [name] = N'$(DatabaseName)')
        BEGIN
            ALTER DATABASE [$(DatabaseName)]
                SET CONTAINMENT = PARTIAL
                WITH ROLLBACK IMMEDIATE;
        END

    It creates a database but I have not idea what this error is about. It creates a database with the correct name, but it fails at importing the database from the bacpac.  Any one familiar with this error message?

    Thanks.

    Things will work out.  Get back up, change some parameters and recode.

  • Not sure on the warnings, but it sounds like the objects already exist and you are trying to drop something on top of them.
    The error is because on the SQL Instance level, you have contained databases disabled (ie contained database authentication is not set to 1) and then the script is trying to set containment to partial.

    So some of the steps restoring that database failed.
    I've not done stuff with Azure VM's as we are all on premise for our stuff, but I'd say to get rid of the error you would need to run:
    EXEC sp_configure 'contained database authentication', 1
    RECONFIGURE

    To fix the warnings, I'd say you probably want to drop or rename the database before you do the bacpac restore.  Those are warnings so they won't cause the restore to fail, but the error will.  You will need to enable contained database authentication (as the error states) before you can complete that successfully I believe.

    I'd like to state though that I have not used a "bacpac" for a restore nor do I have any experience with Azure SQL VM's.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • The import process when you import data tier application creates a package, create a database and then does the import.

    However, running sp_configure worked.  I was able to migrate all of my database to the new environment.

    Thanks.

    Things will work out.  Get back up, change some parameters and recode.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply