如果前面已经使用 mysqlbackup -uroot -proot --socket=/usr/local/mysql/mysql.sock --backup_dir=/u01/dbback/ copy-back
产生了多个文件备份,还可以直接利用这个已经产生的备份,生成一个单个文件。
方法为 :在最后加一个参数 :backup-dir-to-image
具体运行如下 :
运行之前为:
[root@sztech1 dbback]# ls -ltr
总用量 1916316
-rw-r--r-- 1 root root 246 4月 24 08:15 backup-my.cnf
-rw-r--r-- 1 root root 3810 4月 24 08:15 server-my.cnf
-rw-r--r-- 1 root root 12752 4月 24 08:15 server-all.cnf
drwx------ 11 root root 4096 4月 24 08:15 datadir
drwx------ 2 root root 4096 4月 24 09:47 meta
运行备份:
[root@sztech1 ~]# mysqlbackup -uroot -proot --socket=/usr/local/mysql/mysql.sock --backup_dir=/u01/dbback/ --backup-image=mybackup.bak backup-dir-to-image
MySQL Enterprise Backup version 3.11.0 Linux-3.8.13-16.2.1.el6uek.x86_64-x86_64 [2014/08/26]
Copyright (c) 2003, 2014, Oracle and/or its affiliates. All Rights Reserved.
mysqlbackup: INFO: Starting with following command line ...
mysqlbackup -uroot -pxxxx --socket=/usr/local/mysql/mysql.sock
--backup_dir=/u01/dbback/ --backup-image=mybackup.bak
backup-dir-to-image
mysqlbackup: INFO:
IMPORTANT: Please check that mysqlbackup run completes successfully.
At the end of a successful 'backup-dir-to-image' run mysqlbackup
prints "mysqlbackup completed OK!".
150424 09:47:14 mysqlbackup: INFO: MEB logfile created at /u01/dbback/meta/MEB_2015-04-24.09-47-14_backup_dir_to_image.log
mysqlbackup: INFO: Creating 14 buffers each of size 16777216.
150424 09:47:14 mysqlbackup: INFO: Backup-dir to image operation starts with following threads
1 read-threads 1 write-threads
150424 09:47:14 mysqlbackup: INFO: Adding database directory: meta
150424 09:47:14 mysqlbackup: INFO: Adding database directory: datadir
mysqlbackup: Progress in MB: 200 400 600 800 1000 1200 1400
150424 09:47:24 mysqlbackup: INFO: Copying /u01/dbback/datadir/ibdata1.
mysqlbackup: Progress in MB: 1600
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/city.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/country.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/countrylanguage.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/deletedcity.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/mytable.ibd.
150424 09:47:25 mysqlbackup: INFO: Adding database directory: datadir/world
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/dept.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/emp.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/emp_bak.ibd.
150424 09:47:25 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/emp_bak1.ibd.
150424 09:47:25 mysqlbackup: INFO: Adding database directory: datadir/test
150424 09:47:25 mysqlbackup: INFO: Adding database directory: datadir/sztech
150424 09:47:25 mysqlbackup: INFO: Adding database directory: datadir/sys
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/actor.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/address.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/category.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/city.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/country.ibd.
150424 09:47:26 mysqlbackup: INFO: Adding database directory: datadir/sakila
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/customer.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/film.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/film_actor.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/film_category.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/inventory.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/language.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/payment.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/rental.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/staff.ibd.
150424 09:47:26 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/store.ibd.
150424 09:47:26 mysqlbackup: INFO: Adding database directory: datadir/performance_schema
150424 09:47:27 mysqlbackup: INFO: Adding database directory: datadir/mysql
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/innodb_index_stats.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/innodb_table_stats.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/slave_master_info.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/slave_relay_log_info.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/slave_worker_info.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/departments.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/dept_emp.ibd.
150424 09:47:27 mysqlbackup: INFO: Adding database directory: datadir/innodb_memcache
150424 09:47:27 mysqlbackup: INFO: Adding database directory: datadir/employees
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/dept_manager.ibd.
150424 09:47:27 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/employees.ibd.
150424 09:47:28 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/salaries.ibd.
mysqlbackup: Progress in MB: 1800
150424 09:47:36 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/titles.ibd.
150424 09:47:38 mysqlbackup: INFO: Backup-dir to image operation completed successfully.
150424 09:47:38 mysqlbackup: INFO: Backup image created successfully.
mysqlbackup: INFO: Image Path = /u01/dbback/mybackup.bak
mysqlbackup completed OK!
[root@sztech1 ~]#
备份之后,再查看:
[root@sztech1 dbback]# pwd
/u01/dbback
[root@sztech1 dbback]# ls -ltr
总用量 1916316
-rw-r--r-- 1 root root 246 4月 24 08:15 backup-my.cnf
-rw-r--r-- 1 root root 3810 4月 24 08:15 server-my.cnf
-rw-r--r-- 1 root root 12752 4月 24 08:15 server-all.cnf
drwx------ 11 root root 4096 4月 24 08:15 datadir
drwx------ 2 root root 4096 4月 24 09:47 meta
-rw-r--r-- 1 root root 1962266884 4月 24 09:47 mybackup.bak
[root@sztech1 dbback]# du -sk *
4 backup-my.cnf
1916872 datadir
136 meta
1916284 mybackup.bak
16 server-all.cnf
4 server-my.cnf
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) | Powered by Discuz! X3.2 |