How can I replicate a table from SQL 2000 to SQL 2008? - sql

I have a table on a SQL Server 2000 database, which I want copied verbatim to a 2008 server.
I tried to do it manually with INSERT/UPDATE triggers, but this technique runs in a distributed transaction, which does not work because I apparently have to enable MSDTC and the firewall; I don't want to do any of that.
Are there any other ways to replicate that table (in real-time) to the 2008 server?

My first question would be do you really need it to be replicated?
If you want to reference it real-time in Sql 2008, just do a linked server with a Synonym. This will make the table act like it is part of your schema, with minor limitations.

Have you tried to create a scheduled DTS/SSIS package to do the work?
Is it copying or replication? Copying implies a one-time action while replication implies an open-ended period of time during which these tables will be synchronized.

Related

Complicated Database Migration

I have a database that I need to move and I need to meet the following goals:
I have to change the collation
I need to upgrade it from a 2005 DB to a 2008 DB with all keys and constraints intact.
I would think this would be a rather simple procedure, but it appears to be hugely complicated. Mostly I am sure I don't understand the complexities I am dealing with. Here is what I have attempted to accomplish what I am doing:
A. I have used the SQL Manager to import from one database to another. While this works great for fixing the collation, I lose all the keys.
B. I scripted the table creation so I get all the keys and constraints, but then can't import the database because of them.
I am not any SQL expert by any means, but I love learning. I have been working on this for weeks and just want to get it done at this point. Any help would be greatly appreciated.
Some other notes: I am running MS SQL Server. A 2005 as default instance. A 2008 as a named instance. Both of these run on the same server.
Found a blogpost with a script that alters all collation on database objects. Haven't tried it out myself so use with caution!. Always make a full backup or even better use a non production server to try it out.
Alter the :SETVAR variables to correspond with your database and collation.
Once the collation is set right you can create a backup on SQL server 2005 and restore the database on the SQL server 2008 instance. There should be no need to import the database.

is a generic query for verifying and fixing table possible?

Is it possible to build a generic query that verifies and if needed corrects a whole table schema?
Example:
On my dev machine i have a sql server with some tables. I, and others, make changes to the tables and sometimes misses to notify the others about them. :/
I want to build a query that reads the dev sql tables and creates a query that i can run one another sql server and updates that table there so that they are equal.
I cant drop the table and recreate it unfortunately. I dont want to change any of the data.
If this is to hard with sql syntax is there some tools that can do this for me? The sql tables are almost always on different machines and most likely i cant connect directly to them from the same place. So tha fixing/verifying needs to be done "offline".
Time is not of the essence, it can be a very slow query as long as it works.
update: I want to verify the sql schema and not the content of the table
update2: We are using SQL Server 2008 R2
It is possible, but not easy. This kind of tool is called a Data Dictionary, and you can write one yourself (see advice from the Database Programmer) or you can buy a commercial one, for example RedGate's SQL Compare.

Best way to sync SQL 2000 and 2005 databases

I have a production database in SQL 2000 and a SQL 2005 instance will be installed in a new server. I would like to have an updated copy of one SQL 2000 database in my SQL 2005 at anytime.
What is the best way to implement database sync between this two SQL versions?
You can create an SSIS package to do this and schedule it as a job.
Or if this is development machine that you want to keep you can do all the development on the 2005 database in scripts kept in source control (which is of course what you should be doing), then you take the most recent backup, restore it to the database and run any change scripts you need.
Or use Red_gate's SQL data compare. It costs money but its worth it.
if "anytime" means you need the data to be updated as soon as it changes, i would think about triggering the tables on the 2000 server to mirror the operation on the 2005 server.
or, a DTS on the 2000 server might do the job, but i have no experience with those (they are also deprecated if i'm not mistaken).
or, some scheduled jobs might keep data in sync between the servers (but they'll be out of sync until the next job run)
hope this helps, myself i'd go with triggering since it's a "set and forget" approach.

Sync between Sql Server and Mysql Server

I have 2 big tables in sql server that i need to sync to mysql.
now, i need that as an ongoing process.
the tables are 1 GB each and getting new/update/delete row every 0.1 second.
Can you recommend me a tool that can do it that is not resource expensive.
you can offer OPEN SOURCE and commercial as well
Thanks
You could create a linked server instance in SQL Server, pointing to the MySQL instance. This article gives the step-by-step process. Once that is in place, providing you grant the MySQL user you connect on behalf of proper permissions, you can write to the MySQL instance as you like. So you could easily update stored procedures to do an additional step to insert records into MySQL.

SQL Server 2005 replication triggers - how to?

I need to run the replication of one table in SQL Server 2005. Replication should be one way. From 1 master server to many children servers.
I thougt about snapshot replication, but I don't want to schedule it only for example every hour/minute ect. (I know how to do this.) but ALSO triggered it evry time new data appears in master server's table.
Is there a way to do it? Which type of replication should I use and how to configure it?
Can you use transactional replication?
http://msdn.microsoft.com/en-us/library/ms151176%28SQL.90%29.aspx