How to create a scripts folder or a snapshot

Create a 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 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 scripts folder from the 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 Specifies a connection string. Usage:
/connection:<connection_string>
/database Specifies a database to create a script folder to. Usage:
/database:<database_name>
/decrypt Defines 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 Specifies the server password. The switch overrides the password specified in the connection string. Usage:
/password:<pw>
/path Specifies the script folder path. Usage:
/path:<folder_path>

Create a 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 from the 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 database:

"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /snapshot /connection:"Data Source=dbfsqlsrv\SQL2019;Integrated Security=False;User ID=su; Password=su;" /database:"AdventureWorks2019"  

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

Argument Action and Usage
/compress Applies compression to a snapshot file. Usage:
/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 Specifies the connection string. Usage:
/connection:<connection_string>
/database Specifies the target database. Usage:
/database:<database_name>
/decrypt Defines if source objects should be decrypted during describing. Usage:
/decrypt:[value]
To turn this option on, type Yes, Y, On, True, T.
To turn this option off, type No, N, Off, False, F.
/exitcodes Displays the list of possible exit codes that can be returned by the command-line process.
/file Specifies a file name and its path to save a created snapshot file. Usage:
/file:<file_path>
/password Specifies a server password. Usage:
/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:"Data Source=DBF\SQL2019;Integrated Security=False;User ID=sa; Password=sa;" /database:"AdventureWorks2019" /file:"result.snap"

Download dbForge Studio for SQL Server and try it absolutely free for 30 days!