Friday, January 27, 2012

Database Scripting Question

I just used Enterprise Manager to create a script of my database. My goal is
to take this script and run it on another server to create a copy of the
database. When I ran the script to re-create the database, I got numerous
errors because Enterprise Manager created the script in such a way that
database objects are not created in the correct order. For example, in the
script EM created, it attempts to create a stored procedure which references
a view that hasn't been created yet. Obviously, EM should have scripted the
view first and then the stored proc.
Is there anything I can do about this? Or, is there a tool I can purchase
that scripts objects in the correct order? My goal here is to script my
database and then execute the script and create a database that is a clone
of the original.
Thanks very much.
DBGhost from http://www.innovartis.co.uk/home.aspx claims to be able to
script out the db in the right order.
Andrew J. Kelly SQL MVP
"Amos J. Soma" <amos_j_soma@.yahoo.com> wrote in message
news:Hcmdnb5cILblc8bfRVn-sQ@.buckeye-express.com...
>I just used Enterprise Manager to create a script of my database. My goal
>is to take this script and run it on another server to create a copy of the
>database. When I ran the script to re-create the database, I got numerous
>errors because Enterprise Manager created the script in such a way that
>database objects are not created in the correct order. For example, in the
>script EM created, it attempts to create a stored procedure which
>references a view that hasn't been created yet. Obviously, EM should have
>scripted the view first and then the stored proc.
> Is there anything I can do about this? Or, is there a tool I can purchase
> that scripts objects in the correct order? My goal here is to script my
> database and then execute the script and create a database that is a clone
> of the original.
> Thanks very much.
>
|||It sounds like you depenency records are messed up.
Check this site out, the tools are nice will do what you need.
http://www.wingenious.com/sqltools/index.html
Hello Amos,

> I just used Enterprise Manager to create a script of my database. My
> goal is to take this script and run it on another server to create a
> copy of the database. When I ran the script to re-create the database,
> I got numerous errors because Enterprise Manager created the script in
> such a way that database objects are not created in the correct order.
> For example, in the script EM created, it attempts to create a stored
> procedure which references a view that hasn't been created yet.
> Obviously, EM should have scripted the view first and then the stored
> proc.
> Is there anything I can do about this? Or, is there a tool I can
> purchase that scripts objects in the correct order? My goal here is to
> script my database and then execute the script and create a database
> that is a clone of the original.
> Thanks very much.
>
|||Hello Andrew.
not quite - but almost. The scripter tool will script out the individual
objects and the build component will build a database (give it any name you
like) using these scripts and building it in the correct order and this all
can be recorded into a script to use which is the goal of this discussion.
"Andrew J. Kelly" wrote:

> DBGhost from http://www.innovartis.co.uk/home.aspx claims to be able to
> script out the db in the right order.
> --
> Andrew J. Kelly SQL MVP
>
> "Amos J. Soma" <amos_j_soma@.yahoo.com> wrote in message
> news:Hcmdnb5cILblc8bfRVn-sQ@.buckeye-express.com...
>
>

No comments:

Post a Comment