Run a MySQL Backup Operation Using SBT from the Command Line Interface

Run a full or an incremental backup to back up data, configuration and other information into a single backup image. An image is a compressed dump file that contains all the database files. The name of an image file specified during a backup job should be unique.

Before You Begin

  • Before running a backup on LINUX, execute the following command on the client after substituting with parameters values.

    export LD_LIBRARY_PATH=<Software_Installation_Directory>/Base
  • Ensure that the MySQL user is a part of Commvault group.

  • Verify that the instance is configured correctly before running backups from the command line.

  • Verify that the instance name does not contain more than 8 characters.

  • Configure the command line storage policy from the CommCell Console.

Procedure for Running a Full Backup

UNIX

Navigate to the bin directory of MySQL Enterprise Backup and run the following command after substituting the parameter values:

./mysqlbackup --defaults-file=<mysql configuration file location> -u <mysql username> -p --socket=<socket location> --sbt-lib-path=<path to libobk.so> --sbt-database-name=<MySQL instance name> --backup-image=<unique image name> --backup-dir=<non existing directory path> backup-to-image

Example:

./mysqlbackup --defaults-file=/usr/my.cnf
-u root -p
--socket=/var/lib/mysql/mysql.sock
--sbt-lib-path=/opt/commvault/Base/libobk.so
--sbt-database-name=myserve
--backup-image="sbt:image1"
--backup-dir=/sbt/full1/ backup-to-image

Windows

Navigate to the folder where MySQL Enterprise Backup is installed and run the following command after substituting the parameter values:

C:\Program Files\MySQL\MySQL Enterprise Backup 3.11>mysqlbackup --defaults-file=<mysql configuration file location> -u <mysql username> -p<password> --sbt-lib-path=<software_installation_path\Base\OraSBT.dll> --sbt-database-name=<MySQL_instance_name_on_GUI> --backup-image=sbt:<unique image name> --backup-dir=<non existingor empty directory path> --port=<port_number_uses_by_mysql_instance> backup-to-image

Example:

C:\Program Files\MySQL\MySQL Enterprise Backup 3.11>mysqlbackup
--backup-dir=c:\lin_full
--sbt-database-name=mysql56
-u root -pmysql
--sbt-lib-path="C:\Program Files\CommVault\ContentStore\Base\Orasbt.dll"
--backup-image="sbt:mysql6test_bak_full"
--port=3308 backup-to-image

Procedure for Running an Incremental Backup

UNIX

Navigate to the bin directory of MySQL Enterprise Backup and run the following command after substituting the parameter values:

./mysqlbackup --defaults-file=<mysql configuration file location> -u <mysql username> -p --socket=<socket location> --sbt-lib-path=<path to libobk.so> --sbt-database-name=<MySQL instance name> --backup-image="sbt:image1" --backup-dir=<non existing directory path> --incremental --start-lsn=<end LSN of previous FULL or incremental backup> backup-to-image

Example:

./mysqlbackup --defaults-file=/usr/my.cnf -u root -p
--socket=/var/lib/mysql/mysql.sock
--sbt-lib-path=/opt/commvault/Base/libobk.so
--sbt-database-name=myserve
--backup-image="sbt:image11"
--backup-dir=/sbt/inrc1/
--incremental --start-lsn=2293653 backup-to-image

Windows

Navigate to the folder where MySQL Enterprise Backup is installed and run the following command after substituting the parameter values:

C:\Program Files\MySQL\MySQL Enterprise Backup 3.11>mysqlbackup --defaults-file=<mysql configuration file location> -u <mysql username> -p<password> --sbt-lib-path=<software_installation_path\Base\OraSBT.dll> --sbt-database-name=<MySQL_instance_name_on_GUI> --backup-image=sbt:<unique image name> --backup-dir=<non existing or empty directory path> --port=<port_number_uses_by_mysql_instance> backup-to-image --incremental --start-lsn=<the_end_of_lsn_number_from_previous_backup>|--incremental-base="<the_path_of_previous_backup>"|--incremental-with-redo-log-only

Example:

C:\Program Files\MySQL\MySQL Enterprise Backup 3.11>mysqlbackup
 --incremental-with-redo-log-only --backup-dir=
--incremental-base="dir:c:\lin_full"
--sbt-database-name=mysql56
-u root -pmysql
--sbt-lib-path="C:\Program Files\CommVault\ContentStore\Base\OraSBT.dll"
 --backup-image="sbt:mysql6test_bak_incr"
--port=3308 backup-to-image
C:\Program Files\MySQL\MySQL Enterprise Backup 3.11>mysqlbackup
 --incremental --backup-dir=
--incremental-base="dir:c:\lin_full"
--sbt-database-name=mysql56
-u root -pmysql
--sbt-lib-path="C:\Program Files\CommVault\ContentStore\Base\OraSBT.dll"
--backup-image="sbt:incr1_image"
--port=3308 backup-to-image
C:\Program Files\MySQL\MySQL Enterprise Backup 3.12.1>mysqlbackup
 --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
-u root -pmysql
--sbt-lib-path="C:\Program Files\CommVault\ContentStore\Base\Orasbt.dll"
--sbt-database-name=mysql56
--backup-image="sbt:newincreimg"
 --incremental --backup-dir="C:\sbt_backups\newincremdir"
 --port=3308
--incremental-backup-dir="C:\sbt_backups\newfulldir" backup-to-image --start-lsn=34558847331

Available Parameters

The following table displays a few parameters you can use with the commands mentioned in the above sections.

Parameter

Description of Parameter Values

--defaults-file

MySQL configuration file.

--socket

Path of the socket file.

--sbt-lib-path

Location of libobk.so on UNIX and location of oraSBT.dll on Windows.

--sbt-database-name

MySQL instance name in the CommCell Console. Instance name should not contain more than 8 characters.

--backup-image

Unique backup Image name after "sbt:".

--backup-dir

Non-existing or an empty directory path.

--port

Port number used by the MySQL instance for Windows client. The port number is also present in the MySQL Instance Properties dialog box.

--incremental-base

Previous backup image location.

--incremental-with-redo-log-only

Parameter used for redo log backup only.

--start-lsn

End of LSN number from the previous backup image.

--backup-to-image

Part of backup command line syntax.

Loading...