mysql 備份與恢復 Mysql 備份與恢復

2021-10-18 02:28:56 字數 3148 閱讀 3576

資料檔案一致性處理

在完全備份的情況下,檔案不是時間點一致的,因為進行快照的時間點不一樣。如果嘗

試在未prepare資料的情況下還原資料庫,雖然操作上支援恢復,但是在啟動的時候仍會

進行資料recovery。

執行帶 /prepare/選項的 /mariabackup/命令會使資料檔案進行統一,達到資料一

致性的目的,從而將其還原到mariadb server後不會有異常。

使用增量備份時,需要 prepare 選項 和 incremental-dir 選項配合使用

以使用增量備份中的檔案進行恢復。

mariabackup --prepare --target-dri=/home/mysql/backup --user root

示例:mariabackup --user root --prepare --target-dir=./

mariabackup based on mariadb server 10.2.25-mariadb linux (x86_64)

[00] 2019-08-09 01:07:25 cd to /home/mysql/backup/

[00] 2019-08-09 01:07:25 this target seems to be not prepared yet.

[00] 2019-08-09 01:07:25 mariabackup: using the following innodb configuration for recovery:

[00] 2019-08-09 01:07:25 innodb_data_home_dir = .

[00] 2019-08-09 01:07:25 innodb_data_file_path = ibdata1:12m:autoextend

[00] 2019-08-09 01:07:25 innodb_log_group_home_dir = .

[00] 2019-08-09 01:07:25 innodb: using linux native aio

[00] 2019-08-09 01:07:25 starting innodb instance for recovery.

[00] 2019-08-09 01:07:25 mariabackup: using 104857600 bytes for buffer pool (set by --use-memory parameter)

2019-08-09 1:07:25 139813761947776 [note] innodb: mutexes and rw_locks use gcc atomic builtins

2019-08-09 1:07:25 139813761947776 [note] innodb: uses event mutexes

2019-08-09 1:07:25 139813761947776 [note] innodb: compressed tables use zlib 1.2.7

2019-08-09 1:07:25 139813761947776 [note] innodb: using linux native aio

2019-08-09 1:07:25 139813761947776 [note] innodb: number of pools: 1

2019-08-09 1:07:25 139813761947776 [note] innodb: using sse2 crc32 instructions

2019-08-09 1:07:25 139813761947776 [note] innodb: initializing buffer pool, total size = 100m, instances = 1, chunk size = 100m

2019-08-09 1:07:25 139813761947776 [note] innodb: completed initialization of buffer pool

2019-08-09 1:07:25 139813501150976 [note] innodb: page_cleaner coordinator priority: -20

2019-08-09 1:07:25 139813761947776 [note] innodb: highest supported file format is barracuda.

2019-08-09 1:07:25 139813761947776 [note] innodb: starting crash recovery from checkpoint lsn=793366562214

2019-08-09 1:07:27 139813761947776 [note] innodb: starting a batch to recover 7054 pages from redo log.

2019-08-09 1:07:40 139813559899904 [note] innodb: to recover: 2396 pages from log

2019-08-09 1:07:55 139813761947776 [note] innodb: read redo log up to lsn=793393743872

2019-08-09 1:07:55 139813761947776 [note] innodb: starting a batch to recover 6218 pages from redo log.

2019-08-09 1:08:10 139813543114496 [note] innodb: to recover: 1785 pages from log

2019-08-09 1:08:21 139813761947776 [note] innodb: starting final batch to recover 3572 pages from redo log.

2019-08-09 1:08:25 139813559899904 [note] innodb: to recover: 1325 pages from log

2019-08-09 1:08:29 139813761947776 [note] innodb: last binlog file './mysql-bin.000939', position 48267434

[00] 2019-08-09 01:08:30 last binlog file ./mysql-bin.000939, position 48267434

mysql 備份與恢復 MySQL 備份與恢復

1 檢視資料庫的資料儲存在哪個目錄下 shiyanlou mysql uroot e show variables like datadir variable name value datadir var lib mysql 2 備份資料的方法 select into outfile 檔名 或者 s...

mysql備份恢復 mysql之備份與恢復

工作中,我們經常會遇到資料庫的備份與恢復場景 目錄1 mysql的備份與恢復 2 mysql的匯入與匯出 1 mysql的備份與恢復 mysql的備份命令是mysqldump,mysql之備份 mysqldump u user h host port p db table.file u 後面接資料庫...

MYSQL備份與恢復

1.mysqlhotcopy 其命令格式如下 shell mysqlhotcopy db name path to some dir 只要伺服器不再進行更新,還可以只複製所有表檔案 frm myd和 myi檔案 mysqlhotcopy指令碼使用該方法。但請注意如果資料庫包含innodb表,這些方法...