DB Restore — Resolving ‘KILL DATABASE CONNECTION’ Permission Error
An error occurred while Updating Development Machine’s Data With UAT Database:
SQL72014: Core Microsoft SqlClient Data Provider: Msg 4630, Level 16, State 1, Line 1 The permission ‘KILL DATABASE CONNECTION’ is not supported in this version of SQL Server. Alternatively, use the server level ‘ALTER ANY CONNECTION’ permission.
SQL72045: Script execution error. The executed script: GRANT KILL DATABASE CONNECTION TO [ms_db_configreader
Solution Steps:
- Convert your bacpac file to a .zip format (you can edit the file extension from .bacpac to .zip).
- Extract a copy of the model.xml file from the zip archive.
3.In the Modelcopy.xml file, locate all lines containing <Element Type="SqlPermissionStatement" Name="
[Grant.KillDatabaseConnection.Database].[test].[dbo]">
. Replace these lines with the following changes:
<Element Type="SqlPermissionStatement" Name="[Grant.Connect.Database].[test].[dbo]">
<Property Name="Permission" Value="1035"/>
<!-- This part should remain the same as the original -->
</Element>
4.Convert the zip file back to a bacpac format.
5.Add /mfp:”Modelcopy.xmlPath” to the cmd command. This allows you to use the edited Modelcopy.xml in the bacpac instead of the original one.
SqlPackage.exe /a:import /sf:C:\Users\buss\Downloads\uatbackup.bacpac /tsn:dev3-1 /tdn:AxDB_UAT /p:CommandTimeout=1200 /tec:True /ttsc:True /mfp:C:\Users\buss\Downloads\modelcopy.xml
Note : Note: If a synchronization error occurs after data transfer with the following exception message:
System.Data.SqlClient.SqlException (0x80131904): There is already an object named ‘LICENSING_POPULATEROLEPRIVILEGELICENSEMAPV2’ in the database.
To resolve this error, execute the following SQL code in SQL Management Studio:
DROP PROCEDURE IF EXISTS LICENSING_POPULATEROLEPRIVILEGELICENSEMAPV2
GO
Then, restart IIS in Visual Studio and give db senk.
Comments
Post a Comment