Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 copy all objects to shrink and scrub

Author  Topic 

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2012-06-12 : 17:48:02
I currently have a nightly process that backs up a database, restores it with a different name, then scrubs out some of the data and backs up the scrubbed database. The problem with this is that the database has gotten too large for the development environments so I need to take a subset of the data. Deleting data from the tables and using SHRINKFILE takes too long (an hour or two), even if I only shrink by 100 MB at a time. I tried following what some people suggested and creating an SSIS package with the Transfer SQL Server Objects task, but it fails because there are a couple views that reference a different database on the server. I've set everything in the task to True and nothing helps. What can I do?

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-06-12 : 18:03:11
how many tables worth of data are we talking about here?

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2012-06-12 : 19:20:47
Around 25 right now, why? I don't want to have to update the job every time the schema changes if that's what you're getting at.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-12 : 19:54:25
Add more storage so that your current backup/restore/scrub/backup process is okay?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2012-06-12 : 20:28:13
It's not just space that's the issue, it's time as well. Adding storage is a last resort. Isn't there anything else I can do?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-12 : 20:31:22
Add the other database, just a shell with the right name, and include the view and table DDL if needed.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2012-06-12 : 20:41:05
That seems reasonable. I'll try that, thanks.
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-06-13 : 09:57:29
Tara's approach sounds reasonable. I was thinking some sort of replication,subscription thing

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2012-06-13 : 15:57:19
Wait, maybe that doesn't help. If I have a task that copies over the objects that have external dependencies first, how do I tell the Transfer Objects task to then copy all the other objects without specifying each object? The goal is to not have to modify the job every time the schema is changed.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-13 : 15:58:25
Well if new tables are added, you'll need to modify it unless you really add some fancy logic to it. I don't know how to do it.



Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-06-13 : 17:12:03
you can use sys views to dump to a tableList then you process uses that. this makes it dynamic

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -