locked
VSDBCMD.exe options

    Question

  •  

    The help on VSDBCMD is a little lite.  Are there any examples?

    Wednesday, September 3, 2008 12:11 AM

Answers

  • Hi Reni,

     

    The documentation posted above does not represent the CTP16 vsdbcmd.exe bits.  In specific, the /pTongue Tiedqlcmdvars option is not valid.  I suggest trying /dspTongue Tiedql rather than /dspTongue TiedQL.  There is a way to have vsdbcmd output the actual options that are available in the current executable.  I am away right now, but for deployment this looks like this:

     

    Code Snippet
    Vsdbcmd /? /a:deploy /dsp:sql /cs:"Connection string"

     

     

     

    The reason the connection string is specified is because there are options available to specific versions of SQL Server.

     

    The linked server problem has been fixed in our current code.

     

     

    Jamie

     

    • Marked as answer by StevenPo Wednesday, November 12, 2008 7:12 PM
    Thursday, September 25, 2008 10:28 PM

All replies

  •  

    http://msdn.microsoft.com/en-us/library/aa833182.aspx

    http://msdn.microsoft.com/en-us/library/aa833418.aspx

    http://msdn.microsoft.com/en-us/library/aa833281.aspx

     

    I hope the above links would provide what you are looking for if not please let us know what VSDBCMD implementation examples are you looking for.

    Wednesday, September 3, 2008 9:34 PM
  • HI, completely aggree with you. I would like to know what are the two required assemblies that we have to use with it, I see four assemblies in my ..VSTSDB\Deploy folder. Also, an example of its usage. Right now, the only help I was able to find was VSDBCMD /?.

     

    Where can we find information on VSDBCMD commad line usage ad options?

     

    Thank you

     

    Thursday, September 4, 2008 10:57 AM
  •  

    Using the GDR CTP16 release....

     

    The /DeployToDatabase or /dd switch does NOT seem to work for me. With or without it the generated deployment scripts is always run.

     

    Your syntax for properties seems to be a bit off. Using the /pStick out tongueropertyNameStick out tongueropertyValue for example: /p:TargetDatabaseName:MyDatabaseName /p:CreateNewDatabase:False
    Returns with the error
     *** The specified property 'CreateNewDatabase:True' is not valid.  Properties are specified as name=value

    So changing to a /pStick out tongueropertyName=PropertyValue syntax seems to work better

    For example: /p:TargetDatabaseName=MyDatabaseName /p:CreateNewDatabase=False


    Why are the command line switches case sensitive?

    /Action works /action does not

    /a works /A does not.

     

    The /Verbose or /v switch does not seem to increase the verbosity for me, what should we be seeing with that specified?

    Thanks

    -- Steven
    Wednesday, September 10, 2008 9:41 PM
  • Hi Steven,

     

    Someone on my team just pointed out this thread to me, we have been busy with the final development of GDR.

     

    Some quick answers (more later tonight to this and then other thread):

    ·         Yes, the version of vsdbcmd was case sensitive, I will change this to be case insensitive

    ·         A quick thought about /dd.  I am thinking that you might be using this with a deployment manifest file.  If this is the case, the deployment manifest file also contains a setting that specifies whether to deploy to the database or not.  In the code you have, if /dd:- is specified we will not override what is specified in the deployment manifest file.

    ·         Yes, verbosity does not do anything, I think we will remove it.

     

    Thursday, September 11, 2008 12:08 AM

  • In CTP16 the /dd or /DeployToDatabase switch seems to be working (or not working) like this.


    If the .deploymanifest contains a node like this <DeployToDatabase>True</DeployToDatabase> then the script is executed regardless of the command line switch. (it accepts /dd- but has no effect).

     

    If the .deploymanifest contains a node like this <DeployToDatabase>False</DeployToDatabase> then the script is NOT executed unless you specify the command line switch /dd or /DeployToDatabase. So when I have <DeployToDatabase>False</DeployToDatabase> in the .deploymanifest and don't specify /dd on the command line the script was generated but not executed, if I specify /dd (no + just the /dd) then it does execute the script.

     

    Not a fan of the +|- notation maybe using true|false would be better.  i.e. /DeployToDatabase:True or /DeployToDatabase:False and if specified overrides the setting in the .deploymanifest.

     

    In the .deploymanifest file there is a node <DeployToScript> which was True for me.  I tried setting it to False and the script was still generated.  What is this for?

     

    My .deploymanifest had the property     <DeployScriptFileName>Database2.sql</DeployScriptFileName> but when I left off the command line switch /DeploymentScriptFileBig Smileatabase2.sql it gave me a script file named Database2.txt not the Database2.sql I was expecting based on my .deploymanifest setting.

     

    -- Steven

    Thursday, September 11, 2008 2:59 PM
  • Hi Steven,

     

    Yes, we can use a little better integration with the .deploymanifest file.  If the .deploymanifest file is specified I will allow it to specify the option for whether to create the script or not (and the name), but still use the /dd:+/- option for deployment of the database.  I would like to keep the /dd option to make it explicit as to whether to execute against the database or not.

     

    I changed the Verbose flag (which was true by default) to be named Quiet.  So, by default, we will have verbose output, and will be “quiet” if specified.  This is certainly clearer.  This flag has the most effect on deployment regarding whether each print line is output to the console or not.

     

    We are in the process of changing the advanced command options – the documentation posted above was very early and is going to change.  

     

    Thursday, September 11, 2008 4:09 PM
  •  

    Instead of the /v I would prefer a /l

     

    Ability to create a log file during the execution to write logging information into the specified logfile. 

    /Log Logfile or /L Logfile

    /Log .\logs\Database1_V2_Upgrade.log

     

    So as vsdbcmd.exe is executing it writes to the log file. Include execution start time, end time, property values used from config files or overrides specified on the command line, executing steps as shown in the command window, detailed error messages etc.. Possibly additional flags to control the verbosity of the included output.

     

    For example...

    Code Snippet

    Start Time: 11:44 AM 9/11/2008

     

    Action: Deploy
    ManifestFile: Database1.deploymanifest
    ModelFile: Database1.dbschema
    DeploymentScriptFile: Database1.sql
    Target Server: MYSERVERNAME
    Target Database: Database1
    Connection String: Server=MYSERVERNAME;Database=Database1;Trusted_Connection=yes;    (x out passwords if sql login).
    [any other relevant properties settings etc...]


    Comparing database model Database1.dbschema to Database1 on MYSERVER.
     TSD00258        The project and target databases have different collation settings, deployment errors might result.

     

    Generating Database1.sql deployment update script.
     TSD00000        Deployment script generated C:\Deploy\Database1.sql

     

    Executing Database1.sql deployment update script.
     TSD00000        Altering dbo.Products...
     TSD00000        Altering dbo.Users...
     TSD00000        Altering dbo.Vendors...

     

    End Time: 11:53 AM 9/11/2008

     

     

     

    It would be good if the file was opened for shared access so another application could read the log file as it is being written to.  This would be useful for a UI application that could shell out to vsdbcmd.exe and also show the ouput of the log file as it is being written.

     

    Thanks

    -- Steven

    Thursday, September 11, 2008 4:32 PM
  •  

    "If the .deploymanifest file is specified I will allow it to specify the option for whether to create the script or not (and the name), but still use the /dd:+/- option for deployment of the database.  I would like to keep the /dd option to make it explicit as to whether to execute against the database or not."

     

    Are you saying that we can specify not to create the deployment script but still have /dd:+ to deploy the database.  I though you needed to generate the script in order to deploy it?  Also, if you like the +/- notation that is fine but it should be clear how to use it,  is it /dd or /dd+ or /dd:+, the help should show examples of whichever turns out to be correct.

     

    The other command line switches seemed to override their .deploymanifest counterparts correctly, I think it was only the /dd that didn't override the <DeployToDatabase> setting.

     

    "I changed the Verbose flag (which was true by default) to be named Quiet. "

    I didn't see your post on the Quiet option before I posted about the /Log file.  The DBAs seem to like this information to be persisted for future reference so having it written to a log file would be very helpful. 

     

    They also like keeping a backup of the script files that are used to update the database.  So maybe another command line switch that would allow copying the script after it has finished into another folder for future reference. So after Database1.sql is finished executing it gets moved into a specified folder.

    /ScriptArchieve:.\Scripts

     

    -- Steven

    Thursday, September 11, 2008 4:55 PM
  •  

    1.     I've had no luck with getting the below VSDBCMD to work with the Properties switch..

     

    VSDBCMD /aBig Smileeploy /cs:"Data Source=RENI;Integrated Security=True;Pooling=False" /dspTongue TiedQL /model:MyFirstDBProject.dbschema

    /p:TargetDatabaseName=TargetDatabase /pTongue Tiedqlcmdvars=TargetDatabase.sqlcmdvars /manifest:MyFirstDBProject.deploymanifest /script:MyDBProject.sql

     

    *** The specified property TargetDatabaseName could not be used

    *** The specified property sqlcmdvars could not be used

     

     

    2.  Also, In the deployment configuration settings, when the

    “Generate DROP statements for objects that are in the target database but that are not in the database project" 

     

    is checked, the VSDBCMD command shows up the below error message -

     

    An unexpected failure occured: Drop statement generation is not supported for type ISqlLinkedServerLogin.

    Thursday, September 25, 2008 8:30 PM
  • Hi Reni,

     

    The documentation posted above does not represent the CTP16 vsdbcmd.exe bits.  In specific, the /pTongue Tiedqlcmdvars option is not valid.  I suggest trying /dspTongue Tiedql rather than /dspTongue TiedQL.  There is a way to have vsdbcmd output the actual options that are available in the current executable.  I am away right now, but for deployment this looks like this:

     

    Code Snippet
    Vsdbcmd /? /a:deploy /dsp:sql /cs:"Connection string"

     

     

     

    The reason the connection string is specified is because there are options available to specific versions of SQL Server.

     

    The linked server problem has been fixed in our current code.

     

     

    Jamie

     

    • Marked as answer by StevenPo Wednesday, November 12, 2008 7:12 PM
    Thursday, September 25, 2008 10:28 PM
  • What can be done to pass the sqlcmdvars?

     I have the same issue as Reni but I am with the following version:

    Microsoft Visual Studio Team System 2008 Database Edition GDR Version 9.1.31124.01

    I receive the exact same error as Reni: *** The specified property sqlcmdvars could not be used
    Friday, December 12, 2008 6:47 PM
  • I'm having the same issue - can't pass in sqlcmdvars.

    I need to pass some custom properties in to the deployment process - any idea when this will be fixed?
    Tuesday, December 16, 2008 7:39 PM
  • As a workaround, knock up a utility which xpaths the value you want to specify in sqlcmdvars into the .deploymanifest file for your project. The .deploymanifest is just an xml file - open it up and take a look, the element you need to add the value to is pretty obvious.
    Wednesday, December 17, 2008 1:03 AM
  • @BenjaminAmor

     How would you do this?
    Wednesday, January 7, 2009 12:08 PM
  • The documentation is outdated.  To pass the sqlcmdvars use /p:SqlCommandVariablesFile=<yourfile>.

    See the following posts for more details on the /p parameters: http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/a966ac3c-c039-4c3f-9b6d-2882d9874282
    Wednesday, January 7, 2009 2:27 PM