DBBlobEditor - View / Edit / Import / Export Database LOB (BLOB, CLOB) data »

Automate Database BLOB Data Synchronization via CLI Mode

In daily database management, synchronous backup of large object data such as BLOB/CLOB is a high-frequency requirement. Manual operations are not only inefficient but also prone to omissions. DBBlobEditor offers CLI (Command Line Interface) execution capabilities, and when combined with system scheduled tasks, it enables effortless automated and scheduled synchronization of BLOB data, making the migration and backup of large object data more efficient and stable. This article details the full process configuration for achieving scheduled synchronization of database BLOB data through DBBlobEditor's CLI mode, with support for Windows, Linux, and macOS systems.

1. Preparations: Save the LOB Task Session

To enable command line execution and scheduled synchronization, you first need to configure the import/export rules for LOB data in the DBBlobEditor graphical interface and save them as a task session—this is the foundation for subsequent CLI execution and scheduled scheduling across all systems.

  1. Open DBBlobEditor, complete the connection to the target database, and configure the synchronization rules for BLOB/CLOB data (e.g., exporting data from the database table t_clob to the local path F:\test\clob for Windows, or corresponding paths like /home/user/test/clob for Linux/macOS);
  2. After configuration, the software will pop up the Save Session window. Confirm the source and target paths of the session are correct, then specify the save path for the session file (example: C:\Users\pan\Documents\t_clob.elt for Windows, /home/user/Documents/t_clob.elt for Linux/macOS);
  3. The window provides three options: OK, Save & Make Batch File, and Cancel. Select Save & Make Batch File to proceed to the batch file creation step (shell scripts are generated for Linux/macOS automatically).

Save the LOB Task Session

2. Create Batch/Shell File: Generate the Basic Script for CLI Execution

Clicking Save & Make Batch File will bring up the Create Batch File configuration window. The core of this step is to associate the session file and log file, and generate an executable batch file (.bat for Windows) or shell script (.sh for Linux/macOS), facilitating subsequent command line calls and scheduled task execution.

Configure Associated Files

Confirm Generation

The window provides two core options: OK and Create & Schedule Task. Click OK if you only need to generate the file for manual CLI execution; select Create & Schedule Task if you want to configure scheduled tasks directly. We will explain CLI execution first, then scheduled scheduling configuration.

After clicking OK, the software generates the corresponding executable file in the specified path, which encapsulates the core commands for BLOB data synchronization and lays the groundwork for subsequent operations.

Create Batch/Shell File

3. CLI Execution: Manually Run the Synchronization Task via Command Line

After generating the batch/shell file, you can manually execute the BLOB data synchronization task through the command line of the corresponding system, which is simple, flexible, and suitable for ad-hoc synchronization needs.

For Windows

  1. Open the Windows CMD command line tool and run it as an administrator (to avoid path permission issues);
  2. Switch to the DBBlobEditor installation directory (prerequisite for executing core commands):
C:
cd "C:\Users\pan\AppData\Local\Programs\DBBlobEditor"
  1. Execute the core synchronization command, specifying the session file via the session parameter and the log file via the logfile parameter:
DBBlobEditor session="C:\Users\pan\Documents\t_clob.elt" logfile="C:\Users\pan\Documents\t_clob.log"

For Linux & macOS

  1. Open the terminal and grant executable permissions to the generated shell script (replace the path with your actual script path):
chmod +x /home/user/Documents/t_clob.sh
  1. Switch to the DBBlobEditor installation directory (default path can be adjusted according to actual installation):
cd /opt/DBBlobEditor
  1. Execute the core synchronization command with the same parameter rules as Windows:
./DBBlobEditor session="/home/user/Documents/t_clob.elt" logfile="/home/user/Documents/t_clob.log"

After running the command, DBBlobEditor will automatically complete the BLOB/CLOB data synchronization according to the configuration in the session file, and the execution process and results will be recorded in the specified log file in real time across all systems.

4. Achieve Scheduled Synchronization: Automate Execution with System Scheduled Tasks

Manual CLI execution meets ad-hoc needs, and combining it with the built-in scheduled task tools of each system enables automated synchronization strategies such as one-time execution at a specified time and recurring execution daily/weekly, completely freeing up manual work. The software’s Create & Schedule Task option supports direct jump to the system’s scheduled task configuration interface for quick setup, and you can also configure it manually as follows:

For Windows

Use the Task Scheduler:

  1. Open Windows Task Scheduler and create a basic task;
  2. Name the task (e.g., "Daily Database BLOB Data Synchronization") and set the trigger conditions (e.g., execute at 2 AM every day);
  3. Select the operation Start a program, browse and select the generated batch file;
  4. Confirm the configuration and complete the creation. The system will automatically execute the batch file at the set time to complete BLOB data synchronization. It is recommended to check Run with highest privileges to avoid permission issues.

For Linux

Use the crontab tool (the most common scheduled task tool for Linux):

  1. Open the terminal and edit the crontab configuration file:
crontab -e
  1. Add a scheduled task rule (take executing the synchronization script at 2 AM every day as an example, replace the path with your actual DBBlobEditor installation path and script path):
0 2 * * * /opt/DBBlobEditor/DBBlobEditor session="/home/user/Documents/t_clob.elt" logfile="/home/user/Documents/t_clob.log" >> /home/user/Documents/clob_sync_cron.log 2>&1
  1. Save and exit the editor, and the crontab service will automatically load the configuration to implement scheduled execution.

For macOS

Use either crontab (same as Linux) or the native Launchd tool:

  1. Crontab (simpler): Follow the same configuration steps as Linux, the crontab rule format is completely consistent;
  2. Launchd (native and stable): Create a plist configuration file in the /Library/LaunchDaemons/ directory, define the execution time and the path of the DBBlobEditor execution command, then load the configuration file via the launchctl command to complete the scheduled task setup.

5. Key Notes for Cross-System Use

  1. Absolute Paths: When configuring session files, log files, and batch/shell files, use absolute paths on all systems to avoid execution failures caused by ambiguous relative paths in the command line or scheduled tasks;
  2. Permission Configuration
    • For Windows: Ensure the current account has database access rights and local file read/write rights;
    • For Linux/macOS: Grant executable permissions to the shell script with chmod +x, and ensure the executing user has database access rights, file system read/write rights, and execution rights for the DBBlobEditor program;
  3. Log Troubleshooting: If the synchronization task fails, check the detailed error information in the specified log file to locate the cause—this method is universal for all systems;
  4. Session File Update: The session file (.elt) is the core of synchronization rules. If you need to modify the synchronization source/target, reconfigure it in the DBBlobEditor graphical interface and save to overwrite the original session file (the modified file takes effect for subsequent CLI and scheduled tasks);
  5. Installation Directory Consistency: Confirm the DBBlobEditor installation directory on each system, and ensure the command line switches to the correct directory before execution to avoid "command not found" errors.

Summary

DBBlobEditor's CLI mode, combined with the native scheduled task tools of Windows, Linux, and macOS, provides a highly efficient automated solution for the synchronization of database BLOB/CLOB large object data. From saving task sessions and generating cross-system executable files, to manual CLI execution and scheduled scheduling configuration, the entire process is simple to operate and requires no complex script development, enabling scheduled synchronization and backup of data with ease. Whether for daily database data backup or cross-environment BLOB data migration, this method can greatly improve work efficiency, reduce errors caused by manual operations, and is suitable for database administrators and developers for daily use across all mainstream operating systems.