Monday, March 26, 2012

Resetting DB

> Is there an easy way to drop all object of a db so it is as new? Just so I
> can run a script to recreate the objects
Is there some reason why you can't add DROP DATABASE <database_name> and
CREATE DATABASE <database_name> statements to your script?
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
"John" <John@.nospam.infovis.co.uk> wrote in message
news:%23vTMcTheHHA.1312@.TK2MSFTNGP03.phx.gbl...
> Hi
> Is there an easy way to drop all object of a db so it is as new? Just so I
> can run a script to recreate the objects.
> Thanks
> Regards
>
> Is there some reason why you can't add DROP DATABASE <database_name> and
> CREATE DATABASE <database_name> statements to your script?
I can't speak for John but I have had large SQL 2000 databases where I found
it considerably faster to drop all objects rather than dropping and
recreating the entire database. However, in the SQL 2005 world, the
database drop/create method is very fast thanks to instant file
initialization.
Hope this helps.
Dan Guzman
SQL Server MVP
"Gail Erickson [MS]" <gaile@.online.microsoft.com> wrote in message
news:%233GfsyheHHA.3960@.TK2MSFTNGP02.phx.gbl...
> Is there some reason why you can't add DROP DATABASE <database_name> and
> CREATE DATABASE <database_name> statements to your script?
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> Download the latest version of Books Online from
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> "John" <John@.nospam.infovis.co.uk> wrote in message
> news:%23vTMcTheHHA.1312@.TK2MSFTNGP03.phx.gbl...
>
|||> I can't speak for John but I have had large SQL 2000 databases where I
> found it considerably faster to drop all objects rather than dropping and
> recreating the entire database. However, in the SQL 2005 world, the
> database drop/create method is very fast thanks to instant file
> initialization.
Good point. I wasn't thinking along those lines. Thanks for including this
information.
Gail
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:74A9F97B-3095-471B-A3C7-BF6EE085B1D6@.microsoft.com...
> I can't speak for John but I have had large SQL 2000 databases where I
> found it considerably faster to drop all objects rather than dropping and
> recreating the entire database. However, in the SQL 2005 world, the
> database drop/create method is very fast thanks to instant file
> initialization.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Gail Erickson [MS]" <gaile@.online.microsoft.com> wrote in message
> news:%233GfsyheHHA.3960@.TK2MSFTNGP02.phx.gbl...
>

No comments:

Post a Comment