重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3576|回复: 5
打印 上一主题 下一主题

使用 mysqlbackup恢复测试

[复制链接]
跳转到指定楼层
楼主
发表于 2015-4-24 10:46:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

1.在测试之前,先关闭mysql

   [root@sztech1 dbback]# service mysqld stop
   Shutting down MySQL.. SUCCESS!

 

2.模拟数据文件全部丢失

  [root@sztech1 mysql]# pwd
  /usr/local/mysql

 

  删除数据文件目录

  [root@sztech1 mysql]# mv data data_bak

 

3.创建一个数据文件目录

  [root@sztech1 mysql]# mkdir data

  [root@sztech1 mysql]# chown -R mysql:mysql data

 

4.查看一下恢复前的目录文件

  [root@sztech1 mysql]# ls -ltr
总用量 1084
-rw-r--r--  1 mysql mysql   2496 1月  19 21:48 README
-rw-r--r--  1 mysql mysql  17987 1月  19 21:48 COPYING
-rw-r--r--  1 mysql mysql 102315 1月  19 21:48 INSTALL-BINARY
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:46 docs
drwxr-xr-x  3 mysql mysql   4096 4月   5 09:46 include
drwxr-xr-x  4 mysql mysql   4096 4月   5 09:46 man
drwxr-xr-x  3 mysql mysql   4096 4月   5 09:46 lib
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:47 scripts
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:47 bin
drwxr-xr-x 10 mysql mysql   4096 4月   5 09:47 mysql-test
drwxr-xr-x 28 mysql mysql   4096 4月   5 09:47 share
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:47 support-files
drwxr-xr-x  4 mysql mysql   4096 4月   5 09:47 sql-bench
-rw-r--r--  1 mysql mysql    943 4月   5 10:02 my.cnf
-rw-r--r--  1 root  root     943 4月   5 22:44 my-new.cnf
-rw-r--r--  1 root  root      12 4月   6 16:24 off
drwxr-xr-x 11 mysql mysql   4096 4月  24 08:15 data_bak
-rw-rw----  1 mysql mysql  84694 4月  24 08:15 mysqld-slow_query.logbak
-rw-rw----  1 mysql mysql 825158 4月  24 08:16 mysqld-general.logbak
drwxr-xr-x  2 mysql mysql   4096 4月  24 08:47 data
 

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2015-4-24 10:49:13 | 只看该作者

5.执行恢复:

   

[root@sztech1 mysql]# mysqlbackup --backup_dir=/u01/dbback/ copy-back


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 --backup_dir=/u01/dbback/ copy-back

 mysqlbackup: INFO:
IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'copy-back' run mysqlbackup
           prints "mysqlbackup completed OK!".

150424 08:49:36 mysqlbackup: INFO: MEB logfile created at /u01/dbback/meta/MEB_2015-04-24.08-49-36_copy_back.log

 mysqlbackup: WARNING: If you restore to a server of a different version, the innodb_data_file_path parameter might have a different default. In that case you need to add 'innodb_data_file_path=ibdata1:12M:autoextend' to the target server configuration.
--------------------------------------------------------------------
                       Server Repository Options:
--------------------------------------------------------------------
  datadir = /usr/local/mysql/data
  innodb_data_home_dir = /usr/local/mysql/data
  innodb_data_file_path = ibdata1:12M:autoextend
  innodb_log_group_home_dir = /usr/local/mysql/data
  innodb_log_files_in_group = 3
  innodb_log_file_size = 512M
  innodb_page_size = Null
  innodb_checksum_algorithm = innodb

--------------------------------------------------------------------
                       Backup Config Options:
--------------------------------------------------------------------
  datadir = /u01/dbback/datadir
  innodb_data_home_dir = /u01/dbback/datadir
  innodb_data_file_path = ibdata1:12M:autoextend
  innodb_log_group_home_dir = /u01/dbback/datadir
  innodb_log_files_in_group = 3
  innodb_log_file_size = 536870912
  innodb_page_size = 16384
  innodb_checksum_algorithm = innodb

 mysqlbackup: INFO: Creating 14 buffers each of size 16777216.
150424 08:49:36 mysqlbackup: INFO: Copy-back operation starts with following threads
                1 read-threads    1 write-threads
150424 08:49:36 mysqlbackup: INFO: Copying /u01/dbback/datadir/ibdata1.
150424 08:49:37 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/departments.ibd.
150424 08:49:37 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/dept_emp.ibd.
150424 08:49:37 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/dept_manager.ibd.
150424 08:49:37 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/employees.ibd.
150424 08:49:38 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/salaries.ibd.
 mysqlbackup: Progress in MB: 200
150424 08:49:41 mysqlbackup: INFO: Copying /u01/dbback/datadir/employees/titles.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/innodb_index_stats.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/innodb_table_stats.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/slave_master_info.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/slave_relay_log_info.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/mysql/slave_worker_info.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/actor.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/address.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/category.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/city.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/country.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/customer.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/film.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/film_actor.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/film_category.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/inventory.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/language.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/payment.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/rental.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/staff.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sakila/store.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/dept.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/emp.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/emp_bak.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/sztech/emp_bak1.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/city.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/country.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/countrylanguage.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/deletedcity.ibd.
150424 08:49:42 mysqlbackup: INFO: Copying /u01/dbback/datadir/world/mytable.ibd.
150424 08:49:42 mysqlbackup: INFO: Starting to copy Binlog files...
150424 08:49:42 mysqlbackup: INFO: Copying the database directory 'employees'
150424 08:49:42 mysqlbackup: INFO: Copying the database directory 'innodb_memcache'
150424 08:49:42 mysqlbackup: INFO: Copying the database directory 'mysql'
150424 08:49:43 mysqlbackup: INFO: Copying the database directory 'performance_schema'
150424 08:49:43 mysqlbackup: INFO: Copying the database directory 'sakila'
150424 08:49:43 mysqlbackup: INFO: Copying the database directory 'sys'
150424 08:49:43 mysqlbackup: INFO: Copying the database directory 'sztech'
150424 08:49:43 mysqlbackup: INFO: Copying the database directory 'test'
150424 08:49:43 mysqlbackup: INFO: Copying the database directory 'world'
150424 08:49:43 mysqlbackup: INFO: Completing the copy of all non-innodb files.
150424 08:49:43 mysqlbackup: INFO: Completed the copy of binlog files...
150424 08:49:43 mysqlbackup: INFO: Copying the log file 'ib_logfile0'
 mysqlbackup: Progress in MB: 400 600 800
150424 08:49:44 mysqlbackup: INFO: Copying the log file 'ib_logfile1'
 mysqlbackup: Progress in MB: 1000 1200
150424 08:49:47 mysqlbackup: INFO: Copying the log file 'ib_logfile2'
 mysqlbackup: Progress in MB: 1400 1600 1800
150424 08:49:50 mysqlbackup: INFO: Creating server config files server-my.cnf and server-all.cnf in /usr/local/mysql/data
150424 08:49:50 mysqlbackup: INFO: Copy-back operation completed successfully.
150424 08:49:50 mysqlbackup: INFO: Finished copying backup files to '/usr/local/mysql/data'

mysqlbackup completed OK! with 1 warnings

 

恢复完成,但有警告,经查看,这个警告为:

mysqlbackup: WARNING: If you restore to a server of a different version, the innodb_data_file_path parameter might have a different default. In that case you need to add 'innodb_data_file_path=ibdata1:12M:autoextend' to the target server configuration.

 

不碍事。

[此贴子已经被作者于2015-04-24 10:50:44编辑过]
回复 支持 反对

使用道具 举报

板凳
 楼主| 发表于 2015-4-24 10:52:31 | 只看该作者

6.检查文件是否恢复回来

 

[root@sztech1 mysql]# du -sk *|sort -rn
1917112 data_bak
1916896 data

496800  bin
235804  lib
186688  mysql-test
3240    share
2800    sql-bench
948     include
844     man
812     mysqld-general.logbak
100     INSTALL-BINARY
88      mysqld-slow_query.logbak
40      scripts
36      support-files
20      COPYING
16      docs
4       README
4       off
4       my-new.cnf
4       my.cnf
[root@sztech1 mysql]#

 

看来文件是回来了。

 

[root@sztech1 data]# pwd
/usr/local/mysql/data

 

[root@sztech1 data]# ls -ltr
总用量 1650784
-rw-r--r-- 1 root root  79691776 4月  24 08:49 ibdata1
-rw-r--r-- 1 root root       170 4月  24 08:49 mysql-binlog.000019
-rw-r--r-- 1 root root       343 4月  24 08:49 mysql-binlog.000020
-rw-r--r-- 1 root root       386 4月  24 08:49 mysql-binlog.000021
-rw-r--r-- 1 root root       143 4月  24 08:49 mysql-binlog.000022
drwx------ 2 root root      4096 4月  24 08:49 employees
-rw-r--r-- 1 root root       120 4月  24 08:49 mysql-binlog.000023
drwx------ 2 root root      4096 4月  24 08:49 innodb_memcache
drwx------ 2 root root      4096 4月  24 08:49 mysql
drwx------ 2 root root      4096 4月  24 08:49 performance_schema
drwx------ 2 root root      4096 4月  24 08:49 sakila
drwx------ 2 root root      4096 4月  24 08:49 sys
drwx------ 2 root root      4096 4月  24 08:49 sztech
drwx------ 2 root root      4096 4月  24 08:49 test
drwx------ 2 root root      4096 4月  24 08:49 world
-rw-r--r-- 1 root root       110 4月  24 08:49 mysql-binlog.index
-rw-r--r-- 1 root root 536870912 4月  24 08:49 ib_logfile0
-rw-r--r-- 1 root root 536870912 4月  24 08:49 ib_logfile1
-rw-r--r-- 1 root root 536870912 4月  24 08:49 ib_logfile2
-rw-r--r-- 1 root root       340 4月  24 08:49 backup_variables.txt
-rw-r--r-- 1 root root      3877 4月  24 08:49 server-my.cnf
-rw-r--r-- 1 root root     12798 4月  24 08:49 server-all.cnf

回复 支持 反对

使用道具 举报

地板
 楼主| 发表于 2015-4-24 10:59:00 | 只看该作者

7.启动mysql

[root@sztech1 mysql]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/mysqld.pid).

  启动失败,

 

  查看参数文件/etc/my.cnf

 

[root@sztech1 mysql]# more /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]
user=mysql
socket=/usr/local/mysql/mysql.sock
## /tmp/mysql.sock
autocommit=1
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
log-output=FILE
pid-file=/usr/local/mysql/mysqld.pid
basedir=/usr/local/mysql

 

查看错误日志:

 

[root@sztech1 data]# more sztech1.err
150424 09:07:01 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2015-04-24 09:07:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_
for_timestamp server option (see documentation for more details).
/usr/local/mysql/bin/mysqld: File './mysql-binlog.index' not found (Errcode: 13 - Permission denied)
2015-04-24 09:07:01 3245 [ERROR] Aborting

2015-04-24 09:07:01 3245 [Note] Binlog end
2015-04-24 09:07:01 3245 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

150424 09:07:01 mysqld_safe mysqld from pid file /usr/local/mysql/mysqld.pid ended

 

看来是权限有问题,查看 /usr/local/mysql/data

 

[root@sztech1 data]# pwd
/usr/local/mysql/data
[root@sztech1 data]# ls -ltr
总用量 1650788
-rw-r--r-- 1 root  root  79691776 4月  24 08:49 ibdata1
-rw-r--r-- 1 root  root       170 4月  24 08:49 mysql-binlog.000019
-rw-r--r-- 1 root  root       343 4月  24 08:49 mysql-binlog.000020
-rw-r--r-- 1 root  root       386 4月  24 08:49 mysql-binlog.000021
-rw-r--r-- 1 root  root       143 4月  24 08:49 mysql-binlog.000022
drwx------ 2 root  root      4096 4月  24 08:49 employees
-rw-r--r-- 1 root  root       120 4月  24 08:49 mysql-binlog.000023
drwx------ 2 root  root      4096 4月  24 08:49 innodb_memcache
drwx------ 2 root  root      4096 4月  24 08:49 mysql
drwx------ 2 root  root      4096 4月  24 08:49 performance_schema
drwx------ 2 root  root      4096 4月  24 08:49 sakila
drwx------ 2 root  root      4096 4月  24 08:49 sys
drwx------ 2 root  root      4096 4月  24 08:49 sztech
drwx------ 2 root  root      4096 4月  24 08:49 test
drwx------ 2 root  root      4096 4月  24 08:49 world
-rw-r--r-- 1 root  root       110 4月  24 08:49 mysql-binlog.index
-rw-r--r-- 1 root  root 536870912 4月  24 08:49 ib_logfile0
-rw-r--r-- 1 root  root 536870912 4月  24 08:49 ib_logfile1
-rw-r--r-- 1 root  root 536870912 4月  24 08:49 ib_logfile2
-rw-r--r-- 1 root  root       340 4月  24 08:49 backup_variables.txt
-rw-r--r-- 1 root  root      3877 4月  24 08:49 server-my.cnf
-rw-r--r-- 1 root  root     12798 4月  24 08:49 server-all.cnf
-rw-r----- 1 mysql root       626 4月  24 09:07 sztech1.err

全是root:root

 

修改权限为mysql:mysql

 

[root@sztech1 mysql]# chown -R mysql:mysql /usr/local/mysql/data

 

确认一下:

 

[root@sztech1 mysql]# ls -ltr data
总用量 1650788
-rw-r--r-- 1 mysql mysql  79691776 4月  24 08:49 ibdata1
-rw-r--r-- 1 mysql mysql       170 4月  24 08:49 mysql-binlog.000019
-rw-r--r-- 1 mysql mysql       343 4月  24 08:49 mysql-binlog.000020
-rw-r--r-- 1 mysql mysql       386 4月  24 08:49 mysql-binlog.000021
-rw-r--r-- 1 mysql mysql       143 4月  24 08:49 mysql-binlog.000022
drwx------ 2 mysql mysql      4096 4月  24 08:49 employees
-rw-r--r-- 1 mysql mysql       120 4月  24 08:49 mysql-binlog.000023
drwx------ 2 mysql mysql      4096 4月  24 08:49 innodb_memcache
drwx------ 2 mysql mysql      4096 4月  24 08:49 mysql
drwx------ 2 mysql mysql      4096 4月  24 08:49 performance_schema
drwx------ 2 mysql mysql      4096 4月  24 08:49 sakila
drwx------ 2 mysql mysql      4096 4月  24 08:49 sys
drwx------ 2 mysql mysql      4096 4月  24 08:49 sztech
drwx------ 2 mysql mysql      4096 4月  24 08:49 test
drwx------ 2 mysql mysql      4096 4月  24 08:49 world
-rw-r--r-- 1 mysql mysql       110 4月  24 08:49 mysql-binlog.index
-rw-r--r-- 1 mysql mysql 536870912 4月  24 08:49 ib_logfile0
-rw-r--r-- 1 mysql mysql 536870912 4月  24 08:49 ib_logfile1
-rw-r--r-- 1 mysql mysql 536870912 4月  24 08:49 ib_logfile2
-rw-r--r-- 1 mysql mysql       340 4月  24 08:49 backup_variables.txt
-rw-r--r-- 1 mysql mysql      3877 4月  24 08:49 server-my.cnf
-rw-r--r-- 1 mysql mysql     12798 4月  24 08:49 server-all.cnf
-rw-r----- 1 mysql mysql       626 4月  24 09:07 sztech1.err
[root@sztech1 mysql]#

已经全部修改。

 

再次启动,已经成功了。

 

[root@sztech1 mysql]# service mysqld start
Starting MySQL.. SUCCESS!

 

 

 

 

回复 支持 反对

使用道具 举报

5#
 楼主| 发表于 2015-4-24 11:03:25 | 只看该作者

8.验证成功恢复

 

   1.查看文件

      [root@sztech1 mysql]# ls -ltr
总用量 1096
-rw-r--r--  1 mysql mysql   2496 1月  19 21:48 README
-rw-r--r--  1 mysql mysql  17987 1月  19 21:48 COPYING
-rw-r--r--  1 mysql mysql 102315 1月  19 21:48 INSTALL-BINARY
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:46 docs
drwxr-xr-x  3 mysql mysql   4096 4月   5 09:46 include
drwxr-xr-x  4 mysql mysql   4096 4月   5 09:46 man
drwxr-xr-x  3 mysql mysql   4096 4月   5 09:46 lib
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:47 scripts
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:47 bin
drwxr-xr-x 10 mysql mysql   4096 4月   5 09:47 mysql-test
drwxr-xr-x 28 mysql mysql   4096 4月   5 09:47 share
drwxr-xr-x  2 mysql mysql   4096 4月   5 09:47 support-files
drwxr-xr-x  4 mysql mysql   4096 4月   5 09:47 sql-bench
-rw-r--r--  1 mysql mysql    943 4月   5 10:02 my.cnf
-rw-r--r--  1 root  root     943 4月   5 22:44 my-new.cnf
-rw-r--r--  1 root  root      12 4月   6 16:24 off
drwxr-xr-x 11 mysql mysql   4096 4月  24 08:15 data_bak
-rw-rw----  1 mysql mysql  84694 4月  24 08:15 mysqld-slow_query.logbak
-rw-rw----  1 mysql mysql 825158 4月  24 08:16 mysqld-general.logbak
drwxr-xr-x 11 mysql mysql   4096 4月  24 09:14 data
srwxrwxrwx  1 mysql mysql      0 4月  24 09:14 mysql.sock
-rw-rw----  1 mysql mysql      5 4月  24 09:14 mysqld.pid
-rw-rw----  1 mysql mysql    390 4月  24 09:16 mysqld-slow_query.log
-rw-rw----  1 mysql mysql    849 4月  24 09:22 mysqld-general.log

 

我们看到,慢查询日志,一般查询日志,pid都有了,

 

[root@sztech1 data]# ls -ltr
总用量 1650796
-rw-r--r-- 1 mysql mysql       170 4月  24 08:49 mysql-binlog.000019
-rw-r--r-- 1 mysql mysql       343 4月  24 08:49 mysql-binlog.000020
-rw-r--r-- 1 mysql mysql       386 4月  24 08:49 mysql-binlog.000021
-rw-r--r-- 1 mysql mysql       143 4月  24 08:49 mysql-binlog.000022
drwx------ 2 mysql mysql      4096 4月  24 08:49 employees
drwx------ 2 mysql mysql      4096 4月  24 08:49 innodb_memcache
drwx------ 2 mysql mysql      4096 4月  24 08:49 mysql
drwx------ 2 mysql mysql      4096 4月  24 08:49 performance_schema
drwx------ 2 mysql mysql      4096 4月  24 08:49 sakila
drwx------ 2 mysql mysql      4096 4月  24 08:49 sys
drwx------ 2 mysql mysql      4096 4月  24 08:49 sztech
drwx------ 2 mysql mysql      4096 4月  24 08:49 test
drwx------ 2 mysql mysql      4096 4月  24 08:49 world
-rw-r--r-- 1 mysql mysql 536870912 4月  24 08:49 ib_logfile1
-rw-r--r-- 1 mysql mysql 536870912 4月  24 08:49 ib_logfile2
-rw-r--r-- 1 mysql mysql       340 4月  24 08:49 backup_variables.txt
-rw-r--r-- 1 mysql mysql      3877 4月  24 08:49 server-my.cnf
-rw-r--r-- 1 mysql mysql     12798 4月  24 08:49 server-all.cnf
-rw-r--r-- 1 mysql mysql       120 4月  24 09:14 mysql-binlog.000023
-rw-rw---- 1 mysql mysql       120 4月  24 09:14 mysql-binlog.000024
-rw-rw---- 1 mysql mysql       132 4月  24 09:14 mysql-binlog.index
-rw-rw---- 1 mysql mysql        56 4月  24 09:14 auto.cnf
-rw-r----- 1 mysql mysql      3962 4月  24 09:14 sztech1.err
-rw-r--r-- 1 mysql mysql  79691776 4月  24 09:14 ibdata1
-rw-r--r-- 1 mysql mysql 536870912 4月  24 09:14 ib_logfile0

 

三个联机日志文件也有了。

 

2.进入数据库

[root@sztech1 data]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.23-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

看来可以进入

 

3.查看数据库是否都存在

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| employees          |
| innodb_memcache    |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
| sztech             |
| test               |
| world              |
+--------------------+
10 rows in set (0.02 sec)

 

 

4.进入sztech数据库,看表内容是否正确

 

mysql> use sztech
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+------------------+
| Tables_in_sztech |
+------------------+
| dept             |
| emp              |
| emp_bak          |
| emp_bak1         |
| job              |
| location         |
+------------------+
6 rows in set (0.00 sec)

mysql> select * from emp;
+-------+-----------+--------+------------+
| empid | last_name | salary | hire_date  |
+-------+-----------+--------+------------+
|   100 | smitty    |   5000 | 2015-04-05 |
|   200 | NULL      |   NULL | NULL       |
|   300 | NULL      |   NULL | NULL       |
|   400 | 测试      |   NULL | NULL       |
+-------+-----------+--------+------------+
4 rows in set (0.00 sec)

 

没有问题。

到此,使用 mysqlbackup恢复数据完成。

 

回复 支持 反对

使用道具 举报

6#
 楼主| 发表于 2015-4-24 11:06:22 | 只看该作者

我们看到使用 mysql enterprise backup进行备份恢复,恢复时,我们只需要提供备份文件的位置,mysqlbackup会自动把数据文件恢复到默认的位置上去,不再需要手工进行其他操作。

不错,赞一个,注意,使用 mysqlbackup可以备份所有存储引擎的数据库 。

 

 

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-27 07:05 , Processed in 0.135927 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表