Backup and Recovery Types
Physical(Raw) and Logical Backup:
1.Physical backups consist of raw copies of the directories and files that store database contents.
This type of backup is suitable for large, important databases that need to be recovered quickly.
2.Logical backups save information represents sa logical database structure(CREATE DATABASE,CREATE TABLE statements)
and content(INSERT statements or delimited-text files).
This type of backup is suitable for smaller amounts of data where you might edit the data values or table structure,or recreate the data on a different machine architecture.
3.Physical backup methods have these characteristics:
- faster than logical
- Output is more compact than for logical backup.
- MySQL Enterprise Backup product performs physical backups.
- can include related files such as log or configuration files.
- Data from memory tables is trycky to backup this way because their contents are not stored on disk.
- 备份只能在特定或者相似硬件环境的设备上使用.
- 可以在MySQL服务器停止运行的时候执行.如果服务器在运行,需要执行appropriate locking so that the server 不会改变数据库内容 during the backup.
- 企业版自动对需要的tables执行locking.
- 物理备份工具包括mysqlbackup(企业版).
Logical备份:
- The backup is done by querying the MySQL server to obtain database structure and content information.
- Backup is slower than physical methods.
- Output is larger than for physical backup, particuylarly when saved in text format.
- Backup and resstore granularity is availableat the server level(all databases),database leve(all tables in a particular databse),or table level.This is true regradless of storage engine.
- The backup does not inclue log or configuration files,or other database-related files that are not part of databases.
- Backups stored in logical format are machine independent and highly portable.
- Logical backups are performed with the MySQL server running.The server is not taken offline.
- Logical bakcup tools include the mysqldump program and the SELECT ... INTO OUTFILE statement.These work for any storage engine,even MEMORY.
- To restore logical backupos,SQL-format dump files can be processed using the mysql client.To load delimited-text files,use the LOAD DATA INFILE statement or the mysqlimport client.
Online Versus Offline Backups
online backups take place while the MySQL server is running so that the database information can be obtained from the server.
Offline backups take place while the server is stopped.
This distinction can also be described as 'hot' versus 'cold' backups;
a 'warm' backup is one where the server remian running but locked against modifying data while you access database files externally.
Online:
The backup is less intrusive to other clients,which can connect to the MySQL server during the backup and may be able to access data depending on what operations they need to perform.
需要小心,强制相应锁定以至于数据修改无法执行会破坏备份完整性.MysQL企业备份工具会自动锁定.
Offline:
会对客户端产生不利影响.因为服务器在备份期间不可以使用.一般只应用于隶属服务器,这样即使其离线