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

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.

Related

SQL Sync Verification in WPF

So I am designing an WPF application that needs to support offline functionality.
That means I will have a local database that syncs with the master database when available. My questions is in regards to the integrity of the data sync. I want to verify that the changes that are being synced to the master database are actually being made in the master database. Vise versa as well. What ways should I approach this issue. It may be worth noting that I am by no means a DBA and have just trouble shooting experience when dealing with SQL.
Asuming you have SQL server as master and SQL express on WPF you need do several things and the best I can do is point you a tutorial
Tutorial: Synchronizing SQL Server and SQL Express

SQL Database with Remote Connections

Hello I am looking for a little Direction / Guidance. I have built an application in vb.net using visual studio for my company that manages people and equipment. This application is installed on multiple computers in the office and updates a Microsoft Access Database which resides on one of our local Network Servers in the Building. What my goal for this is to have the application access the database from any location in or out of the network. I originally built this around an Access Database because it seemed the easiest at the time, I would like to re-create this in an SQL Database but am unsure how to and or what I need to do so I have this access with the application. I am confused to how the SQL database would work with the remote access I guess.. Do I need to have an SQL Engine installed on the Server or can I have the Database file just sitting there and access it through the IP with Username and Passwords? Should I purchase server space somewhere else and go that route? Is there any links or information anyone could direct me to, I have been reading about this for days but am not getting anywhere.. Just looking for some black and white answers to steer me in the right direction!!
Thanks Everyone!
I would recommend Azure. This article describes the process for migrating from Access to Azure:
Migrating Access Databases to SQL Server/Azure SQL DB (AccessToSQL)
All major SQL RDBMS client/server systems are built around the premise that clients will he accessing the relational database management services over a network (almost always over TCP/IP for anything developed or updated within the last couple of decades).
For the nodes (clients) on your local area network this should be relatively straightforward.
For remote access I strongly recommend requiring that they access your network through a quality VPN which has been professionally configured (and, preferably, is being professionally maintained).
As for the question of locally owned equipment vs. a virtually private server (VPS) that's mostly a cost consideration with tradeoffs on reliability of access, reliability of the hardware and storage, reliability and capacity of the backup systems, and the personnel costs and availability.
A well managed VPS offering can get you past all the preliminary hurdles to the point where you can focus on your development right away. The long term decisions about Tue production environment are best deferred until you have some functionality prototyped.

Online and local sql database synchronization

According to my system i have maintained two databases in LAN and online db.But i want to synchronize these two databases. I hope to do this things using microsoft sync frame work.
.http://msdn.microsoft.com/en-us/library/ee819079.aspx
Can i do sync local and online sql db using this? or any suitable method for do this.thank you
Sync Framework is designed for occasionally connected systems, eg. a laptop that can access the corporate network every other day and update its database, but needs to work when it has no corpnet access too. The pairing of Sync Framework is usually a central DB (SQL Server) and local embedded SQL Server Compact or SQL Express on the devices (laptops, phones, tablets etc).
IF the databases are always connected (eg. two DBs in two servers, with 24x7 connectivity between them, even if over Internet) then the appropriate technology is replication. Either Merge or Transactional. Theoretically replication also works when disconnect periods are expected, but Sync Framework is much better at it, and most importantly Sync Framework is not strongly dependent on DNS names as replication is (very important for occasionally connected systems).
Synchronizing the database is a vague term, you have to consider if you want a Master-Slave replication shcme or a Master-Master (the later being very difficult to achieve) and you have to consider what do you want replicated from the database. You also need to consider if more partners will be later added (more databases to 'synchronize'). And you have to be way more careful now about schema changes.

Is it possible to run SQL Express within a Azure Web Role?

I am working on a project which uses a relational database (SQL Server 2008). The local (on-premises) application both reads and writes to the database. I am working on a different front end for Azure (MVC2 Web Role), which will use the same data, but in a read only fashion. If I was deploying a traditional web app, I would use SQL Express to act as the local database, and deploy changes with updates to the application (the data changes very slowly) or via some sync system.
With Azure, the picture is a little cloudy (sorry, I had to). I can't seem to find any information to indicate if SQL Express will work inside of Web Roles, and if so, how to do it. Does anyone know if using SQL Express in an Azure web role is possible?
Other options I could do if forced: SQL CE or use SQL Azure. Both have a number of downsides, and are definitely less than perfect.
Thanks,
Erick
Edit
I think my scenario may not have been clear enough.
This data won't change between deployments, and is only accessed from within the Web Role; it is basically a static cache. The on-premises part is kind of a red herring, as it doesn't impact the data on the web role (aside from being its source). Basically, what I want to do is have a local data store/cache that I use existing T-SQL/DAL code with.
While I could use SQL Azure, it doesn't add anything, and if anything only adds additional overhead and failure points. I could also use a VM Role, but that is way too costly/complex.
In a perfect world, I would package the MDF into the cspkg (so it gets deployed with the app) and then use it locally from within the role. If there is no way to do this, then that is ok and I need to figure out the pros and cons of other solutions. We don't live in a perfect world. :)
You might be able to run SQL Express using a custom VHD but you won't be able to rely on any data every being present on that VHD. The VMs are completely reset when they reboot - there is no physical persistence across reboots.
If you wanted to, you might be able to locate your entire SQL Server installation in Azure blob storage.
However, in doing all of this, you'll only be able to have one worker/web role that can use that database. Remember: a SQL Server database can only be attached to one SQL Server at a time. If you want to scale out, you'll have to create new SQL Server instances for every web/worker role.
Outside of cost concerns, I can't think of anything that is in SQL Express that should be a show stopper for 99.9% of applications out there.
Adding to Jeremiah's answer: SQL Azure should give you nearly everything SQL Express does today, and you can use the Sync service to synchronize on-premise SQL Server with SQL Azure.
If you installed SQL Express into a VM role, you'd be consuming around $90 monthly just for that instance, plus blob storage (you'd want a Cloud Drive for durability). By definition, a VM Role (or any role) must support scale-out; if you were to scale to 2 instances for whatever reason, both instances would need their own copy of the database, so you'd need to create a blob snapshot for each instance.
Keep in mind, though, if you choose to install SQL Express in a VM: once you're at 2 instances, along with, say, 20GB per instance of blob storage, you're nearing $200 monthly and you're maintaining your VM's OS patches, SQL Express configuration and updates, failure recovery procedures, etc. In contrast, SQL Azure at 20GB, while costing the same $200, will offer better performance and works with the sync service, while completely removing any OS or database server management tasks from you.
To add to the already existing answers and for anyone wondering if its a good idea to run SQL Express in the cloud:
it does makes sense as a temporary storage area. Consider this architectural approach:
say you're spinning up nodes to run jobs. Storing a gazillion of calculation results might be a good idea inside a local SQL Express for each node, and provide the aggregated responses immediately when the job finishes on the node. Transfer of the no longer hot results to off-prem SQL server for future reporting/etc can be done afterwords. SQL Azure may not be optimal from the volume/latency/cost perspective to store gazillion of results and ATS will not always fit the bill, especially when relational data, performance or existing code are involved.
To expand on what David mentioned you can register for SQL Azure Data Sync CTP2 that would allow sync from SQL Server to SQL Azure here: http://www.microsoft.com/en-us/SQLAzure/datasync.aspx
Make sure to use CTP2 though since CTP1 did not support SQL Server.
If it's a read only local cache - SQL CE 4 or SQLite.
Both have Entity Framework providers.
If you're writing to it - SQL Azure

Sync two SQL Server databases

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