We have an ISV database which we try to minimize contact with. It is an old 2008 R2
DB. We want to keep a copy of a number of tables in a different database. We are looking for a T-SQL solution to sync tables. This may need to take place when the system is being used.
I appreciate the answer will require further research and testing.
- These tables are prone to locking from ISV app.
- This is a low powered server and not really Enterprise.
- Also we think the number of tables that we sync will increase
- We want avoid anything like replication (the supplier of the ISV has habit of blaming any issues on us with no investigation whatsoever!)
These are my options (the ones I've thought of)
- I've read bad things about MERGE in terms of performance, bearing in mind it's an older db, would this be fair?
- tablediff.exe would be perfect but I'm concerned about locking the source table.
- Is a straight truncate/insert with minimal locking/logging very inefficient – sounds stupid but I thought I'd include it.
Would just truncating and inserting a couple
Best Answer
You have many options, depending on what you want to achieve and the constraints you have on the source/copy database:
JOIN
filters. The subscriber database is writable. Needs to have arowguidcol
on each table (uniqueidentifier UNIQUE NOT NULL ROWGUIDCOL
column), so it can be a deal breaker if you can't touch the schema of the source database. Ships incremental changes quite efficiently.PRIMARY KEY
defined, which is not typically the case in ugly, hairy, legacy third-party applications.RESTORE WITH STANDBY
. Needs to kill all connections before restoring additional t-logs. No filters, no schema changes needed. Interferes with existing transaction log backup schedules.