I have a host on a server and that contains an SQL Server Database.
I have another server in another country and i want have a backup from the database every 5 minutes or after each transaction only insert new row to another database.
After some research i found out i can use linkedservers for this goal.
Is this procedure works for me for doing this operation?
I don't know what the linkedserver will do for you.
You are connected from both server via a vpn?
You are in different network (domain) probably?
If you are using a linked server, it means you will probably create trigger or stored proc. You will have to configure msdtc (for trigger).
You can use :
Replication
Log shipping
Custom replication process
I had to configure 2 times a replications to move the data from a server to another, than manage these data with trigger. It was easier to work on the data localy
Related
I have a production SQL instance and database using SQL Server 2012 Express. I need to archive (on demand) from this database to a different database on a different SQL Server 2012 instance (on a different machine). The archiving process requires that the original data is deleted after successful archiving.
I need to execute in real time and for it to be meaningfully quick to the user. Not much to ask really! The archiving is performed by a user from a browser screen calling a .Net service (in C#).
I am limited to Javascript client (Sencha ExtJS), C# on the back end server and SQLExpress2012 on both database servers.
I have been using a stored procedure on the source database which is called from a .Net service (C#).
The source data to be archived resides on a parent table and 1 or more child tables. The destination database contains tables of the same format. I am currently using Linked Servers to point from source server to destination server. I am using a stored procedure on the source database to execute a distributed transaction between the two databases but the transaction can take 30 seconds to 90 seconds to transfer 5000 parent rows and 10000 to 15000 child rows.
Is there a better and faster way of doing this?
I have considered using table parameters on both servers but I have read that I cannot write to a table parameter within a stored procedure and I that cannot pass them between SQL instances.
I'm trying to save the values of several columns of one table to another table on a different server. I am using SQL Server. I would like to do this without running external programs that query from this database and insert the results into the new database. Is there any way to do this from within the SQL Server Management Studio?
This is a recurring event that occurs every hour. I have tried scheduling maintenance tasks that execute custom T-SQL scripts but I'm having trouble getting the connection to the remote server.
Any help would be appreciated.
If you can set up the remote server as a linked server you should be able to configure the SQL Server Agent to execute jobs that contain queries that access tables on both the local and linked server. Remember that you might have to configure the access rights for the account used to run SQL Server Agent so that it has permissions to read/write tables on both servers.
This practice might not be without issues though as this article discusses.
You can use a 4 part name like;
INSERT [InstanceName].[DatabaseName].[SchemaName].[TableName]
SELECT * FROM [SourceInstanceName].[SourceDatabaseName].[SourceSchemaName].[SourceTableName]
But first you will have to set the remote server as a linked server as so;
https://msdn.microsoft.com/en-us/library/aa560998.aspx
I have an access 2003 database that holds all of my business data. This access database gets updated every few hours during the day.
We're currently writing a website that will need to use the data from the access database. This website (for the time being) will have only read only capabilities. Meaning there will only need to be one way transfer of data (Access -> SQL).
I'm imaging there's a way to perform this data migration from access to SQL server programatically. Does anyone have any links to something I can read about?
If this practice sounds odd, and you'd like to suggest another way to do this (or a situation where data can go both ways (Access -> SQL, SQL -> Access), that's perfectly fine.
The company is going to continue using Access 2003 for their business functionality. There's no way around that. But I'd like to build the (readonly) website on top of SQL Server.
The strategy you outlined can be very challenging. You could use INSERT queries to copy new Access rows to SQL Server, as described in another answer.
However, if you have changes to existing Access rows, and you also want those changes propagated to SQL Server, it won't be so simple. And it will be more complicated still if you want deleted Access rows deleted from SQL Server, too.
It seems more reasonable to me to use a different approach. Migrate the data to SQL Server once. Then replace the tables in your Access database with ODBC links to the SQL Server tables. Thereafter, changes to the data from within your Access application will not require a separate synchronization step ... they will already be in SQL Server. And you won't need to write any code to synchronize them.
If your concern is that the connections between the web server and SQL Server be read-only, just set them up that way. You can still independently allow read-write permissions for your Access application.
To do the initial data migration and set the SQL Server automatically, I would use the SQL Server Migration Assistant. The only thing you should definitely change that I can think of would be to turn off the Identity property on any columns that have it - to be explained below (MS Access calls Identity autonumber). Once you have your tables loaded, you can set up a dsnless connection to the database (and tables) you just created.
I haven't used the method just linked, but I believe it allows you to use SQL Server authentication to connect to the db. The benefit of using this method is you can easily change which SQL Server instance and/or database your are connecting to for development and testing.
There might be a better, automated way, but you can create several insert queries doing left joins from the primary key of the Access table to the SQL Server table, and putting a WHERE clause that specifies the SQL Server PrimaryKey must be null. This is why you need to turn off the Identity property in the SQL Server tables, so that you can insert the new data.
Finally, put the name of each query in one function, then run the function periodically.
I have used Microsoft's free SQL Server Migration Assistant (SSMA) to migrate Access to SQL Server. The tool is very simple to use. The only problem I have encountered with the tool was overloaded data types when migrating. What I mean by this is a small string will get converted to a NVARCHAR(MAX) in some instances. Otherwise, the tool is very handy and can be reused after setting up a 'profile'.
I am attempting to keep a table in Sql server updated from an access table. Any time a change is made in the access table I would like that change reflected in the sql server table. The two tables can be identical. I have created an ODBC connection from access to sql server and can export the table to sql server; I just don’t know what must be done to keep that table updated. Any suggestions are appreciated.
Should this be implemented from within Access or within sql server?
Can you just add the SQL Server table to the Access database as a linked table? (Useful article on how to add linked tables)? That way users (let's hope there's not many!) of the Access database are in effect editing the SQL Server table directly.
If this isn't desirable then how about creating another table in the SQL Server database, and adding this to the Access database as a linked table. Then, add a trigger so that when an insert/update/delete is made to this table the same operation is done on your main table.
I think setting up a Linked Server in SQL Server could be easier to implement than an automatic export of data from Access.
According to the MSDN page,
Many types OLE DB data sources can be configured as linked servers, including Microsoft Access and Excel.
Server-on-SQL-2005-Server/
Access has no "event" that occurs when a row is updated/inserted/deleted that I know of. as JeffO points out data macros that could do what you want.
You could also periodically synch them. There are several techniques to periodically do the synch task (SQL Server Agent, Windows Service, Windows Scheduler, a timer in an application etc.), but still have to deal with all the problems that exist with synchronization if both tables can be modified, the worst being data conflict resolution. There is no easy solution for that.
Perhaps if you explained the problem you have that you are solving with synching data in SQL server and Access someone might be able to point you in the direction of a solution that doesn't have these problems.
my client has SQL Server with some customer info and I am developing e-shop using MySQL database. What we need is to keep the database of customer loyalty points synchronized. When customer buys a product in an ordinary shop (not e-shop) these are recorded on SQL Server (via some accounting app). The problem is that I need this information to get to the MySQL server which stores information for the e-shop application, so the amount of loyalty points gets sync'ed on both servers.
Is there any way how can I send http and/or xml/rpc request from SQL Server via either trigger or stored procedure (I suppose trigger can trigger a stored procedure, so either of these is fine)?
Is it essential to interface with the MySQL DB via xml/rpc?
I might try to accomplish this by linking the MySQL DB to the MSSQL DB... the process will be version dependent so your MSSQL version is helpful...
But this site:
http://www.infi.nl/blog/view/id/4/How_To_MySQL_as_a_linked_server_in_MS_SQL_Server
may be a good start for you
EDIT: And here, for MSSQL2008
http://dbperf.wordpress.com/2010/07/22/link-mysql-to-ms-sql-server2008/