Source:MySQL Restore: Difference between revisions
(Rewriting in progress.) |
(Added link.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <div class="noprint">{{draft}} | ||
{{Copyright SEP AG|en}} | {{Copyright SEP AG|en}} | ||
{{Navigation_latest|release=4.4.3|link=[[Special:MyLanguage/MySQL|MySQL]]}}</ | {{Navigation_latest|release=[[Special:MyLanguage/SEP_sesam_Release_Versions|4.4.3/4.4.3 ''Grolar'']]|link=[[Special:MyLanguage/MySQL|MySQL]]}}</div><br /> | ||
==Overview== | ==Overview== | ||
<noinclude><div class="boilerplate metadata" id="Additional resources" style="background-color: #f0f0f0; color:#636f73; border: 1px ridge #cdd3db; margin: 0.5em; padding: 0.5em; float: right; width: 35%; "><center><b>Additional resources</b></center> | <noinclude><div class="boilerplate metadata" id="Additional resources" style="background-color: #f0f0f0; color:#636f73; border: 1px ridge #cdd3db; margin: 0.5em; padding: 0.5em; float: right; width: 35%; "><center><b>Additional resources</b></center> | ||
Line 18: | Line 17: | ||
{|style="margin: auto; margin-bottom:1em; width:100%; border:0px solid grey;" | {|style="margin: auto; margin-bottom:1em; width:100%; border:0px solid grey;" | ||
| rowspan="2" style="padding:0px 10px 0px;" | [[File:SEP Troubleshooting.png|45px|link=Troubleshooting_Guide]] | | rowspan="2" style="padding:0px 10px 0px;" | [[File:SEP Troubleshooting.png|45px|link=Troubleshooting_Guide#SQL]] | ||
| style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" | Problems? Check the [[Special:MyLanguage/Troubleshooting_Guide|MySQL troubleshooting]]. | | style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" | Problems? Check the [[Special:MyLanguage/Troubleshooting_Guide#MySQL|MySQL troubleshooting]]. | ||
|} | |} | ||
Line 29: | Line 28: | ||
<span style="font-size:92%; line-height: 1.3em; color:grey;">The procedures and features explained herein provide only information about the SEP sesam-specific parts of MySQL restore. For detailed information on MySQL-specific backup and recovery, refer to [https://dev.mysql.com/doc/ MySQL Documentation].</span> | <span style="font-size:92%; line-height: 1.3em; color:grey;">The procedures and features explained herein provide only information about the SEP sesam-specific parts of MySQL restore. For detailed information on MySQL-specific backup and recovery, refer to [https://dev.mysql.com/doc/ MySQL Documentation].</span> | ||
SEP sesam extension for MySQL and MariaDB is a part of a client package and enables an online backup and restore of one or more MySQL databases. During restore the <tt>mysql</tt> client program is used to import the data from a ''dump file'' to the MySQL database. | |||
Restore is triggered from the ''Menu bar'' -> '''Activities''' -> '''Restore'''. Restore wizard guides you through the process of restoring your data. For step-by-step procedure, see [[Special:MyLanguage/Standard_Restore_Procedure|Standard Restore Procedure]]. | |||
=== | === Prerequisites === | ||
*Make sure that | *Make sure that you have required '''permissions''' and '''access rights''' for MySQL restore, as described in [[Special:MyLanguage/4_4_3:MySQL_Backup#access|Configuring MySQL database backup]]. | ||
* | *Make sure that there is '''sufficient free space''' on the target storage system to which you are restoring your data. | ||
== {{anchor|restore}}Restoring MySQL databases == | == {{anchor|restore}}Restoring MySQL databases == | ||
Create a new restore task for the database you | Create a new restore task for the MySQL database. You can only restore a single database if you have backed it up with a separate backup task, as described in [[Special:MyLanguage/4_4_3:MySQL_Backup#database_bck|Configuring MySQL database backup]]. If you have not backed up individual databases separately, you can only perform a complete MySQL database restore, as shown in the following example. | ||
<ol><li> | <ol><li> | ||
From the SEP sesam GUI menu bar, select '''Activities -> Restore'''. The ''New restore task'' window opens.</li> | From the SEP sesam GUI menu bar, select '''Activities''' -> '''Restore'''. The ''New restore task'' window opens.</li> | ||
<li> | <li>To restore a complete MySQL database, select the backup task with the source ''all''. You can also search the savesets by task name or by filename or path to find the relevant task to restore. | ||
You can also restore a single MySQL database, if you have backed it up with a separate backup task; in this case, select the related single database task from the drop-down list.</li> | |||
{{note|With the backup source ''all'' you can restore only the complete database.}} | |||
<li>Under the '''Saved in period''' drop-down lists, specify the time frame for which you want to conduct the search. Click '''Next'''.</li> | <li>Under the '''Saved in period''' drop-down lists, specify the time frame for which you want to conduct the search. Click '''Next'''.</li> | ||
<li>The search results are displayed. From the list of | <li>The search results are displayed. From the list of savesets matching your query, click the version you want to restore. Click '''Next'''.</li> | ||
[[Image:MySQL_restore_select_task. | [[Image:MySQL_restore_select_task.jpg|700px|link=]] | ||
<br clear=all> | |||
<li>Review your restore task configuration and set additional restore options in the final '''Save and Start''' step of the wizard.</li> | |||
<ul><li>Under the '''Target Path Settings''', select one of the following options:</li> | |||
<ul><li>'''Restore to original target path''' (set by default): Restores the data to the same location from which it was backed up. If it is set together with the option ''overwrite existing files'' the target database will be deleted first and a new one will be created from the backup saveset.</li> | |||
<li>If you select the '''New restore target''' option and browse for the new target location, the target path may be incompatible with the MySQL task type. In this case, you have to select '''Restore with corresponding task type ''MySQL''''' option in the additional ''Restore type'' window. Then the data is imported into the new database. You always have to combine this option with ''No recover after restore'' option.</li> | |||
{{note|In case of a single database restore, a special ''CREATE DATABASE'' statement is inserted during the backup to be able to restore a single database to the new target location. For details about the statement, see [[Special:MyLanguage/4_4_3:MySQL_Backup#create_database|Configuring MySQL database backup]].}}</li></ul> | |||
<li>Under the '''Execution options''' drop-down list, select one of the following options: | |||
<ul><li>'''do not overwrite existing files/items''' (set by default): The database will not be restored if it already exists on the set target.</li> | |||
<li>'''overwrite existing files/items''': If the database exists on the target server, it will be replaced by the restored version.</li> | |||
<li>'''Auto recover after restore''': The data will be stored directly into the database without caching in the file system. Note that if you use this option the database must already exist, otherwise the restore fails. You have to use this option together with ''overwrite existing files'' option to be able to overwrite the existing database.</li> | |||
<li>'''No recover after restore''': Use this option if you are restoring MySQL database to a different location; afterwards, you have to start the import of data from the command line on the server manually.<br /> | |||
The data will be written as a ''dump file'' in the file system <tt>work</tt> directory, by default {{path|SESAM_VAR/work}}. The name of the file contains <tt>mysql-</tt> prefix, a saveset ID and the <tt>.tmp</tt> suffix.<br /> | |||
You have to import the ''dump file'' into the database by using <tt>mysql</tt> command, for example, <code>mysql < /var/opt/sesam/var/work/mysql-SF20081128224529.tmp</code>. | |||
</ul></ul> | |||
[[Image:MySQL_restore_save.jpg|700px|link=]] | |||
<br clear=all> | <br clear=all> | ||
</ol> | </li> | ||
<li>If you want to start your MySQL restore immediately, click '''Start'''. If you want to save the restore task, click '''Save'''.</li></ol> | |||
A restore task can be scheduled like any other task. If you want to add a restore task to the schedule, see [[Special:MyLanguage/Scheduling_Restore|Scheduling Restore]]. | |||
==See also== | ==See also== | ||
[[Special:MyLanguage/4_4_3: | [[Special:MyLanguage/4_4_3:MySQL_Backup|MySQL Backup]] |
Revision as of 12:13, 16 January 2019
Overview
The procedures and features explained herein provide only information about the SEP sesam-specific parts of MySQL restore. For detailed information on MySQL-specific backup and recovery, refer to MySQL Documentation.
SEP sesam extension for MySQL and MariaDB is a part of a client package and enables an online backup and restore of one or more MySQL databases. During restore the mysql client program is used to import the data from a dump file to the MySQL database.
Restore is triggered from the Menu bar -> Activities -> Restore. Restore wizard guides you through the process of restoring your data. For step-by-step procedure, see Standard Restore Procedure.
Prerequisites
- Make sure that you have required permissions and access rights for MySQL restore, as described in Configuring MySQL database backup.
- Make sure that there is sufficient free space on the target storage system to which you are restoring your data.
Restoring MySQL databases
Create a new restore task for the MySQL database. You can only restore a single database if you have backed it up with a separate backup task, as described in Configuring MySQL database backup. If you have not backed up individual databases separately, you can only perform a complete MySQL database restore, as shown in the following example.
- From the SEP sesam GUI menu bar, select Activities -> Restore. The New restore task window opens.
- To restore a complete MySQL database, select the backup task with the source all. You can also search the savesets by task name or by filename or path to find the relevant task to restore. You can also restore a single MySQL database, if you have backed it up with a separate backup task; in this case, select the related single database task from the drop-down list.
- Under the Saved in period drop-down lists, specify the time frame for which you want to conduct the search. Click Next.
- The search results are displayed. From the list of savesets matching your query, click the version you want to restore. Click Next.
- Review your restore task configuration and set additional restore options in the final Save and Start step of the wizard.
- Under the Target Path Settings, select one of the following options:
- Restore to original target path (set by default): Restores the data to the same location from which it was backed up. If it is set together with the option overwrite existing files the target database will be deleted first and a new one will be created from the backup saveset.
- If you select the New restore target option and browse for the new target location, the target path may be incompatible with the MySQL task type. In this case, you have to select Restore with corresponding task type MySQL option in the additional Restore type window. Then the data is imported into the new database. You always have to combine this option with No recover after restore option.
- Under the Execution options drop-down list, select one of the following options:
- do not overwrite existing files/items (set by default): The database will not be restored if it already exists on the set target.
- overwrite existing files/items: If the database exists on the target server, it will be replaced by the restored version.
- Auto recover after restore: The data will be stored directly into the database without caching in the file system. Note that if you use this option the database must already exist, otherwise the restore fails. You have to use this option together with overwrite existing files option to be able to overwrite the existing database.
- No recover after restore: Use this option if you are restoring MySQL database to a different location; afterwards, you have to start the import of data from the command line on the server manually.
The data will be written as a dump file in the file system work directory, by defaultSESAM_VAR/work
. The name of the file contains mysql- prefix, a saveset ID and the .tmp suffix.
You have to import the dump file into the database by using mysql command, for example,mysql < /var/opt/sesam/var/work/mysql-SF20081128224529.tmp
.
- If you want to start your MySQL restore immediately, click Start. If you want to save the restore task, click Save.
Note | |
With the backup source all you can restore only the complete database. |
Note | |
In case of a single database restore, a special CREATE DATABASE statement is inserted during the backup to be able to restore a single database to the new target location. For details about the statement, see Configuring MySQL database backup. |
A restore task can be scheduled like any other task. If you want to add a restore task to the schedule, see Scheduling Restore.