Sync two SQL Server databases - sql

I have two databases: the source is a database from SQL Server Express by client and the target is a database from SQL Server 2005 database as backup initially. What I need is to sync the source to the target db if there is any difference between them and the sync is one-way from source to target.
I am not sure what tools are available. I tried to google this issue and found MS VS Team Edition (2005) has a tool to sync database, which can generate T-SQL scripts as well. Not sure if this one is good or not. Can I use the script as a scheduled job on SQL Server (target server)? By the way, I don't have Team Edition right now but I do have VS 2005 Prof. Any suggestions?

IMHO by far the easiest and fastest way to sync the two databases one-way (A to B) is to backup database on A and restore it on B. This could be done via T-SQL, let me know if you would like me to post SQL statements

Ideally you would set up Transactional Replication from your source to your target(s). However, since your source is Express edition and Replication does not work with Express as a publisher (source) but only as a subscriber (target), you cannot use it.
The best solution would be to upgrade your Express edition to SKU that supports Replication publishing (ie. Standard Edition).
Log shipping, or manual backup/restore, will not work because it will create an absolutely identical copy of the source db at the target, overwritting any changes made by the target (you mention 'some differences' may exist). Same goes for File/Copy.
SQL Compare tools are OK for a one time manual operation, but they fail at automated operations because they always compare the two databases from scratch, ei. are not capable of synching just what changed. As soon as data grows to a sufficient size, the comparison approach is doomed as it has to ship over the entire database for purpose of comparison alone.
Other solutions are to set up pro-active real-time ETL, but the time/cost investment into this is prohibitive compared with the cost of a SE license and deploying Replication.

Pay to play:
http://www.red-gate.com/products/SQL_Compare/index.htm
Free, open source:
http://www.codeplex.com/OpenDBiff

You should into the SQL Server tools produced by Red-Gate. I've found them to be the best around.

If you have SQL Server 05, you can use replication services(this comes with SQL Server). If you open up your management studio, under your server folders you should see one titled "Replication". From here you can setup subscriptions or publications with push or pull syncs.
Here's MSDN's take: http://msdn.microsoft.com/en-us/library/ms151198.aspx

If this is a one time / once-in-a-while thing, you can use SnapShot Replication.
If you need the databases to be in sync all the time, you can use Transactional Replication.
http://msdn.microsoft.com/en-us/library/ms151847.aspx

In addition to Red Gate tools you can try DB Ghost as well http://www.innovartis.co.uk/. It's most useful as a automated build tool, but does also have an user interface to diff and sync databases. It costs ~$350.00

USing microsoft sync framerok
http://msdn.microsoft.com/en-us/library/ee819079.aspx
http://msdn.microsoft.com/en-us/library/ff928525.aspx

Related

SQL Server 2008 R2 Developer and SQL Server 2008 Express Edition, Replication

I was looking for some advise on a current task and sifting though on the net I am not finding anything direct. I have full SQL Server 2008 in my central location and then 5 remote sites that use SQL Server 2008 Express for the database services. I am looking for a way to synch or replicate the databases in the 2008 Express instances back to my central 2008 developer edition instance.
What is blocking me is the editions and what is possible, I have been told log shipping and mirroring will not work with Express editions of SQL Server.
One thought was SSIS maybe from the central location pulling from the express instance, but again I don't know if this is possible.
Any ideas however big or small would be really appreciated!
Thanks!
Neither log shipping nor mirroring are replication solutions. They are high availability/disaster recovery solutions which allow you to have the same database in two (or more with log-sipping) locations. Only the source location can update the database.
What you want is replication, see Replicating Data to SQL Server Express. Merge Replication will allow you to update data at the periphery (on the SQL Express instances).
Note that all scenarios require static and available SQL Express instances. Replication will not work with if the SQL express instances are mobile (show up on the network with different names/IPs, think a laptop being moved around) or occasionally available (again, think a laptop that appears on and off the network as the user opens it in the corp WiFi or at home). For mobile/occasionally connected scenarios the right approach is Sync Framework.
One thought was SSIS maybe from the central location pulling from the express instance, but again I don't know if this is possible.
No, is not possible in practice, because of the impossibility of detecting changes ('what records need to be pulled?') and the lack of support for update conflict resolution.
Another approach, which I did see it deployed with success, is to use Service Broker since is freely available in Express. But it only solves the problem of transport (delivery the changes), and does not address detecting changes (usually solved via either app specific logic or via triggers) and applying the changes (this is not hard to solve though). Update conflicts are hard to handle.

What are ways to transfer tables from Oracle to SQL Server

I've been searching the internet for this question:
What are ways to transfer data and tables on a daily basis from an Oracle's Hyperion to SQL Server 2000?
I am an intern at a company and trying to figure out possible ways to do this. Any help or point in the right direction is greatly appreciated
This is going to depend a lot on specifics. Here are just a few possible solutions:
DTS
DTS is packaged with SQL 2000 and is made for this kind of a task. If written correctly, your DTS package can have good error-handling and be rerunnable/reusable.
SSIS
SSIS is actually packaged with SQL 2005 and above, but you can connect it to other databases. It's basically a better version of DTS. (technically it's radically different than DTS, but has a lot of the same functionality)
Linked Servers
From SQL 2000 you should be able to connect directly to your Oracle database as a linked server. In the pros column this kind of direct access can be easy to work with if you don't have any other technical skills such as DTS or SSIS, but it can be complex to get the initial set-up right and there may be security concerns/issues.
Build Your Own
Depending on what other technologies you use you can build your own application to do the ETL (Extract/Transform/Load, which is what you're doing). This could be in .NET, Java, etc. In the pros column you can use something with which you're familiar but there's a big downside here in that most of the low level type of work is already out there in tools like DTS/SSIS, so why reinvent the wheel?
BCP
You can simply extract the data from Oracle as .csv files (or some other format) and then import them back in using SQL Server's Bulk Copy Process. This can be fast, but there aren't many bells and whistles to go with this. If this is a one-time thing with just a few tables though then this is probably the easiest and fastest way to do it.
Third Party Applications
There are a slew of ETL applications already written out there (Data Import, Data Slave, etc.). They will usually provide wizards and one-click solutions (maybe a few more than one click), but they are also going to cost a bit of extra money.
EDIT:
Given your latest comment, I would probably go with a DTS package that's scheduled in SQL Agent to run daily. You can add in error-handling and have the system email/text/call someone if there's ever an issue (or do positive case reporting - ie. send a message when it's successful so that someone knows that there's a problem if they don't get a message each day.
In our company we use ADO.Net for the same task.
We created a source to Oracle , taking all data and then creating it in SQL server
You could write DTS packages to copy the data, and schedule them to run within Sql Server Agent.
See DTS Overview for information on DTS packages.
Here's a tutorial on creating a DTS package: Creating DTS Packages With SQL Server 2000
Oracle Hyperion is a suite of products, largely unrelated to Oracle's database product. I expect you are referring to a product such as Hyperion Financial Management or Hyperion Strategic Finance. These products have APIs that can be consumed using COM Interop or web services. The data can be extracted from the internal multidimensional database by analyzing the database metadata, creating dimension trees, and then using the information to create selections, that represent subcubes within the database; allowing you to get or set cell data.
I don't know what your level of knowledge of multidimensional databases is, but unless it is substantial you may find the task pretty hard. You also need to get a handle on the particular product API.
My company specializes in these kinds of activities, and we have components for this kind of thing. Drop me a line on my blog if you need further advice.
danielvaughan.org
Cheers,
Daniel
I don't know anything about Hyperion, but SQL Server 2000 is very old and may not have a driver to be able to pull data from Hyperion if the version of that is newer than the year 2000. You may need to look to see if there is a way to push the data from Hyperion rather than pull it into SQL Server 2000. One way i have done this is the past is to create pipe delimited text file from the data base that orginally has the data and palce it in a processing directory. I do know that DTS will process a pipe-delimited text file. So if you can't find a driver to process this data directly, consider if you can push it out to file and then process. You wil have to schedule a time gap between the job on Hyperion that creates the file and the DTS package job. But if you are only doing it once a day, that's prbably not a problme.

replication between SQL Server and MySQL server

I want to setup replication between SQL Server and MySQL, in which SQL Server is the primary database server and MySQL is the slave server (on linux).
Is there a way to setup such scenario? Help me .
My answer might be coming too late, but still for future reference ...
You can use one of the heterogeneous replication solutions like SymmetricDS: http://www.symmetricds.org/. It can replicate data between any SQL database to any SQL database, altough the overhead is higher than using a native replication solution.
of course you can replicate MSSQL database to MYSQL
By using Linked Server in MSSQL.
for that you need to download ODBC drivers. and you can further search regarding how to create Linked server on SQL SERVER.
This option is very easy and Totally free. You can use OPEN QUERY FOR THIS.
By using SSIS Packages.
for that you need the Business Intelligence service of SQL SERVER. you can create SSIS Packages on Visual Studio and run them for replication.
No. At least not without doing a lot of dirty, bad things. MSSQL and MySQL speak different replication protocols, so you won't be able to set it up natively (which is the way you'd want to handle it). At best, you could hack together some sort of proxy that forwards insert/update/delete/create/alter, etc. queries from one to the other. This is a terrible idea as they don't speak the same SQL except in the most common case. Even database dumps which wouldn't really be replication are generally incompatible between vendors.
Don't do it. If you must use different OSes on your servers, standardize the database to something that runs on both.
These two databases are from two different vendors. While I cannot say for sure, it is unlikely Microsoft has any interest in allowing replication to a different vendor's database server.
I work with Informix and MySQL. Both those databases have commands that dump the entire database to an ascii file format. You would need to see how that is done on MS SQL Server; ftp the dump to the server hosting the MySQL server; and then convert the dump into something MySQL can import.

Restore only data with SQL Server 2008

I have notice, that when i am trying to restore DB, it is restoring DATA + Stored Procedures. I want to restore only data from my existing database in sql server 2008, how can i achieve this.
Scenario is
I have Production DB and Development DB, while developing i have made several changes to SPs and Table Structure. My file which i am using to track those changes is lost and now i want all Table Structure + SP's change in DB, and should also have latest data from production DB.
How can i achieve this?
You can't do a selective restore.
You have to restore the backup to another "work" database and then migrate the bits you want to recover into the target database. After that, you're free to drop the work database.
You can use the following two tools, one to sync your objects and the other one to sync your data:
ApexSQL Diff – a SQL Server database comparison and synchronization tool which detects differences between database objects and resolves them without errors. It generates comprehensive reports on the found differences and can automate the synchronization process between live and versioned databases, backups, snapshots and script folders
ApexSQL Data Diff - a SQL Server data comparison and synchronization tool which detects data differences and resolves them without errors. It can compare and sync live databases and native or natively compressed database backups and generate comprehensive reports on the detected differences
Disclaimer: I work as a Product Support Engineer at ApexSQL

How can I synchronize a live SQL Server 2005 server with a dev box?

We have a development box which is inside our network and a web server farm outside.
What's the best way to keep the development database synchronized with the Live Server's [changing] Database and yet still keep it secure?
Are there 3rd party tools that would facilitate this?
Are SQL Server's built-in synchronization features good enough or do they require opening up my network to an unacceptable level?
How can we get this down to a "one-button" operation?
Yes, of course there are plenty of well established third-party tools to do this (SQL Server itself doesn't offer very much really) - the best are:
Red-Gate SQL Compare (for your structures) and SQL Data Compare (for data)
ApexSQL's SQL Diff (for your structures) and SQL Data Diff (for data)
Comparing live/dev databases with a compare tool is a pain for anything more than a few tens of MBs
By the time it's compared tables starting "z" your foreign keys are buggered up with tables starting "a".
Options I've seen/used:
DB mirroring with no failover
Log shipping to dev server
Regular Custom FTP of backups/restore on dev
My preferred option is number 3: you have a regular daily snapshot of what you had last night (for example). On top of that, you verify your backups too and have a reference copy. Mirroring/log shipping simply replicates corruption.