Sync two or more SQL Server 2012 databases - sql-server

I am working on SQL Server 2012 and my requirement is to synchronize two or more databases that exist on different servers or locations.
I have tried this with 2008 by using synchronized option appear when we right click on database name.
But did not get any solution for SQL Server 2012.

I have done this successfully using Service Broker on a database that needed to sync only specific data (ie. sync clients and orders between a web and a local database).
It is a bit painful to set up, but works brilliantly once in place.
That said, I wouldn't do it if you need to replicate the entire database.

Related

Present databases on 2 SQL Servers like they are all on 1

I have 2 SQL Servers, with several different databases on each. I want to present them as a single SQL Server showing all of the databases on either Sql Server.
We have yearly archive databases, so 1 database for each year. This year we decided to deploy a new SQL Server that will host newer years, so older yearly databases are on the old server, and future will be on new one.
I know I can link the servers, but I am not sure if I can do it in the transparent way so that no application has to change the query - so far I always had to use linked server explicitly in each query that uses it.
TLDR: I want to access databases on another SQL Server via main SQL Server so that app doesn't know or care about SQL Server details and don't need to have if (Year > 2021) {then use this server } else {use that server} type of logic and can behave like all databases live on the same server.
You can follow the below steps:
Create a linked server pointing to older server
Create an Empty Database in the new server, corresponding to older database in the older server.
Create synonym for each object in the older database in the Empty database
Now, When you refer to synonyms in the empty database, it will appear as if the older database resides in the new server.

What are my options for accessing an SQL Server database through MS Access front-end while offline

I'm currently working on a project proposal which would require moving multiple Access databases into a new MS SQL Server database. The idea is to keep the front end program as MS Access so that the users are familiar with the process of inputting data and creating reports.
However, things get complicated in that the internet in the areas where the survey will be collected has poor connectivity and will be out from time to time. I had thought of a few ways of solving this issue but all of them are cumbersome:
1) Having a PC with a router that stores the SQL Server database in offline mode and the data entry PCs connect to the PC with the offline database through the router. The PC with the SQL Server database can then backup the db on the server when it has an internet connection.
2) Adding the data to MS Access databases that can then be merged with the SQL Server at specified increments (this would probably cause some issues).
We've done option 1 before for similar projects but never for connecting to an SQL Server database in offline mode. However, it seems feasible.
My question is: Does anyone know of a way of using Access as a front end application for SQL Server and being able to update data during times without internet connectivity? The SQL Server database would automatically assign primary keys, so, duplicate unique values shouldn't be an issue while syncing the data.
Thanks for your help. I've been having a hard time finding an answer on Google and syncing to databases is complicated at the best of times. I'm really just looking for a starting point to see if there are easier ways of accomplishing this.
I would run a the free editon of SQL express on all laptops. So the Access database would be the front end to the local edition of SQL express. SQL express can be a subscriber to the "main" sql database. You thus use SQL replication to sync those local editions of SQL server to the master server. Of course the main SQL server can't be the free edition of SQL server. So to publish the database for replication, you can't use the free edition, but those free editions can certainly be used as subscribers.
This approach would eliminate the need to build or write special software for the Access application. You thus do a traditional migration of the access back end (data tables) to sql server, and then simply run the Access application local with sql express installed on each laptop. You then fire off a sync to the main edition of sql server when such laptops are back at the office.
The other possible would be to adopt and use the net sync framework. This would also allow sync, and would eliminate the need to run sql expess on each machine. I think the least amount of effort is to sync the local editions of sql express with the main editon of SQL server running at the office (but that office edition of SQL server can't be a free edition).

Migrating to Azure Sql Database with external dependencies in another database

The question: Is it possible to point a view in database A running on Azure SQL Database service to tables/views on a SQL server running in a VM? I've tried external tables but come up short.
Scenario:
Two applications that is exchanging data, from two different vendors.
We've got three databases in total. One for each application and an integration database with views that both applications use either directly or through views.
The issue now is that we want to migrate to Azure and would prefer to use the Azure SQL Database service as much as possible, but one of the applications is not ready for it and therefor it's database has to be hosted on either a managed instance or in a VM.
The issue now is that there's view's in database A (running on Azure SQL Database service) that points to views and tables in the integration database, which again references tables in database B (running on SQL Server on the VM).
The short answer is "no". You can use external tables to query other SQL Azure databases, but there is no exact analogue for linked servers in Azure SQL Database. You can use SQL Azure Managed Instance (which supports SQL-SQL linked servers but not arbitrary linked servers).
There is a workaround, however. You can run SQL Server in an Azure VM and have it point to SQL Azure as a target as well as the other sources you want to connect. Then you can push data to/from Azure SQL DB using the SQL Server in a VM. You don't have the same management overhead in this approach since you don't really need to host data in the SQL Server if you don't want to do so. Note that this will be slower than doing direct connections to SQL Azure, but you can try to do this for a period of time if it would help you during a migration.

Filter database names in SQL Management Studio 2008 R2

I'm trying to connect to my database that is located in a server with lots of other databases (that belongs to other people that are on the same hosting company).
Due to my low internet speed after I connect as I click on expanding databases most of the time I get no results waiting.
Is there a way that I can filter databases that only would load my databases ignoring the others?
Consider denying the server permission VIEW ANY DATABASE to yourself or ask the server's DBA to do it.

Occasionally connected application (SQL Server data synchronization)

There is a central server that is running SQL Server 2008 R2 and WinForms clients, which use SQL Server CE to cache data. Data can be changed on both the server and client side. Each user can only edit his own data and view some of the data of other users. For example, a user can create a "Contract" and upload it to the server via synchronization, other users need to see this "Contract", except for customer's contact information, etc.
What a way to synchronize data is most suitable for this task?
Thanks in advance.
you can use Sync Framework to synchronize the local cache to a central server. You can either use the Local Database Cache Wizard in Visual Studio or code the sync yourself.
see Synchronizing SQL Server and SQL Server Compact
or Programming Common Client and Server Synchronization Tasks

Resources