Solved

SQL 2008, copying database daily excluding a few tables.

Posted on 2013-12-18
8
542 Views
Last Modified: 2013-12-19
I have two SQL 2008 database servers, one primary and one testing.
Everyday, we backup a DB from primary and restore to testing so that we can run reporting and others. The problem is, one of tables, which is not needed for reporting, is growing too fast, resulting the daily back/restore takes longer and wasting disk space on testing server.

I was looking into Transactional Replication to replicate all other tables, but not the trouble table, but half of tables I want to set replication doesn't have primary key in it, so I can't use Transactional Replication. I'm not allowed to change table schema of the source database in primary server. Is there a way to solve this situation?

In short, I'm trying to copy a database from server A to server B excluding a table and it will be performed as scheduled time once a day.
0
Comment
Question by:crcsupport
  • 3
  • 3
8 Comments
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 375 total points
ID: 39727946
On the primary server, move the trouble table(s) to a separate filegroup(s).

On the testing server, do a partial restore, omitting the trouble filegroup(s).  If required, you could then run a script to create an empty version of the trouble table(s), to avoid "object not found" errors.
0
 
LVL 10

Assisted Solution

by:HuaMinChen
HuaMinChen earned 125 total points
ID: 39728499
You can schedule a job which is calling a Stored proc, to copy the relevant tables.
0
 
LVL 1

Author Comment

by:crcsupport
ID: 39729582
I'm not allow to change anything in source database.

Can you give me starting sql script which will copy only tables that I need. I'm not really good at database so I like to do more research basing on the script as starting point.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 375 total points
ID: 39729722
A filegroup is completely transparent to everything else in SQL.  If you can't change that, you're in for a real pain as you spend huge amounts of time transferring data and adjusting copy code to account for new tables, columns, etc..

[Btw, if you can't change "anything" in the source database, how were you going to add Replication, even if all PKs were there?]
0
 
LVL 1

Author Comment

by:crcsupport
ID: 39729776
I can add/remove scripts I did, but Changing database settings and schema of database is not allowed.
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 375 total points
ID: 39729812
Ouch!  Good luck: Trust me, it will be royal pita having to do this outside of filegroups.
0
 
LVL 1

Author Comment

by:crcsupport
ID: 39729824
So I think creating a filegroup is the best option... ah
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now