Creating Scripts Folder or Snapshot

This topic describes how to create a scripts folder or a snapshot.

Creating Scripts Folder

A scripts folder is a set of scripts that represent a database schema. The scripts folder can be used for:

  • Version-controlling databases.
  • Comparing database schemas. To create a new scripts folder:
    1. On the Database menu, point to Tasks, and then click Create Scripts Folder or Snapshot. The Create Scripts Folder or Snapshot dialog box opens.
    2. Select Source for the scripts folder creation. Scripts folder can be created on the basis of a database or a snapshot.
    3. Depending on the selected Source type, specify:
    • For Database: Connection and Database. Optionally, you can select Decrypt Encrypted Objects to decrypt encrypted objects.
    • For Snapshot: path to the required snapshot. 4. In Destination, select Scrips Folder in the Type field. 5. Specify Path to store the scripts folder. 6. Click Create.

To create a scrips folder with help of command line:

  1. Click Start, type ‘cmd’ in the Search programs and files text box, and press ENTER. The Command Prompt opens.
  2. Specify the operation you want to perform and the required parameters and arguments (actions you want to run) in the Command Prompt, for example as follows:

    dbforgesql.com /scriptsfolder [/switch1[:value | [parameter1:value parameter2:value ..]] /switch2 ..]
    
  3. Press ENTER to run the process.
  4. Select corresponding command line switches to perform the required operations:

    Argument Action and Usage
    /connection This switch is used to specify a connection string. The command line looks like:
    /connection:<connection_string>
    /database This switch is used to specify a database to create a script folder to. Command usage looks like:
    /database:<database_name>
    /decrypt This switch is used to define if source objects should be decrypted during describing.
    To enable the option, specify any of the following values: Yes, Y, On, True, T.
    To disable the option, specify any of the following values: No, N, Off, False, F. Command line looks like:
    /decrypt:<value>
    /password This switch is used to specify the server password. The switch overrides the password specified in the connection string. The command line looks like:
    /password:<pw>
    /path This switch is used to specify the script folder path. The command line looks like:
    /path:<folder_path>

Creating Snapshot

Snapshot is a file that contains information about a database structure in XML format.

To create a new snapshot:

  1. On the Database menu, point to Tasks, and then click Create Scripts Folder or Snapshot. The Create Scripts Folder or Snapshot dialog box opens.
  2. Select Source for the snapshot creation. Snapshot can be created on the basis of a database or a scripts folder.
  3. Depending on the selected Source type, specify:
    • For Database: Connection and required Database. Optionally, select Decrypt Encrypted Objects if you want encrypted objects be decrypted.
    • For Scripts Folder: path to the required scripts folder.
  4. In Destination, select Snapshot in the Type field.
  5. Specify Path to store the snapshot file.
  6. Optionally, you can select the Compress check box to archive the created file.
  7. Click Create.

To create a new snapshot with help of command line:

You can automate creation of target database snapshots using the command line.

To create a snapshot of target database through the command line, do the following:

  1. Open Command Prompt by pressing Win+R, and typing ‘cmd’ in the Open line.

    Note
    To run the Command Line in Windows 8:
    From the Desktop Mode

    • Move the mouse cursor to the exact lower left corner until the desktop shortcuts menu appears.
    • Right-click to see the shortcut menu and than click Run.

    From the Charms Bar

    • Move your mouse to the upper right corner until the Charms Bar appears.
    • Select Apps from the list and type ‘run’ in the search box.
    • Click Run from the search results.

    Use Windows + R Shortcut Keys

    • In desktop mode, press the Windows + R keys, to show the Run command line.
  2. Type a path to the datacompare.com file, located in dbForge Studio for SQL Server installation folder on your PC, and press the SPACE bar.
    "C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com"
    
  3. Specify the action you want to perform:
    "C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /snapshot
    
  4. Specify the connection string and schemas:

    "C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /snapshot /connection:"User Id=hr;Server=SQL;Unicode=True" /s:"SH,SH"
    
  5. Press ENTER to run the process.

    Tip: To see a quick help on the switches available for the /snapshot operation, type the following:

    "C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /snapshot /?
    

Arguments Used in Command Line

Select a corresponding command line switch to perform a required operation:

Argument Action and Usage
/alias Use the switch to define a version control alias. Command usage looks like:
/alias:<value>
/comment Use the switch to write a comment. Command usage looks like:
/comment:<value>
/compress Use the switch to apply compression to a snapshot file. Command usage looks like:
/compression:<value>
To turn this option on, type Yes, Y, On, True, T.
To turn this option off, type No, N, Off, False, F.
/connection Use the switch to specify a full connection string with additional parameters. This argument is required. Command usage looks like:
/connection:<connection_string>
/file Use the switch to specify a file name and its path to save a created snapshot file. Command usage looks like:
/file:<file_path>
If a path is not specified, a snapshot file will be saved to a current directory.
/password Use the switch to specify a server password. Define this argument to override the password specified in the connection string. Command usage looks like:
/password:<pw>

Command line used to make a snapshot of a schema may look like:

"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /snapshot /connection:"User Id=hr;Server=SQL;Unicode=True;" /password:my_pass /schema:"HR" /file:"result.snap"

If you connect to the server in the Direct mode, the connection parameters will differ and the command line used to make a snapshot of a schema will look like:

"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /snapshot /connection:"User Id=hr;Server=dbSQL;Connect Mode=SysDba;Unicode=True;Direct=True;Service Name=SQL" /password:my_pass /schema:"HR" /file:"result.snap"