Restoring MySQL Backup

Open a new CLI session of the Session Monitor and run the MySQL shell utility at the CLI prompt.

MySQL shell utility does not run in an existing CLI session where the source /opt/oracle/ocsm/ocsm_env.sh was previously run. Hence, it is mandatory to open a new CLI session of Session Monitor to preform MySQL Restore procedure.
  1. Type mysqlsh --no-defaults command at the CLI prompt, it opens the MySQL shell prompt. Then run the below commands one by one in the prompt:
    1. Type \js to enter the JavaScript mode.
    2. Connect to a MySQL instance by typing the below command:
      \connect root@localhost:3306
    3. When prompted for a password, paste the password as copied from /root/.my.cnf .
    4. Prepare for restore by typing the below command one by one:
      \sql set GLOBAL local_infile=1;
      
      \sql ALTER INSTANCE DISABLE INNODB REDO_LOG;
      
      \sql drop database <DATABASE>;

      For Mediation Engine, use DATABASE = vsp

      For Mediation Engine Connector, use DATABASE = pldmaster

    5. Run the below command to begin restore:
      util.loadDump("/<PATH_TO_MYSQL_BACKUP_DIRECTORY>/<DATABASE>.dump", {threads: 88, ignoreVersion: true})

      Example For Mediation Engine:

       util.loadDump("/root/mysqlBackup/vsp.dump", {threads: 88,ignoreVersion:true})

      Once the restore is successful, you will see a message similar to the below sample:

      Target is MySQL 8.0.28-commercial. Dump was produced from MySQL 5.7.35-enterprise-commercial-advanced-log
      WARNING: Destination MySQL version is newer than the one where the dump was created. Loading dumps from different major MySQL versions is not fully supported and may not work. The 'ignoreVersion' option is enabled, so loading anyway.
      NOTE: Load progress file detected. Load will be resumed from where it was left, assuming no external updates were made.
      You may enable the 'resetProgress' option to discard progress for this MySQL instance and force it to be completely reloaded.
      Scanning metadata - done
      Executing common preamble SQL
      Executing DDL - done
      Executing view DDL - done
      Starting data load
      88 thds loading \ 100% (260.70 MB / 260.70 MB), 8.44 MB/s, 544 / 63 tables and partitions done
      Recreating indexes - done
      Executing common postamble SQL
      NOTE: The redo log is currently disabled, which causes MySQL to not be crash safe! Do not forget to enable it again before putting this instance in production.
      7796 chunks (9.97M rows, 260.70 MB) for 63 tables in 1 schemas were loaded in 1 min 40 sec (avg throughput 7.83 MB/s)
      0 warnings were reported during the load.
    6. Enable REDO_LOG by typing the below command:
      \sql ALTER INSTANCE ENABLE INNODB REDO_LOG;
    7. Exit from mysql-shell by typing the below command:
      \quit