Scheduling data generation

You can use Windows Task Scheduler to create and manage data generation tasks that your computer will carry out automatically at the times you specify.

Scheduling data generation includes the following steps:

Creating a .bat file in dbForge Data Generator for SQL Server

First, you need to create a file with the .bat extension for data generation.

To create the .bat file, do the following:

1. Open an existing project or click New on the Start Page to create a new one.

2. On the Connection tab, specify the connection, select a required database, and click Next.

3. On the Options tab, set the default data generation options.

4. Choose the tables you would like to populate and click Generate data to the target database button Populate the data to the target database.

5. In the Data Population Wizard that opens, set the required options and then click Save Command Line.

Data Generator options tab

6. In the Command line execution file settings window that opens, verify and configure the settings to manage the *.bat file text.

Data Generator execution file settings

Command-line file settings

Name Default State Description
Project File No Specifies data generation template to use.
Connection Yes Specifies the connection string.
Password No Specifies the connection password. Overrides the password specified in the connection string.
Error Mode No Specifies the application behavior when an error is encountered; to ignore all errors during the data population, specify: ignore; to cancel the data population if any error occurs, specify: abort.
Echo OFF No If this option is enabled, all the text in the.bat file will be enclosed in the @Echo OFF … @Echo ON construct. This will disable the display of the commands being entered on the screen.
Keep opened No If this option is enabled, the pause command will be placed at the end of the .bat file text. This will leave the command window open.
PowerShell No If this option is enabled, the & symbol will be generated at the beginning of the .bat file text. This will ensure PowerShell compatibility.

Creating a data generation task using Windows Scheduled Tasks

To create Windows task:

1. Open the Control Panel > Administrative Tools and select Task Scheduler.

2. In the Task Scheduler window that opens, navigate to the Actions pane and click Create Basic Task to create a scheduled task.

Click Create Basic Task in Windows Task Scheduler

3. In the Create Basic Task Wizard window that opens, specify the name and description of the task and click Next.

Specify the name and description

4. On the Trigger tab, choose when to launch the task and then click Next.

  • Schedule based on the calendar: Daily, Weekly, Monthly, or One time. For this, specify the schedule you want to use.
  • Schedule based on common recurring events: When the computer starts or When I log on.
  • Schedule based on specific events: When a specific event is logged. For this, specify the event log, source, and even ID using the drop-down lists.

Select the time period for the task to be started

5. On the Action tab, click Start a program to schedule a program to start automatically and then click Next.

Schedule a program to start automatically

6. On the Start a Program subtab, click Browse to select the .bat file you have created in the Data Generator Properties wizard and then click Next.

There are optional fields that you can set:

  • Add arguments: Specify the arguments to run the task with specific instructions.
  • Start in: Specify the folder in which the program will start.

Start a program

7. On the Finish tab, verify the settings and click Finish.

The task will be displayed in the Active Tasks section.

View the created task in the Active Tasks section of Task Scheduler