Database copying - sql-server

I have one database which is updated every minute, i should do some transactions using the DB.
But the same DB is used by many applications, so to do my transactions can i create a copy of the DB in my server. When the records are updated in the parent DB even the values in my DB should be updated. I would use the duplicated DB only to query records there will not be any updates/inserts.
Is there a way to achieve this in SQL SERVER 2008

Related

Fetch every record from Oracle Database and Insert it into SQL Server database table without missing of any data?

I've setup a SQL Server job to fetch data from Oracle database to SQL Server database table but whenever bulk data need to be fetched, the job fails to insert every possible records into SQL Server table.
The problem is found to be in SQL Server while trying to fetch data from Oracle Server using linked server and SQL jobs.
insert into customers
(
address,
name
)
select address, name from openquery([192.168.255.255],'select address, name from customer_info
where last_login_date > '''+#date+'''')
The problem arises when there are bulk of records to be fetched from Oracle server database to SQL Server database table. For example, If 500 records are to be fetched from Oracle Server, then only half or less records are being inserted in SQL Server database and half of them are missed out.
Please note that I run SQL job every 10 seconds. We must run the job every 10 seconds, so request to provide some means or ways to extract every possible data by any means possible.

SSIS update DB2 database from SQL Server

I have an SSIS package which imports full table data from DB2 database and loads in SQL Server on a daily basis. At the end of the day I need to post only updates (only some rows of table which are edited) to DB2 from SQL Server.
I have couple of options to do this task
Write a stored procedure using linked servers and update only required rows to DB2
Use script component in SSIS and perform row by row update.
Both of them can work, however I don't want to use either of them. Is there any other better solution apart from these which I can perform in SSIS?
Note : I cannot truncate and load all records from SQL Server to db2 as this is not a feasible solution.
Thank you

Sync two database tables SQL Server

We have two databases, one at our client's site and another (Main) in our data centre.
Both databases have the same schema, we want to sync the databases periodically (twice a day) so that both should have the same data.
We are you using SQL Server 2008 R2.
Please suggest a good methodology.
The number of rows modified is approx to 400 rows a day
You can create a Job that selects from the client's database tables and inserts in your database tables.
If both the databases are in different servers you can create a linked server at your server and connect it to the client server.
Then you can schedule the job to run whenever you want.

Run PostgreSQL stored procedure from SQL Server

I have a database in SQL Server which contains collected data during one day, and a database in PostgreSQL with OSM data. I need to modify collected data in order to create reports for my users.
Now, I imagined that somehow call PostgreSQL procedure from SQL Server, pass collected data to PostgreSQL, do something with that data, and return another result set to SQL Server for creating reports.
What is the 'most efficient' way for achieving this? OR, better question atm, what is the way for achieving this functionality?
My idea is to connect SQL Server and PostgreSQL with PostgreSQL ODBC driver, then copy data from SQL Server to PostgreSQL table, run that stored procedure on PostgreSQL, and return data to SQL Server result table. But, it is not scheduled task. Data to be transferred to PostgreSQL contains latitude, longitude and bearing for about 2-3 million of rows and function which analyses them requires one per one record, not all at once.
My way is using C# and npgsql to connect to postgres.
I create an app:
check SQL Server every min.
check Postgres for the last id inserted.
create a dataset from MSQL with the news ids
insert the new records into Postgres.
run postgres store procedure to generata new data
create separated webservice to consume the report generated on postgres.

best way to syncronize 2 databases

I have 1 database sql on the Microsoft CRM and 1 remote local database sql. They have different schemas.
I must maintain both syncronized (2-way sync).
They can't communicate directly. So in the middle there is a rest service and a temporary database.
So, everytime there is an insert or an update on one of the database, the insert or the update is propagated to temporary database and from temporary database to the destination db.
I don't know how to manage conflicts. For example, in both db I have the table PERSON. In a database I update the name, in the other I update the birthday. How can I sync both db without lose both updates?
Thank you

Resources