home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / SQLScripte2866610122001.psc / SQLScripter.txt < prev   
Encoding:
Text File  |  2001-10-12  |  9.8 KB  |  197 lines

  1. SQLScripter 2.1 ReadMe.
  2.  
  3. Command Line Syntax:
  4. SQLScripter.exe [/{S|SERVER}=ServerName]
  5.         [/{U|USER}=Login]
  6.         [/{P|PW|PASSWORD}=Password]
  7.         [/{DB|DATABASE}=Database1[,Database2[,n...]]]
  8.         [/{DBA|DBAOPTIONS}={ALL|[A][B][D][J][L]}]
  9.         [/DEL=NumberOfWeeks]
  10.         [/{DIR|DEST|DESTDIR}=d:\path]
  11.         [/{BG|BACK|BACKGROUND}]
  12.         [/{ScriptDB|SDB}={true|false}]
  13.         [/{ScriptTables|STA}={true|false}]
  14.         [/{ScriptViews|SVI}={true|false}]
  15.         [/{ScriptSPs|SSP}={true|false}]
  16.         [/{ScriptRules|SRU}={true|false}]
  17.         [/{ScriptDefs|SDE}={true|false}]
  18.         [/{ScriptRoles|SRO}={true|false}]
  19.         [/{ScriptUsers|SUS}={true|false}]
  20.         [/{ScriptUDTs|SUD}={true|false}]
  21.         [/{ScriptFTCs|SFT}={true|false}]
  22.         [/{DBObjsInSepFiles|SEP}={true|false}]
  23.         [/{DatePrefixOnFiles|PRE}={true|false}]
  24.         [/{InsertScriptTables|INS}=Table1[,table2,n...]]
  25.         [/{ScriptDropsFirst|SDF}={true|false}]
  26.  
  27. Command Line Switches:
  28. [/{S|SERVER}=ServerName]
  29.     ServerName = Name of the server to script from
  30. [/{U|USER}=Login]
  31.      Login = Login to use to connect to the server. Leave empty for trusted connection.
  32. [/{P|PW|PASSWORD}=Password]
  33.     Password = Password to use to connect to the server. Leave empty for trusted connection.
  34. [/{DB|DATABASE}=Database1[,Database2[,n...]]]
  35.     Database1[,Database2[,n...]]] = Comma-seperated list of databases to script.
  36. [/{DBA|DBAOPTIONS}={ALL|[A][B][D][J][L]}]
  37.     ALL = Enable all DBA scripting options.
  38.     Or use any combination of the following:
  39.     A = Script alerts and operators.
  40.     B = Script Backup Devices.
  41.     D = Save DTS Packages as Structured Storage Files.
  42.     J = Script the SQL-Server Agent jobs.
  43.     L = Script the server logins.
  44. [/DEL=NumberOfWeeks]
  45.     NumberOfWeeks = Number of weeks to keep old files. Omit to keep all old files.
  46. [/{DIR|DEST|DESTDIR}=d:\path]
  47.     d:\path = destination directory for the scripts.
  48. [/{BG|BACK|BACKGROUND}]
  49.     Run in the background without a GUI. SQLScripter will do this automatically whenever
  50.     you provide the server, destination dir and database command-line switches. Use the
  51.     BACKGROUND switch if you only need to script server objects and don't need to provide
  52.     a list of databases to script.
  53. [/{ScriptDB|SDB}={true|false}]
  54.     Script selected databases
  55. [/{ScriptTables|STA}={true|false}]
  56.     Script all tables in selected databases
  57. [/{ScriptViews|SVI}={true|false}]
  58.     Script all viewsin selected databases
  59. [/{ScriptSPs|SSP}={true|false}]
  60.     Script all stored proceduresin selected databases
  61. [/{ScriptRules|SRU}={true|false}]
  62.     Script all rules in selected databases
  63. [/{ScriptDefs|SDE}={true|false}]
  64.     Script all defaults in selected databases
  65. [/{ScriptRoles|SRO}={true|false}]
  66.     Script all roles in selected databases
  67. [/{ScriptUsers|SUS}={true|false}]
  68.     Script all users in selected databases
  69. [/{ScriptUDTs|SUD}={true|false}]
  70.     Script all user defined types in selected databases
  71. [/{ScriptFTCs|SFT}={true|false}]
  72.     Script all full text catalogs in selected databases
  73. [/{DBObjsInSepFiles|SEP}={true|false}]
  74.     Put scripts for database objects (tables, views and stored procedures) in separate files. 
  75.     The name of the object will be used in the filename: [datestamp.]<database name>_<object name>.sql
  76.     If false then all tables will be written to a single file, as will views and stored procedures.
  77.     Tables selected to create INSERT scripts for will also be written to single files if this option
  78.     is selected - the filenames will be the same as above except with "_Insert" appended.
  79. [/{DatePrefixOnFiles|PRE}={true|false}]
  80.     Prefixes filenames with a date stamp in the syntax: yyyymmdd.
  81. [/{InsertScriptTables|INS}=Table1[,table2,n...]]
  82.     Comma delimited list of tables to generate INSERT scripts for. This is really the only additional
  83.     bit of functionality that has been added to v2.1. The GUI has also been updated to allow tables to
  84.     be selected from a list.
  85. [/{ScriptDropsFirst|SDF}={true|false}]
  86.     When you've got a lot of tables, views and SPs that are interdependent on each other then you may
  87.     need to execute the generated scripts several times as some objects might not be created in time.
  88.     Setting this option to first puts all the drop statements together at the top of the script so that
  89.     if need be, you can execute the whole script once and then just the create section as many times as
  90.     necessary. Note that this option doesn't make sense if the DBObjsInSepFiles (see above) option is on
  91.     and will be ignored.
  92.  
  93. All parameters are optional.
  94. - When the /BACKGROUND switch is specified, the program will start scripting unattended - provided
  95. that the servername and destination directory switches are specified.
  96. - When the /SERVER, /DATABASE and /DESTDIR parameters are all specified the program will also
  97. run unattended.
  98. - When neither of the above two points are true, the program will fire up the GUI with the on the
  99. command line specified parameters already filled in.
  100.  
  101.  
  102. GUI operation:
  103. After starting up the program, select a server from the list or enter the server name if it's
  104. not in the list and choose an authentication mode (fill in the login and password fields if
  105. you're using SQL Server authenticaton). Click the "Connect & Fetch Databases" button. Now select
  106. the databases you want to script objects from, enter or select a destination directory and decide
  107. if you want to program to delete old files for you. Go to the Options tab and select all the
  108. types of objects you want to generate scripts for. Once all your choices are made, click the
  109. Generate button and the program will start generating scripts, showing you a log of its current
  110. activity.
  111. Once you're done you can go back to the Scripting tab and select another server to script
  112. objects from. If you need to log on to the same server using other login credentials, you'll
  113. have to click the Disconnect button first, and "Connect & Fetch Databases" again after you've
  114. changed the login and password fields.
  115. At any time you can click the Save Log button to save the log file of your operations so far
  116. and click Clear Log button to start a new log with a clean slate.
  117.  
  118.  
  119. Examples:
  120. SQLScripter.exe /S=MyServer /U=MyLogin /P=MyPassword
  121.  
  122.     Starts up the GUI, logs in to MyServer using the MyLogin SQL Server login with password
  123.     MyPassword and fetches the list of available databases.
  124.  
  125.  
  126. SQLScripter.exe /S=MyServer /DB=MyDatabase,pubs,Northwind /DIR=C:\Windows\Temp
  127.  
  128.     Scripts the MyDatabase, pubs and Northwind databases from server MyServer to the
  129.     C:\Windows\Temp directory, using a trusted (NT) connection. All existing files
  130.     in this directory will be kept. All this is done unattended.
  131.  
  132.  
  133. SQLScripter.exe /SERVER=MyServer /DATABASE=MyDatabase,pubs,Northwind /DESTDIR=C:\Windows\Temp
  134.         /USER=MyLogin /PASSWORD=mypassword /DBA=dj /DEL=2
  135.  
  136.     Scripts the MyDatabase, pubs and Northwind databases from server MyServer to the
  137.     C:\Windows\Temp directory, as well as all the DTS Packages and Agent jobs, using
  138.     'MyLogin' with password 'mypassword' to connect to the server. All existing files
  139.     in C:\Windows\Temp that are older then 2 weeks will be deleted. All this is done
  140.     unattended.
  141.  
  142. SQLScripter.exe /s=MyServer /dba=all /dir=C:\Windows\Temp /bg
  143.  
  144.     Scripts all Alerts, Operators, Backup devices, SQL Server Agent Jobs and Server Logins.
  145.     Also saves the DTS Packages as structured storage files, but does not script any database
  146.     objects. All this is done unattended.
  147.  
  148.  
  149. Note: Only sysadmins can save/script "server-objects" (DTS Packages, operators/alerts, Agent jobs and
  150. logins). I would have liked to include the possibility for developers to save their own DTS packages
  151. using their own login, but due to the various unpredictable quirks of the DTS designer this almost
  152. seems impossible to accomplish (at least when using mixed security mode).
  153. To see what I mean, log into your client station using an NT login that has access to the
  154. server, and then log in to the SQL Server from that station using an SQL Server login. Create a DTS
  155. package and save it to the server. Now look at the owner column in msdb..sysdtspackages. This will
  156. contain "DOMAIN\USER" (the NT login) instead of the SQL Server login you created the package with.
  157. Neat eh? To make it better, look at the owner column of a package created while logged in using NT
  158. authentication. Instead of the expected "DOMAIN\USER" value, you'll only find "USER" there!? Now tell
  159. me, are these packages owned by different users, or the same one? If anyone has any tips/workarounds
  160. considering this problem, please let me know.
  161.  
  162.  
  163. Visual Basic Version: 6.0                  (Tested with VB6.0 SP4 and SP5)
  164.  
  165. Libraries used by the program:
  166. - Microsoft SQLDMO Object Library          (Tested with MS SQL 7.0 SP2 DLLs)
  167. - Microsoft DTSPackage Object Library      (Tested with MS SQL 7.0 SP2 DLLs)
  168.  
  169. Components used by the program:
  170. - Microsoft Windows Common Controls 6.0    (Tested with VB6.0 SP4 and SP5 OCX)
  171.  
  172.  
  173. Changes since version 2.0:
  174. - Added feature to generate INSERT scripts for selected tables
  175. - Re-introduced the use of the ADO libraries to generate INSERT scripts
  176. - Added command line options that were available from the GUI
  177. - Added the option to script database objects to separate files
  178. - Added the option of the datestamp prefix on files
  179. - Added the option to script database object drops first and then the create calls        
  180.  
  181.  
  182. Changes since version 1.0:
  183. - Corrected a bug in scripting the UDTs (which weren't scripted at all in 1.0).
  184. - Included scripting of Backup Devices.
  185. - Eliminated the use of ADO libraries.
  186. - Some minor additions to the log-messages.
  187. - Tried to include an option for non-sysadmins to save their own DTS Packages, but got so annoyed with
  188.   the inconsistencies in sysdtspackages (notably the owner column) that I gave up on it.
  189.  
  190.  
  191. Use this program and code at your own risk! You can use parts or all of this code in your own
  192. applications if you really want to. I would appreciate it if you can let me know about any bugs you
  193. find, so that if I find the time I can update my own code with your improvements :)
  194.  
  195. Jeremy van Dijk
  196. j.van.dijk@rvbh.nl
  197.