Move SQL Server database with Change Tracking enabled - sql-server

I have a number of database on premises that use change tracking to enable 2-way synchronisation with remote disconnected clients; the idea being when the clients connect online they sync their changes and pull down all others.
I need to move the database to an instance on a virtualised server in Azure (note: not Azure SQLDB) but every option - backup/restore, bacpac, etc - seems to reset that version number that SQL Server uses for Change Tracking.
Does anyone know of a way of moving a SQL Server 2012 database to another instance and retaining the Version Number and existing change tracking info?
Thanks

Related

SQL Server : the server principal *** is not able to access under current permissions

I am trying to set-up/test SQL Server row-level security for my database. I want to use row-level security for SSRS reports and Power BI. The database is set up on my test PC using SQL Server Express with SSMS.
On my test PC I have set up a separate account -- separate from the user under which I established the SQL Server and database. I believe I have set-up the SQL Server level permissions and database level permissions appropriately(?) for the separate user.
I go into the separate user account and continually get the
Server principal **** is not able to access under current permissions
message in SSMS and cannot access the data in the SSRS localhost website.
Is the separate user, established on the same PC, not considered to be in the same domain as the PC user who established the database? Is that what is causing the problem? If so, how can that be overcome? If not, any ideas what my problem might be? Is there some constraint in SQL Server Express that I need to establish the database using a SQL Server Developer edition?
I prefer not to wait until the database is established on the system test server to determine how this will work. Many thanks for any thoughts or suggestions.

VS2013 Project MS access and SQL server synchronization

I will try make this question clear as possible.
I have not found solid help on google really or anywhere else.
To make it short and simple.
I have a vb.net project in which i want two databases.
A local access database which must be created within the project at design, meaning at publishing and then installing this program to another user it must automatically create an acccess database on that user's computer,sync it with a SQL remote server and copy all records at first time run to the access database. The access database is used when my worker is on site and there is no connection to the remote SQL Server database.
Upon achieving connection to the remote SQL Server database at e.g. the office, the access db must update the SQL server database,compare the two databases and copy any new records in the local (Access Db) to the remote sql server and vice versa.
Hope this is clear enough?
Thanks for any help

Connection string for Sql Server in Azure VM

If I only have one VM in Azure I can get outtages at any time when Azure decides to reboot/reprovision my server. Therefor I have to at least two servers in an availability group to get a stable environment.
This is used by a web app (web roles) and an important aspect is that the databases are used for reading. They will get their data from sql replication from an on-premises database. The replication can be done separately to each database. Additionally using Azure Sql Database is not an option because we have not be able to implement a durable data sync solution (using Microsoft Sync Framework), Sql Database does not support sql replication, and constantly uploading the complete database would be too slow.
How should the database VMs be hosted and accessed to able to use Sql Server VMs?
One alternative is to use AlwaysOn Availability Groups. This however requires Sql Server Enterprise edition and the price is very high considering I need to have at least two servers. In this scenario I at least get one connection point behind which a sql server always should be answering. This is however beyond our reach because of the cost.
One alternative could be to use Traffic manager to round robin the connections. When the database server goes down we have to wait for TTL to expire before the webrole would refresh the ip address so that seems a big problem.
How should one host Sql Server VMs in Azure?
You can use FailoverPartner parameter in the connection string to specify the secondary replica address. You can see more in this article.

How do I publish SQL Server Database to Azure to update existing database

I publish my SQL Server database on my local machine to Azure via Management Studio.
Say I name the database on Azure "California". The first time I do it its ok.
Then I made changes on my database on local, adding columns, adding data, etc. Then I want to deploy this database to Azure again.
But now Management Studio won't let me do it. It says database "California" already exists on Azure.
I can get away with this problem by deleting existing "California" on Azure first, then deploy again. But this seems not correct...Every time I make database changes on local, I need to delete the one on Azure before I deploy?
Does anyone know how to solve this problem?
The best way is to create a database project in Visual Studio to maintain your database schema and then you can do a database compare to create a script to update the database on Azure.
http://weblogs.asp.net/gunnarpeipman/archive/2013/01/28/using-visual-studio-database-projects-in-real-life.aspx
RedGate Schema Compare will also do a similar thing.
Update Jan 2020
(I'm assuming the question is to update the schema on Azure, not update data)
If you are using Code First for creating your database. Then it is really simple.
Assuming your connection string is pointing to a local database (the one you want to update to Azure)
Make the changes to your entities
Create a new migration for those changed (Add-Migration etc)
Update the migrations to your local database.
Now just change the connection string to point to your Azure database
Update the migrations again, which will now update to the Azure database
Voila! That simple
I know its been a while since the question was asked, however, there is no accepted answer. Thus to aid anyone coming here with a similar issue the following link describes a number of methods.
I prefer deploying a SqlDb from SQL Management Studio
http://azure.microsoft.com/en-us/documentation/articles/sql-database-deploy/
How to: Deploy to SQL Database
In Management Studio, connect to an on-premises SQL Server instance that has a database you want to migrate.
1) Right-click the database --> Tasks and click Deploy Database to SQL Azure.
2) In Deployment Settings, enter a name for the database.
3) Click Connect.
4) In Server name, enter the 10-character server name, followed by .database.windows.net.
5) In Authentication, choose SQL Server Authentication.
6) Enter the administrator login name and password that you provisioned when creating the SQL Database logical server.
7) Click Options.
8) In Connection Properties, in Connect to database, type master.
9) Click Connect. This step concludes the connection specification and takes you back to the wizard.
10) Click Next and click Finish to run the wizard.
If you are using SQL 2012, you can export a data tier application (bacpac) file, then import that when you login to your SQL Azure instance.

SQL Dependency with SQL Server express 2005

Is it possible to use SQL Dependency with SQL Server Express 2005 which comes with VS 2008?
Yes. It works fine with named instances as well as default instances, on any SKU (Express, Web, Developer, Standard, Enterprise and Data Center). You can read The Mysterious Notification to understand the underlying mechanism that powers SQL Dependency.
When you open a database using the connection string option AttachDBName you are using a User Instance (aka RANU). The user instances attaches the MDF file using and by default a newly attached database will disable Service Broker in the database. Because the Query Notifications use Service Broker to deliver the notification, it implies that a database with Service Broker disabled cannot create a notification subscription, unless it takes the necessary steps to re-enable Service Broker.
This article suggest that it will work fine as long as the express edition database is a named instance:
http://www.code-magazine.com/article.aspx?quickid=0605061&page=5
HTH

Resources