--- alias: operation-guide-backupdatabasestool tags: - database description: "This documentation guides users through backing up Critical Manufacturing MES databases during installation" --- # Backup Databases Tool If any installations of Critical Manufacturing MES are already deployed, you can perform a backup of the current databases directly from the main Critical Manufacturing MES setup. You can use those same custom backup databases in the installation process. ## Using the UI After running the `setup.exe` program from the root of the ISO, selecting **Backup Database** will start this section of the installation program. !!! warning The installation of this environment is expected to have an associated customization package. If this is not the case, custom database objects (such as synonyms, jobs, and other) will not be updated to the new environment settings. ### Step 1: Import Configuration File This step allows you to load a previously exported file with the configuration of the backups to perform. It will automatically fill out the information existing in the selected file. !!! info You can also use a configuration file used in a previous installation since the fields are consistently named. ![Backup Databases - Import Original Backup Configuration File](../images/backup_import.png) Select **Next** to continue. ### Step 2: General In this screen, you must specify the following settings: * **System Name** - name of the backup that will be generated. * **Backup Share** - location where the backup files will be generated. * **Use Compression** - whether the backup files should be zipped upon generation. * **Force Backup** - force the creation of database backup files, even if a backup file already exists. !!! info If a backup for any of the databases already exists in the backup share folder and the **force backup** setting is **disabled**, the system will use this backup files to create the package. For instance, if the System Name is `CriticalManufacturing`, the system can use `CriticalManufacturing.bak`, `CriticalManufacturingODS.bak`, and `CriticalManufacturingDWH.bak` in the backup share folder, provided they exist. Otherwise, if the **force backup** setting is **enabled**, the database backup files will be created using the current database. Also, considering this previous scenario with the System Name `CriticalManufacturing` where a previous database backup file for this database already exists, for example `CriticalManufacturing.bak`, it will be renamed to `CriticalManufacturing_old.bak`. ![Backup Databases - General Settings](../images/backup_generalsettings.png) ### Step 3: Databases In this screen, you must specify the credentials for the connections to all the databases available for a given system: * **Online** * **ODS** * **DWH** For each database, specify the following settings: * **Database Server** - address of the database server. * **Database User** - user account with adequate permissions to connect to the database and perform the backup. * **Database User Password** - password for the database user defined above. ![Backup Databases - Databases](../images/backup_databases.png) ### Step 4: Preview Before the backup is performed, you will be shown a summary of the actions that will be performed. ![Backup Databases - Preview](../images/backup_preview.png) ### Step 5: Backup Databases In this screen, you can **Export** all the current backup configuration data to a file. To export the current configuration data, you need to select **Export** and then choose a location and a file name. ![Backup Databases - Export](../images/backup_export.png) Select **Backup** to begin the installation. You will have two tabs, one that shows the progress of the backup, and another that shows the details of the backup log. ![Backup Databases - Progress](../images/backup_progress.png) After the process is completed successfully, a screen will display that information: ![Backup Databases - Success](../images/backup_success.png) ## Using the Command Line You can also execute the backup functionality directly from the command line. For example: ```powershell CmfDeploy.exe backup --parameters=parameters.json --packageSource=F:\packages ``` The following parameters are available: * `--parameters` - Specifies the path to the parameters file (`parameters.json`). This file contains the MES database configuration and can be generated using the **Export** functionality described in Step 5 of this guide. * `--packageSource` - Specifies the location of the "packages" directory from the ISO image. The example above assumes the ISO is mounted on drive `F:`.