Sql server 2008 R2 - synchronization of two databases - sql-server-2008

I have two databases with the same schema.
Database A : Production database
Database B : Test database
Database B contains outdated data and I want to synchronize it with the Database A.
I want all the data from Database A in DataBase B .
How can I do that without having to create a new database or detach the production database.

You can create a backup on the source server and then you can restore it on the destination server. (Please note, that all custom settings will be reseted on the destination).
If you do not want to restore all tables, then you can either build some SSIS packages which packages syncronize the tables. (Build one package per table based on a template package) or you can create a Linked Server on the destination server and write some stored procedures to sync the tables.
If you are familiar with SPs and dynamic queries, you can write an SP, which dynamically builds the syncronization query based on the table's meta data.
Another option is to use a third party software like Red Gate's SQL Data Compare
It is easy to schedule SSIS packages and SPs so if you want to run the sync based on a schedule, choose these options.

Related

Real-time data transfer via ODBC from MS Access to MYSQL

I'm currently working on a Attendance & Payroll System. The developing appliction should be able to import the data from Finger Print Scanners.
The client already has 15 finger print machines installed at their premises and it exports to an MS Access database with the following fields
Employee ID
Date
Check-In
Check-Out
The system which we are going to develop will have a seperate MySQL Database.
How can i transfer the data in real-time from MS Access to MySQL?
Whenever a user punches their thumb it autmatically updates the MS Access database.
I want to do,
Data Migration for existing data - This is already accomplished
Transfer all real-time new data to MySQL
How can i accomplish the 2nd task?
I tried using an ODBC connector to mysql. it pulls the table from MySQL to MSAccess. I want to it other way around. ie. Pull the data from existing columns and insert it to mapped table in MySQL.
How can i do this?
You don’t need to transfer the new data.
What you do is use linked tables to MySQL so that all data resides on the MySQL server at all times.
Access is perfect able to use “linked” tables to Oracle, or SQL server or MySQL. When you use linked tables, then access functions as before, but ALL table data is live edited and is on the server – no transfer or sync is required.

insert data to nonlinked server using SSIS

I have two sql 2008 R2 servers, which are not linked. I need to read data from server A and write them to server B. Best way is to use SSIS.
But the data insert has to be generic, that means, I do not know the table structure. I have sql queries ready (when I run them on linked server, it works), but SSIS with oledb source and oledb destination needs table structure to do the column mapping.
how can I run dynamic sql task using SSIS and be able to read data from server A and insert them to server B (and then perform rollback on error)?
Your best bet is probably BiML, which dynamically creates SSIS packages based on meta data.

SQL Server 2012 - Data Migration to a database with modified schema

We have a database in production running on SQL Server 2012, the database was copied and then changes were made to the schema, structure, relationships during further development of our application that uses the database.
We are now ready to migrate the data from the old production database to our newly developed database. We spent a late night last night trying to figure out how to get that done using Red Gate's SQL Schema Comare, and SQL Data Compare. We were not very successful as kept getting errors during the SQL Schema Compare Deployment.
The options and features of Red Gate's tools are very extensive and I don't have much experience using them. I tried creating migration scripts within SQL Compare, but as the databases weren't linked up to source control prior, I don't see where or how to write these scripts.
The question I have is what is the proper sequence to migrate data using Red Gate's tools, or would it just be easier to create SSIS packages to handle it all. The amount of records we are migrating is relatively low less than 10,000 records. We would like to preserve the identity values as we have some scripts that may depend on the specific identity values.
Any tips, suggestions, and comments are much appreciated.
Thanks

What's the best way to get table creation scripts from a table created in VS 2010?

I've been playing around with hosting on discountasp.net and am in the process of hosting my second web app. Being that discountasp charges you per database and not per sql server or total space used by all of your databases, both apps need to share one database
I need to create all of the tables from the database used by the second application in the live database. I can't just import the mdf file because that would drop all of the data already stored by the first application. Is there a way to automatically generate the scripts or simple sql commands to create the tables in the mdf file from within visual studio?
Also, since multiple applications will ultimately use the same database I'd like to add a prefix to each table names - like App1_Table1. Is there a simple way to rename tables inside VS 2010? Further is there a way to rename the tables but have the entities framework ignore the prefix when generating it's classes?
Thanks for your help, your answers will save me a ton of time I could be programming with :).
There are many options available to you.
In Visual Studio there's database schema compare functionality.
ScriptDb is a simple console app written in C# that uses SQL Management Objects (SMO) to script all the objects in a database. It will work against any SQL Server 2000 or 2005 database. It creates a directory tree structure with a similar hierarchy to that in Object Explorer in SSMS, with a separate file for each object.
There's also an option to script database objects from SSMS. Right-click on a database -> Task -> Generate scripts.

Trying to Export Data from an unusal Access Database with Synonyms

We use a product called SalesOutlook which is a type of CRM system. I need to export data from this using SSIS or some other program.
When you install the program, it creates a DSN on my system called SalesOutlookReports. It use the Microsoft Access Driver (*.mdb).
When I try to look at it using Crystal Reports I see a list of tables like:
SchemaAccount Contacts
SchemaAccount Profiles
SchemaNotes
And then under that is another folder called Synonyms and it contains
Account Contacts
Account Profiles
Notes
If I open the synonyms, I get my data, if I open the schema tables I get the meta data about the table.
My question is this. How can I easily import information from the tables I need into SQL Server for manipulation? How can I designate the synonyms instead of the "tables" so I can import the data? I cannot find a way to do it using the import/export wizard with SQL Server nor in SSIS. Perhaps I could use a linked server from SSMS?
ODBC connection in SSIS Data Flow Task should do the trick. Place a Data Flow task and then inside that you can select an ADO.NET data source. You can connect to an ODBC connection using that datasource. Select your MS Access database and voila you have a source. You can add derived columns if you need to adjust the data type and finally connect it to an OLEDB destination, which would be SQL Server.