Hello, I have a production database that I need to recreate somewhere else
but with no data in the tables. Is the best way to do this, simply using the
'Generate SQL Script' option though Enterprise Manager against the existing
database. Are there any objects that will not get created?
One thing I have come across with scripting so far is that I have views
based on views. So I'm having to manually change the order of views in my
script to have the ones not based on views at the top. Is there a easier way
to do this?
Thanks
Don
Hope the server is 2000 itself, the best way is by generate script only. You
will get all the objects asscoiated with one DB when using generate script.
Again the question regarding views, after generating the script reorder the
views according to your need. While sciprting it will get generated in the
order in which each object was created, so there wont be much work for you.
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Don" wrote:
> Hello, I have a production database that I need to recreate somewhere else
> but with no data in the tables. Is the best way to do this, simply using the
> 'Generate SQL Script' option though Enterprise Manager against the existing
> database. Are there any objects that will not get created?
> One thing I have come across with scripting so far is that I have views
> based on views. So I'm having to manually change the order of views in my
> script to have the ones not based on views at the top. Is there a easier way
> to do this?
> Thanks
> Don
Showing posts with label recreate. Show all posts
Showing posts with label recreate. Show all posts
Saturday, February 25, 2012
Creating New Empty Database
Hello, I have a production database that I need to recreate somewhere else
but with no data in the tables. Is the best way to do this, simply using the
'Generate SQL Script' option though Enterprise Manager against the existing
database. Are there any objects that will not get created?
One thing I have come across with scripting so far is that I have views
based on views. So I'm having to manually change the order of views in my
script to have the ones not based on views at the top. Is there a easier way
to do this?
Thanks
DonHope the server is 2000 itself, the best way is by generate script only. You
will get all the objects asscoiated with one DB when using generate script.
Again the question regarding views, after generating the script reorder the
views according to your need. While sciprting it will get generated in the
order in which each object was created, so there wont be much work for you.
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Don" wrote:
> Hello, I have a production database that I need to recreate somewhere else
> but with no data in the tables. Is the best way to do this, simply using the
> 'Generate SQL Script' option though Enterprise Manager against the existing
> database. Are there any objects that will not get created?
> One thing I have come across with scripting so far is that I have views
> based on views. So I'm having to manually change the order of views in my
> script to have the ones not based on views at the top. Is there a easier way
> to do this?
> Thanks
> Don
but with no data in the tables. Is the best way to do this, simply using the
'Generate SQL Script' option though Enterprise Manager against the existing
database. Are there any objects that will not get created?
One thing I have come across with scripting so far is that I have views
based on views. So I'm having to manually change the order of views in my
script to have the ones not based on views at the top. Is there a easier way
to do this?
Thanks
DonHope the server is 2000 itself, the best way is by generate script only. You
will get all the objects asscoiated with one DB when using generate script.
Again the question regarding views, after generating the script reorder the
views according to your need. While sciprting it will get generated in the
order in which each object was created, so there wont be much work for you.
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Don" wrote:
> Hello, I have a production database that I need to recreate somewhere else
> but with no data in the tables. Is the best way to do this, simply using the
> 'Generate SQL Script' option though Enterprise Manager against the existing
> database. Are there any objects that will not get created?
> One thing I have come across with scripting so far is that I have views
> based on views. So I'm having to manually change the order of views in my
> script to have the ones not based on views at the top. Is there a easier way
> to do this?
> Thanks
> Don
Creating New Empty Database
Hello, I have a production database that I need to recreate somewhere else
but with no data in the tables. Is the best way to do this, simply using th
e
'Generate SQL Script' option though Enterprise Manager against the existing
database. Are there any objects that will not get created?
One thing I have come across with scripting so far is that I have views
based on views. So I'm having to manually change the order of views in my
script to have the ones not based on views at the top. Is there a easier wa
y
to do this?
Thanks
DonHope the server is 2000 itself, the best way is by generate script only. You
will get all the objects asscoiated with one DB when using generate script.
Again the question regarding views, after generating the script reorder the
views according to your need. While sciprting it will get generated in the
order in which each object was created, so there wont be much work for you.
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and
time
asking back if its 2000 or 2005]
"Don" wrote:
> Hello, I have a production database that I need to recreate somewhere else
> but with no data in the tables. Is the best way to do this, simply using
the
> 'Generate SQL Script' option though Enterprise Manager against the existin
g
> database. Are there any objects that will not get created?
> One thing I have come across with scripting so far is that I have views
> based on views. So I'm having to manually change the order of views in my
> script to have the ones not based on views at the top. Is there a easier
way
> to do this?
> Thanks
> Don
but with no data in the tables. Is the best way to do this, simply using th
e
'Generate SQL Script' option though Enterprise Manager against the existing
database. Are there any objects that will not get created?
One thing I have come across with scripting so far is that I have views
based on views. So I'm having to manually change the order of views in my
script to have the ones not based on views at the top. Is there a easier wa
y
to do this?
Thanks
DonHope the server is 2000 itself, the best way is by generate script only. You
will get all the objects asscoiated with one DB when using generate script.
Again the question regarding views, after generating the script reorder the
views according to your need. While sciprting it will get generated in the
order in which each object was created, so there wont be much work for you.
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and
time
asking back if its 2000 or 2005]
"Don" wrote:
> Hello, I have a production database that I need to recreate somewhere else
> but with no data in the tables. Is the best way to do this, simply using
the
> 'Generate SQL Script' option though Enterprise Manager against the existin
g
> database. Are there any objects that will not get created?
> One thing I have come across with scripting so far is that I have views
> based on views. So I'm having to manually change the order of views in my
> script to have the ones not based on views at the top. Is there a easier
way
> to do this?
> Thanks
> Don
Tuesday, February 14, 2012
Creating DB using command line
Hi All,
I was given a task of coming up with the script to recreate an existing database using a command line. I would use this script in case when the server is down and I can't get to Query Analyzer or EM to recreate it. I am not sure where to start. Any ideas are greatly appreciated.
Thanks.If the server is down, how would you be able to create a database? Other than that, look up the OSQL utility.|||I'm assuming they have another server with sql server installed...
And you should have sql server client tools installed on your desktop so you can connect to any server...no need to log on to a particular box
And how do you want o create a "new" database?
I'm assuming from a backup...is the backup copied to another box?
If not, then when the server is down, you are sol|||It is a clustered SQL Server, so dev will stand for prod. Yes, the backup is being copied to a drive on a dev box.|||OK, so create a *.sql file that does the restore and either create a bat file, or type this in the command line
osql /U <login> /P <password>/i <filename>.sql
simple enough|||Yes it is. Thanks a lot.
I was given a task of coming up with the script to recreate an existing database using a command line. I would use this script in case when the server is down and I can't get to Query Analyzer or EM to recreate it. I am not sure where to start. Any ideas are greatly appreciated.
Thanks.If the server is down, how would you be able to create a database? Other than that, look up the OSQL utility.|||I'm assuming they have another server with sql server installed...
And you should have sql server client tools installed on your desktop so you can connect to any server...no need to log on to a particular box
And how do you want o create a "new" database?
I'm assuming from a backup...is the backup copied to another box?
If not, then when the server is down, you are sol|||It is a clustered SQL Server, so dev will stand for prod. Yes, the backup is being copied to a drive on a dev box.|||OK, so create a *.sql file that does the restore and either create a bat file, or type this in the command line
osql /U <login> /P <password>/i <filename>.sql
simple enough|||Yes it is. Thanks a lot.
Creating DB from scripts
I'm using an integration project to recreate a db as needed from all the scripts i've previously generated. I'm encountering an error when the tables get built in the wrong order because of foreign key constraints. Does anyone know of a way to programmatically execute the scripts of sql tables that don't violate the constraints; so after, I can execute the other table create scripts? Any help or guidance in any way would be appreciated.
I think the SMO alias may be better for you, as SMO has at least the ability to generate scripts taking account of dependencies. See the SMO forum here: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=88&SiteID=1
Donald Farmer
|||Thanks. I will take a look.
Subscribe to:
Posts (Atom)