March 15, 2016 at 10:58 am
I am just reading data from one dB and inserting into another database.
Is it ok to create linked server on test environment to point to production and insert into table into test?
Would it hurt performance in prod?
Or is it wise to have both databases in Test environment and read and insert from same environment?
March 15, 2016 at 11:24 am
Why not use SSIS to stage the data from the source server to the destination server? Create a staging database (I prefer those but you can use schema in the same one if you like), data flow the data into the staging table, update destination.
March 15, 2016 at 1:28 pm
You can reduce the effect on production by using "WITH (NOLOCK)" on the reads, unless you need an absolutely accurate copy of the data in test. If so, you'd be better off restoring a backup of the prod db to test anyway.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 15, 2016 at 2:08 pm
Thank you
March 15, 2016 at 2:51 pm
To copy rows from source table(s) to target tables(s) with minimal performance impact on both the source database (less blocking) and target database (less transaction logging), I would reccomend using BCP.EXE or SSMS Export Data Wizzard to bulk copy data from source database to a file on a drive other than the one used by your .mdf or .ldf files, and then BCP or Import file into table on target database. This is similar to the staging technique, except you are staging to file system rather than staging to intermediate tables.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
March 15, 2016 at 10:52 pm
JustMarie (3/15/2016)
Why not use SSIS to stage the data from the source server to the destination server? Create a staging database (I prefer those but you can use schema in the same one if you like), data flow the data into the staging table, update destination.
Same question in reverse... why not just use a single INSERT/SELECT across a simple linked server?
Amplification... SSIS expands the surface area quite a bit and requires a whole 'nuther plane of logins for users. For this problem, you'd end up with a connection not unlike what a linked server would be, anyway.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 15, 2016 at 10:54 pm
Eric M Russell (3/15/2016)
To copy rows from source table(s) to target tables(s) with minimal performance impact on both the source database (less blocking) and target database (less transaction logging), I would reccomend using BCP.EXE or SSMS Export Data Wizzard to bulk copy data from source database to a file on a drive other than the one used by your .mdf or .ldf files, and then BCP or Import file into table on target database. This is similar to the staging technique, except you are staging to file system rather than staging to intermediate tables.
You're a kindred spirit on this subject. IIRC, even SQL Server uses it for replication.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 16, 2016 at 12:02 pm
If you do create a linked server connection specifically for this purpose, then remember to drop it afterward or restrict it to only your login. Otherwise it could be abused by another user.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply