views:

79

answers:

5

I have a huge database in production environment which I need to take a copy off, but the problem is that the data is over 100Gb's and downloading a backup off it is out of the question. I need to get a "skeleton" image of the database. What I mean by "skeleton" is, I need to get the database outline so that I can recreate the database locally by running SQL scripts.

Is there a quick and easy way to retrieve the SQL for recreating the database structure and tables?

Or will I have to write something in order to do this programmatically?

+3  A: 

Managed to find this from Google.

Ardman
+1  A: 

If you are using MS SQL Server then it's very easy to get your "skeleton". In the Object Explorer Right Click on the database node and then "Script Database as" and then "Create to". If the Database is in Oracle or something else sure there is a way also.

Raihan Alam
If I script the database, that will just give me the database and not the tables, SPs etc.
Ardman
For SPs,Functions you can specify in "Script Database as" so that it script them also.
Raihan Alam
+2  A: 

I remember that if you can connect to the db from visual studio, visual studio have a publish tool, which can generate the script for you.... Hope this helps

ccppjava
A: 

I need to get the database outline so that I can recreate the database locally by running SQL scripts.

Ask the guys who developed this application/database to provide you with the SQL scripts they used to create (and upgrade) the database. Hint: All these scripts should be in the project's source control repository, along with the rest of your source code. Yes, that's right, the SQL/DDL scripts are source code, too.

If the SQL/DDL scripts are not under source control, be very afraid, and run away from this project as fast as possible.

ObiWanKenobi
The guy no longer works at the company and didn't use SQL scripts to create the database, just used SSMS.
Ardman
+3  A: 

Use the DDL Generate Scripts within SSMS :)

Neurofluxation