Failed to delete the database: DBName.
ErrorCode: 400
ErrorMessage: Database 'DBSync' cannot be deleted because it is used as a sync metadata database which still contains sync groups and/or sync agents.
We dont have access to the VM in which sync was installed , any way to force delete DB.
As #Miguel said, we should close all connections of the db, then we can delete the database. We can use SSMS to do that.
Related
I have configured Azure Data Sync between our SQL on-prem and Azure SQL. Sync direction is to Hub (Azure) and conflict resolution is set to Member Win. Sync group has been configured successfully, and I have selected the tables I want to sync in the Hub (I synced schema previously using Data Migration). I have 83 tables that are selected for synchronization.
Problem: When starting the synchronization, I receive the following error:
Database provisioning failed with the exception "SqlException Error Code: -2146232060 - SqlError Number:3906, Message: Failed to update database "*****" because the database is read-only. SqlError Number:2759, Message: CREATE SCHEMA failed due to previous errors.
Why would Data Sync be attempting to CREATE SCHEMA on my read-only on-prem instance, when I have configured it to synchronize in the other direction?
Appreciate any insight you can offer,
Cheers,
You need to give dbowner access to role you are using with agent so that it can create a schema initially. It will create schema and tables with datasync.tablename that will have sync logs for respective table. If you sync 10 tables then 10 such tables will be created.
In my setup I have 3 databases:
On premise database
Hub database (azure)
Sync database (azure)
The on premise db syncs to the hub (client wins) the hub syncs to the sync db (hub wins).
In my db's 3 tables have changes, 2 only receive inserts, 1 has inserts, deletes and updates.
Most of the time all works well, but sometimes updates to some (not all) records don't work. Once they stop working for a certain record they never work again.
The above problem only occurs on the sync from hub to sync db. Until now the sync from on-premise db to hub is correct.
Until now I solve the issue by removing the table from the sync rules, deleting the contents from teh table and re-adding the table to the sync rules.
The table where the problems occur only has 1 primary key field and this is not the field that needs to be updated.
When I check the sync logs they all state that sync was successful, no errors, no warnings...
Our application has in-built functionality to update the database it uses (triggered when an app update is downloaded from our server.)
Usually, the update comprises of table and data conversion and then a drop of existing stored procedures and a create of all current stored procedures.
So we do the following from C#:
Create Connection
Set database to Single User Mode
Run upgrade script to upgrade tables and convert data
Run upgrade script to drop existing stored procedures and add new ones
Set database to Multi User Mode
Close connection
Step 2 -5 are done using the same connection. For some clients it occassionaly errors out in the middle of Step3 or Step 4. The log shows:
Error: Database 'MyDB' is already open and can only have one user at a time.
This is very strange because at that time we are already in Single User mode so no other user should be able to connect to the database, let alone somehow put it in Single User mode for its own connection.
We are wondering if some internal SQL Server process is taking over our Single User mode and preventing us from completing the update.
We are aware that if AUTO_UPDATE_STATISTICS_ASYNC is turned ON this may interrupt Single User Mode, but we have verified that it is turned off and it still occurred for the client.
Could a CHECKPOINT operation interrupt it? If so, what do we do about that, because that is a server-wide setting so we cannot modify it.
I am using Microsoft Sync framework to synchronize an Azure database with a local SQL Server 2008 database. Everything is working fine. But I have a small problem as mentioned below
I am synchronizing in one way (ie) from Azure DB to local DB. Insert/update/delete on Azure DB gets synchronized with local database. But I tried to manually update a record in local DB using normal update statement. Also I updated the same record with corresponding new value in the Azure DB. Now the record in the local DB is not getting the updated value from the Azure DB. This problem happens only after updating a record manually in local database.
Please help anyone.......
that's because you're now encountering a conflict. when both copy of a row is updated on both ends, you end up with a conflict and you need to tell Sync Framework how to resolve it (e.g., Retain local copy or overwrite it)
see: How to: Handle Data Conflicts and Errors for Database Synchronization
We are using SQL data sync tool to syncronize on premise DB with cloud. But while provisioning, the data sync throws up the error message that it requires ALTER DATABASE.permission for the SQL id on SQL Server on-premise Database. We did lot of digging to find out the reason and it looks like it uses ALTER DATABASE command to change the <change_tracking_option>. Does this mean if <change_tracking_option> is enabled, it will not create the change tracking triggers for each tables? But if it does create it , then why it requires ALTER DATABASE permission?
SQL Azure Data Sync is based on the Sync Framework and I think this is happening because the Sync Framework is trying to enable snapshot isolation on your database.