SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On



How do I generate a database schema in a job? Expand / Collapse
Author
Message
Posted Monday, August 04, 2008 9:05 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 8:07 AM
Points: 286, Visits: 399
Our system administrator would like us to have a job which will generate the database schema, for all of our user databases, on a monthly basis. I've generated the schemas for tables, view and SP's, but only through the SSMS GUI. I don't really know how to do this through a job. So, in order to satisfy him, how do I get a job which will generate the schema for each of our user databases, and write that out to some flat file somewhere?



Kindest Regards,

Rod
Post #546156
Posted Tuesday, August 05, 2008 10:12 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, June 24, 2010 9:30 AM
Points: 308, Visits: 237
There isn't a built-in way to do it but you do have choices.
You can go with SMO which has a script method, but SMO has always been a little hard to swallow for me.

You can go with something like VSTE for DBAs. The MSBuild commandline has an option for scripting and that can be scripted and probably run from a job.

Or you can use my favorite method of Powershell. Powershell can script DBs very easily with very little effort.
I've actually made a video on this very topic. I don't really teach you how to turn it into a job, but it's a first step and I hope to complete another video showing you how to automate it very soon.
Anyway, watch it and see if it'll get you what you want because other than going with a 3rd party option, it's really your best bet.


http://midnightdba.itbookworm.com/PowershellScriptDBObjects/PowershellScriptDBObjects.html


And while you're at it, I've got a Powershell basics video as well. It'll give you a quick overview of how PS works.

http://midnightdba.itbookworm.com/PowerShellOverview/PowerShellOverview.html


Watch my free SQL Server Tutorials at:
http://MidnightDBA.ITBookworm.com

Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://www.infoworld.com/blogs/sean-mccown
DBA Rant – http://dbarant.blogspot.com
Post #547249
Posted Wednesday, August 06, 2008 9:21 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 8:07 AM
Points: 286, Visits: 399
"VSTE for DBAs". What is VSTE?

I'll review your PowerShell videos, thanks.



Kindest Regards,

Rod
Post #547630
Posted Wednesday, August 06, 2008 9:28 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:23 AM
Points: 13,453, Visits: 14,329
VSTE -- Visual Studio Team Edition.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #547639
Posted Wednesday, August 06, 2008 1:46 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 8:07 AM
Points: 286, Visits: 399
Thank you. We don't have VSTE for anybody, let alone DBA's, so I guess I'll go with the PowerShell method.



Kindest Regards,

Rod
Post #547855
Posted Wednesday, August 06, 2008 1:52 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, June 24, 2010 9:30 AM
Points: 308, Visits: 237
Yeah, VSTE is expensive(5K'ish) and powershell is free.
I'll try to get on here tonight or tomorrow and shoot a video on turning it into a process for you.


Watch my free SQL Server Tutorials at:
http://MidnightDBA.ITBookworm.com

Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://www.infoworld.com/blogs/sean-mccown
DBA Rant – http://dbarant.blogspot.com
Post #547858
Posted Thursday, August 07, 2008 4:30 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, September 06, 2010 1:37 PM
Points: 259, Visits: 436
Even I am affluent with the GUI only, however check the below article posted on sql server central that can help further on this.

http://www.sqlservercentral.com/articles/Administering/howtoscheduleasqlserverdatabasecreationscript/1834/

Meanwhile we can also look into other avenues.

-Rajini
Post #548152
Posted Thursday, August 07, 2008 9:41 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, June 24, 2010 9:30 AM
Points: 308, Visits: 237
Yeah, when Yukon was released I gave a perfunctory effort to try to make that work, and lost interest pretty quickly. And while I haven't confirmed it in Katmai yet, my gut tells me they're going to tell you to go to powershell. I'm asking the question now and I'll let you know when I have an answer.

Watch my free SQL Server Tutorials at:
http://MidnightDBA.ITBookworm.com

Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://www.infoworld.com/blogs/sean-mccown
DBA Rant – http://dbarant.blogspot.com
Post #548413
Posted Thursday, August 07, 2008 12:40 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, June 24, 2010 9:30 AM
Points: 308, Visits: 237
Here's the response I just got back from one of the devs at MS.


http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard


Watch my free SQL Server Tutorials at:
http://MidnightDBA.ITBookworm.com

Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://www.infoworld.com/blogs/sean-mccown
DBA Rant – http://dbarant.blogspot.com
Post #548586
Posted Monday, October 20, 2008 9:47 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, August 27, 2010 6:52 AM
Points: 181, Visits: 92
This above link says, The wiki page 'Database Publishing Wizard
' does not exist.


- Manish
Post #588925
« Prev Topic | Next Topic »


Permissions Expand / Collapse