Link to home
Start Free TrialLog in
Avatar of leop1212
leop1212Flag for United States of America

asked on

SQL 2008 how to backup only store procedures wihtout data or log files

We have 200gb+  SQL 2008 DB with 300+ store procedures and 300+ tables.
what is the best way for me to create backup of this database without saving  any transactional data?

Just backup up  tables, store procedures and triggers so that I can quickly restore only DB Structure with store procedures without any data?
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

As far as I know you can't do that. You would need to script out your database, stored procedures, views, functions, users, indexes, etc.

Interesting question though and I hope someone has a better answr than me.
Avatar of leop1212

ASKER

well,
I appreciate the comments but than doesn't answer my question.
ASKER CERTIFIED SOLUTION
Avatar of Ray
Ray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ray,
your answer make much more sense.
let us try to start from another end.
say I made a full backup of my DB and restored it to a test DB.
now I have test database with all structure and store procedure which I want to backup   + data which I want to purge.
could you give me an example of the script which will delete and purge data from all tables and than pack the database?
Are you sure you want to purge everything? For example, does the database contain data about any fields held in the system, or users perhaps?
i want to delete data in all table expect system tables.
the only cavity is that there are data constrains preventing deletion on many tables. is there a easy way to buy pass it?
There is no "easy" way to do this.  You would have to:
remove all foreign-key constraints
cycle through and truncate each table
recreate all foreign-key constraints

Your best bet going forward is to source control your database and use that to recreate a shell if needed.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial