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.
Related
I have the server
DESKTOP-TI7M67V\SQLEXPRESS (SQL Server 12.0.2269 - DESKTOP-TI7M67V\joe)
It is a SQL Server 2014 database engine using Windows authentication.
I need to create a new server, database engine with SQL Server authentication this time, that I need to connect and view into the same SQL Server Management Studio instance I use for my server by now, since I need to create queries involving both.
I've seen that I can do it with linked server feature, but I need to create and setup the new server correctly.
The access to this new server, obtainable through SQL Server authentication, must have different authentication parameters than the other one already existing, if a user doesn't have them, he would be able to access the old server, but not the new. The access of both servers has to happen in the same SQL Server Management Studio instance.
Plus, the databases files of this new server must be portable. For portable, I mean that all its files (that make it work) must be able to be put in a custom directory on two pcs, with SQL Server 2014 already installed on both, and be copyable and pastable, e.g on a pendrive, in order to be transferred from a PC to the other. That's for maintain synchronization between two different physical users workplaces in which the database will be used, workplaces that for the moment are not directly interfaceable with a single, fixed, detached and interconnected source on which place the database.
My question is how to create a new server that would have these features.
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).
how to compare schema and data of two different databases and synchronize the latest changes in target database through c shrap Code. Note: i'm working on Desktop Application with Sql Server 2014
Explanation:
i'm working with Desktop application on visual studio 2013 and sql server 2014.
i want my application to work with local database, but after a specific time i want to sync new entries OR new schema changes in remote database having the exact same schema as local database. I want solution in c# code. may be stored procedure can also helpful.
in my development environment we support the application both on MSSQL Server as well as Oracle. The database schema of both of these RDBMS are same.
while development we found that the developer made a mistake and forgot to change the oracle database for the last 1 yr. therfore the oracle script is quite behind in term of schema from SQL Server schema script.
now the question is how i can compare the two RDBMS systems to find the difference and make the oracle script updated
If there are no track log from which it's possible to find and reproduce all changes applied to SQL Server since first detected inconsistency with Oracle version, or that changes was applied, but only partially, you really need to compare objects presented in both databases.
In this case setup a link between databases on any side and use system dictionary views to compare table structures and other objects to find differences and, possible, to generate script for Oracle scheme rollup.
If you want to act from MS SQL Server side:
Install and configure Oracle Instant Client
Install Oracle ODAC
Follow Microsoft recomendations (64-bit version)
Connect as any user with dba role (or use same Oracle schema where object resides) to Oracle from MS SQL database
If you want to act from Oracle Server side:
Install and configure Oracle Database Gateway for SQL Server.
Create database link to MS SQL Server.
After successful configuration you may join Information schema views on SQL Server side with Data dictionary views on Oracle side to find differences.
Of course there are many troubles at this way like different data types, but it gives a chance to automate at least part of work.
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.