Make a sample database

  • I've seen a place that this has been discussed and maybe I'm just missing an easy way to do this.

    Let's say I have a 20 GB database and I need to put a sample of it on a development box.

    Doing it dynamically is where I really want to be but even doing it manually right now would be a start.

    The problem I've run into dynamically is the identity columns.

    I'm not sure I can use TABLESAMPLE because it's random.

    I'm looking at using "SELECT TOP 25 PERCENT".

    Has the wheel already been invented?

  • Assuming you have foreign key relationships, the top 25 from one table may mean you need every record from another. To add to the issue, you have to add the records in the appropriate order.

    You have to custom code something to do this for you.

  • I've inherited a system without FK's. There are implied FK's but I can handle that.

  • Actually, that probably makes your problem even worse. You need to ensure you don't violate constraints that are not actually in the database or you may be producing errors in your test system because of orphaned records.

    In your situation, I would look for the tables with the most data. Many OLTP systems end up having only a few tables with a lot of records and the other tables are essentially supporting data. Transfer all of the records for any supporting tables and transfer small portions of the tables with significant numbers of records. There is probably not going to be a tool to solve this for you with any accuracy.

  • Well, I hope I can come up with something. I've been playing around a few days and thought I was close only to find out I had gone down a dead-end road.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply