Você está na página 1de 16

## WHILE DB IS ONLINE, TAKING MYSQL ENTERPRISE FULL BACKUP OF A MYSQL INSTANCE WORKING FINE ##

[mysql@mysqldbs1 ~]$ mysqlbackup --port=8229 --protocol=tcp --user=root --passwo


rd=password --backup-dir=/mysqlbackup --with-timestamp backup
MySQL Enterprise Backup version 3.10.1 Linux-2.6.39-200.24.1.el6uek.x86_64-x86_6
4 [2014/04/11]
Copyright (c) 2003, 2014, Oracle and/or its affiliates. All Rights Reserved.
mysqlbackup: INFO: Starting with following command line ...
mysqlbackup --port=8229 --protocol=tcp --user=root --password=xxxxxxxx
--backup-dir=/mysqlbackup --with-timestamp backup
mysqlbackup: INFO:
mysqlbackup: INFO: MySQL server version is '5.6.21-log'.
mysqlbackup: INFO: Got some server configuration information from running serve
r.
IMPORTANT: Please check that mysqlbackup run completes successfully.
At the end of a successful 'backup' run mysqlbackup
prints "mysqlbackup completed OK!".
140720 09:52:10 mysqlbackup: INFO: MEB logfile created at /mysqlbackup/2014-07-2
0_09-52-10/meta/MEB_2014-07-20.09-52-10_backup.log
-------------------------------------------------------------------Server Repository Options:
-------------------------------------------------------------------datadir = /mysqldata/mysql/
innodb_data_home_dir =
innodb_data_file_path = ibdata1:12M:autoextend
innodb_log_group_home_dir = /mysqldata/mysql/
innodb_log_files_in_group = 2
innodb_log_file_size = 50331648
innodb_page_size = 16384
innodb_checksum_algorithm = innodb
innodb_undo_directory = /mysqldata/mysql/
innodb_undo_tablespaces = 0
innodb_undo_logs = 128
-------------------------------------------------------------------Backup Config Options:
-------------------------------------------------------------------datadir = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_data_home_dir = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_data_file_path = ibdata1:12M:autoextend
innodb_log_group_home_dir = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_log_files_in_group = 2
innodb_log_file_size = 50331648
innodb_page_size = 16384
innodb_checksum_algorithm = innodb
innodb_undo_directory = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_undo_tablespaces = 0
innodb_undo_logs = 128
mysqlbackup: INFO: Unique generated backup id for this is 14058301301944695

mysqlbackup: INFO: Creating 14 buffers each of size 16777216.


140720 09:52:12 mysqlbackup: INFO: Full Backup operation starts with following t
hreads
1 read-threads
6 process-threads
1 write-threads
140720 09:52:12 mysqlbackup: INFO: System tablespace file format is Antelope.
140720 09:52:12 mysqlbackup: INFO: Starting to copy all innodb files...
140720 09:52:12 mysqlbackup: INFO: Copying /mysqldata/mysql/ibdata1 (Antelope fi
le format).
140720 09:52:12 mysqlbackup: INFO: Found checkpoint at lsn 1721376.
140720 09:52:12 mysqlbackup: INFO: Starting log scan from lsn 1721344.
140720 09:52:12 mysqlbackup: INFO: Copying log...
140720 09:52:12 mysqlbackup: INFO: Log copied, lsn 1721376.
140720 09:52:12 mysqlbackup: INFO: Copying /mysqldata/mysql/test/sample123.ibd (
Antelope file format).
140720 09:52:12 mysqlbackup: INFO: Completing the copy of innodb files.
140720 09:52:14 mysqlbackup: INFO: Preparing to lock tables: Connected to mysqld
server.
140720 09:52:14 mysqlbackup: INFO: Starting to lock all the tables...
140720 09:52:14 mysqlbackup: INFO: All tables are locked and flushed to disk
140720 09:52:14 mysqlbackup: INFO: Opening backup source directory '/mysqldata/m
ysql/'
140720 09:52:14 mysqlbackup: INFO: Starting to backup all non-innodb files in
subdirectories of '/mysqldata/mysql/'
140720 09:52:14 mysqlbackup: INFO: Copying the database directory 'mysql'
140720 09:52:15 mysqlbackup: INFO: Copying the database directory 'performance_s
chema'
140720 09:52:15 mysqlbackup: INFO: Copying the database directory 'test'
140720 09:52:15 mysqlbackup: INFO: Completing the copy of all non-innodb files.
140720 09:52:15 mysqlbackup: INFO: A copied database page was modified at 172137
6.
(This is the highest lsn found on page)
Scanned log up to lsn 1721376.
Was able to parse the log up to lsn 1721376.
Maximum page number for a log record 0
140720 09:52:15 mysqlbackup: INFO: All tables unlocked
140720 09:52:15 mysqlbackup: INFO: All MySQL tables were locked for 1.106 second
s.
140720 09:52:15 mysqlbackup: INFO: Reading all global variables from the server.
140720 09:52:15 mysqlbackup: INFO: Completed reading of all global variables fro
m the server.
140720 09:52:15 mysqlbackup: INFO: Creating server config files server-my.cnf an
d server-all.cnf in /mysqlbackup/2014-07-20_09-52-10
140720 09:52:16 mysqlbackup: INFO: Full Backup operation completed successfully.
140720 09:52:16 mysqlbackup: INFO: Backup created in directory '/mysqlbackup/201
4-07-20_09-52-10'
140720 09:52:16 mysqlbackup: INFO: MySQL binlog position: filename mysql-bin.000
092, position 120
------------------------------------------------------------Parameters Summary
------------------------------------------------------------Start LSN
: 1721344
End LSN
: 1721376
------------------------------------------------------------mysqlbackup completed OK!
[mysql@mysqldbs1 ~]$
## MAKING CHANGES LIKE CREATE / DROP DATABASES, CREATE TABLES AND INSERT AND DEL

ETE ROWS IN THE DIFFERENT DATABASES - WORKING FINE ##


## CHANGES ARE CAPTURED IN TO 4 DIFFERENT BINARY LOGS / REDO LOG FILES (mysql-b
in.000092 - mysql-bin.000095) - WORKING FINE ##
[mysql@mysqldbs1 ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show binary logs;
+------------------+-----------+
| Log_name
| File_size |
+------------------+-----------+
| mysql-bin.000064 |
143 |
| mysql-bin.000065 |
143 |
| mysql-bin.000066 |
143 |
| mysql-bin.000067 |
167 |
| mysql-bin.000068 |
167 |
| mysql-bin.000069 |
167 |
| mysql-bin.000070 |
278 |
| mysql-bin.000071 |
1257 |
| mysql-bin.000072 |
362 |
| mysql-bin.000073 |
143 |
| mysql-bin.000074 |
1563 |
| mysql-bin.000075 |
1563 |
| mysql-bin.000076 |
1563 |
| mysql-bin.000077 |
143 |
| mysql-bin.000078 |
1563 |
| mysql-bin.000079 |
143 |
| mysql-bin.000080 |
167 |
| mysql-bin.000081 |
364 |
| mysql-bin.000082 |
356 |
| mysql-bin.000083 |
278 |
| mysql-bin.000084 |
1463 |
| mysql-bin.000085 |
603 |
| mysql-bin.000086 |
143 |
| mysql-bin.000087 |
1587 |
| mysql-bin.000088 |
364 |
| mysql-bin.000089 |
167 |
| mysql-bin.000090 |
143 |
| mysql-bin.000091 |
516 |
| mysql-bin.000092 |
120 |
+------------------+-----------+
29 rows in set (0.01 sec)
mysql> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|

| performance_schema |
| test
|
+--------------------+
4 rows in set (0.00 sec)
mysql> create database sample;
Query OK, 1 row affected (0.01 sec)
mysql> use test
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_test |
+----------------+
| anjan_test
|
| latest12
|
| mahesh
|
| sample123
|
| srini_test
|
+----------------+
5 rows in set (0.00 sec)
mysql> create table dept (deptno integer(4));
Query OK, 0 rows affected (0.03 sec)
mysql> flush logs;
Query OK, 0 rows affected (0.02 sec)
mysql> use test;
Database changed
mysql> insert into table dept values (10);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'table
dept values (10)' at line 1
mysql> insert into dept values (10);
Query OK, 1 row affected (0.01 sec)
mysql> insert into dept values (20);
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept values (30);
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> create database scott;
Query OK, 1 row affected (0.00 sec)
mysql> select * from srini_test;
+------+
| a
|
+------+
| 100 |
| 200 |
| 300 |
| 400 |

| 500 |
| 600 |
| 700 |
| 800 |
| 900 |
| 999 |
| 1000 |
| 1100 |
+------+
12 rows in set (0.00 sec)
mysql> delete from srini_test where a > 999;
Query OK, 2 rows affected (0.01 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> flush logs;
Query OK, 0 rows affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| sample
|
| scott
|
| test
|
+--------------------+
6 rows in set (0.00 sec)
mysql> use sample;
Database changed
mysql> create table emp (a integer(4));
Query OK, 0 rows affected (0.01 sec)
mysql> insert into emp values (101);
Query OK, 1 row affected (0.01 sec)
mysql> insert into emp values (102);
Query OK, 1 row affected (0.00 sec)
mysql> insert into emp values (103);
Query OK, 1 row affected (0.00 sec)
mysql> insert into emp values (104);
Query OK, 1 row affected (0.01 sec)
mysql> insert into emp values (105);
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> create database sysdba;
Query OK, 1 row affected (0.00 sec)
mysql> flush logs;

Query OK, 0 rows affected (0.01 sec)


mysql> delete from emp where a > 30;
Query OK, 5 rows affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into emp values (1001);
Query OK, 1 row affected (0.00 sec)
mysql> insert into emp values (1002);
Query OK, 1 row affected (0.00 sec)
mysql> insert into emp values (1003);
Query OK, 1 row affected (0.00 sec)
mysql> insert into emp values (1004);
Query OK, 1 row affected (0.00 sec)
mysql> insert into emp values (1005);
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> drop database sysdba;
Query OK, 0 rows affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| sample
|
| scott
|
| test
|
+--------------------+
6 rows in set (0.00 sec)
mysql> flush logs;
Query OK, 0 rows affected (0.01 sec)
mysql>
## PERFORMING RAW BACKUP / ARCHIVING OF BINARY LOGS / REDO LOGS TO ARCHIVE LOG L
OCATION - WORKING FINE ##
[mysql@mysqldbs1 binary_logs_backup]$ mysqlbinlog --raw --read-from-remote-serve
r --stop-never --host mysqldbs1 --port 8229 -u root -p mysql-bin.000092 --result
-file=/mysqlbackup/binary_logs_backup/arch_ server-id 1
Enter password:
ERROR: Failed on connect: Can't connect to MySQL server on 'mysqldbs1' (111)
[mysql@mysqldbs1 binary_logs_backup]$
[root@mysqldbs1 ~]# cd /mysqlbackup/binary_logs_backup/

[root@mysqldbs1 binary_logs_backup]# ls -arlth


total 28K
drwxr-xr-x. 4 mysql mysql 4.0K Jul 20 09:52 ..
-rw-r--r--. 1 mysql mysql 1.5K Jul 20 10:08 arch_mysql-bin.000094
-rw-r--r--. 1 mysql mysql 1.1K Jul 20 10:08 arch_mysql-bin.000093
-rw-r--r--. 1 mysql mysql 378 Jul 20 10:08 arch_mysql-bin.000092
-rw-r--r--. 1 mysql mysql
4 Jul 20 10:08 arch_mysql-bin.000096
-rw-r--r--. 1 mysql mysql 1.6K Jul 20 10:08 arch_mysql-bin.000095
drwxr-xr-x. 2 mysql mysql 4.0K Jul 20 10:08 .
[root@mysqldbs1 binary_logs_backup]#
## SHUTDOWN MYSQL INSTANCE AND RESTORE THE BASE ONINE BACKUP TAKEN USING MYSQLBA
CKUP utilitiy - WORKING FINE ##
[root@mysqldbs1 mysql]# ps -ef | grep mysql
root
19490 3630 0 09:51 pts/1
00:00:00 su - mysql
mysql
19491 19490 0 09:51 pts/1
00:00:00 -bash
root
20861 20532 0 10:13 pts/0
00:00:00 grep mysql
[root@mysqldbs1 mysql]# su - mysql
[mysql@mysqldbs1 ~]$ mysqlbackup --defaults-file=/mysqlbackup/2014-07-20_09-5210/backup-my.cnf --datadir=/mysqldata/mysql --backup-dir=/mysqlbackup/2014-07-20
_09-52-10 copy-back-and-apply-log
MySQL Enterprise Backup version 3.10.1 Linux-2.6.39-200.24.1.el6uek.x86_64-x86_6
4 [2014/04/11]
Copyright (c) 2003, 2014, Oracle and/or its affiliates. All Rights Reserved.
mysqlbackup: INFO: Starting with following command line ...
mysqlbackup
--defaults-file=/mysqlbackup/2014-07-20_09-52-10/backup-my.cnf
--datadir=/mysqldata/mysql
--backup-dir=/mysqlbackup/2014-07-20_09-52-10 copy-back-and-apply-log
mysqlbackup: INFO:
IMPORTANT: Please check that mysqlbackup run completes successfully.
At the end of a successful 'copy-back-and-apply-log' run mysqlbackup
prints "mysqlbackup completed OK!".
140720 10:13:13 mysqlbackup: INFO: MEB logfile created at /mysqlbackup/2014-07-2
0_09-52-10/meta/MEB_2014-07-20.10-13-13_copy_back_dir_to_datadir.log
-------------------------------------------------------------------Server Repository Options:
-------------------------------------------------------------------datadir = /mysqldata/mysql
innodb_data_home_dir = /mysqldata/mysql
innodb_data_file_path = ibdata1:12M:autoextend
innodb_log_group_home_dir = /mysqldata/mysql
innodb_log_files_in_group = 2
innodb_log_file_size = 50331648
innodb_page_size = 16384
innodb_checksum_algorithm = innodb
-------------------------------------------------------------------Backup Config Options:
-------------------------------------------------------------------datadir = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_data_home_dir = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_data_file_path = ibdata1:12M:autoextend
innodb_log_group_home_dir = /mysqlbackup/2014-07-20_09-52-10/datadir
innodb_log_files_in_group = 2

innodb_log_file_size = 50331648
innodb_page_size = 16384
innodb_checksum_algorithm = innodb
mysqlbackup: INFO: Creating 14 buffers each of size 16777216.
140720 10:13:13 mysqlbackup: INFO: Copy-back-and-apply-log operation starts with
following threads
1 read-threads
1 write-threads
140720 10:13:13 mysqlbackup: INFO: Copying /mysqlbackup/2014-07-20_09-52-10/data
dir/ibdata1.
140720 10:13:13 mysqlbackup: INFO: Copying /mysqlbackup/2014-07-20_09-52-10/data
dir/test/sample123.ibd.
140720 10:13:13 mysqlbackup: INFO: Copying the database directory 'mysql'
140720 10:13:14 mysqlbackup: INFO: Copying the database directory 'performance_s
chema'
140720 10:13:14 mysqlbackup: INFO: Copying the database directory 'test'
140720 10:13:14 mysqlbackup: INFO: Completing the copy of all non-innodb files.
140720 10:13:15 mysqlbackup: INFO: Creating server config files server-my.cnf an
d server-all.cnf in /mysqldata/mysql
140720 10:13:15 mysqlbackup: INFO: Copy-back operation completed successfully.
mysqlbackup: INFO: Creating 14 buffers each of size 65536.
140720 10:13:15 mysqlbackup: INFO: Apply-log operation starts with following thr
eads
1 read-threads
1 process-threads
mysqlbackup: INFO: Using up to 100 MB of memory.
140720 10:13:15 mysqlbackup: INFO: ibbackup_logfile's creation parameters:
start lsn 1721344, end lsn 1721376,
start checkpoint 1721376.
InnoDB: Doing recovery: scanned up to log sequence number 1721376
mysqlbackup: INFO: InnoDB: Starting an apply batch of log records to the databa
se...
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2
0 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
mysqlbackup: INFO: InnoDB: Setting log file size to 50331648
mysqlbackup: INFO: InnoDB: Setting log file size to 50331648
140720 10:13:16 mysqlbackup: INFO: We were able to parse ibbackup_logfile up to
lsn 1721376.
mysqlbackup: INFO: Last MySQL binlog file position 0 120, file name mysql-bin.0
00092:120
140720 10:13:16 mysqlbackup: INFO: The first data file is '/mysqldata/mysql/ibda
ta1'
and the new created log files are at '/mysqldata/mysql'
140720 10:13:16 mysqlbackup: INFO: Apply-log operation completed successfully.
140720 10:13:16 mysqlbackup: INFO: Full Backup has been restored successfully.
mysqlbackup completed OK!
[mysql@mysqldbs1 ~]$
## AFTER BASE BACKUP RESTORE, STARTUP THE MYSQL INSTANCE AND VERIFY THE DATABASE
- WORKING FINE ##
[root@mysqldbs1 mysql]# ps -ef | grep mysql
root
19490 3630 0 09:51 pts/1
00:00:00 su - mysql
mysql
19491 19490 0 09:51 pts/1
00:00:00 -bash

root
20904
1 0 10:14 pts/0
00:00:00 /bin/sh /usr/bin/mysqld_safe --d
atadir=/mysqldata/mysql --pid-file=/mysql/lib/mysql/mysqld.pid
mysql
21164 20904 8 10:14 pts/0
00:00:00 /usr/sbin/mysqld --basedir=/usr
--datadir=/mysqldata/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --l
og-error=/mysql/log/mysqld.log --pid-file=/mysql/lib/mysql/mysqld.pid --port=822
9
root
21200 20532 0 10:14 pts/0
00:00:00 grep mysql
[root@mysqldbs1 mysql]# su - mysql
[mysql@mysqldbs1 ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| test
|
+--------------------+
4 rows in set (0.02 sec)
mysql>
## AS DISCUSSED, THE CHANGES MADE TO THE DATABASE ARE RECORDED 4 BINARY LOGS, AN
D THEY WERE ARCHIVED TO /mysqlbackup/binary_logs_backup/ ##
## NOW WE WILL DUMP EACH BINARY LOG TO TEXT FILE TO SEE WHAT CHANGES WERE RECORD
ED IN IT, AND APPLY EACH LOG TO VERIFY WHETHER CHANGES ARE APPLIED THRU
THE BINARY LOG ##
## APPLYING LOG SEQUENCE NUMBER 92 AND VERIFY THE DB FOR THE APPLIED CHANGES - W
ORKED FINE !! ##
[mysql@mysqldbs1 binary_logs_backup]$ cat 92.sql | grep -v '#' | grep -v "SET"
DELIMITER /*!*/;
ROLLBACK/*!*/;
BINLOG '
vUPLUw8BAAAAdAAAAHgAAAAAAAQANS42LjIxLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAC9Q8tTEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAUIY
5tU=
'/*!*/;
/*!\C utf8 *//*!*/;
create database sample
/*!*/;
use `test`/*!*/;
create table dept (deptno integer(4))

/*!*/;
DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
[mysql@mysqldbs1 binary_logs_backup]$ mysqlbinlog /mysqlbackup/binary_logs_back
up/arch_mysql-bin.000092 | mysql -u root -p
Enter password:
[mysql@mysqldbs1 binary_logs_backup]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| sample
|
| test
|
+--------------------+
5 rows in set (0.00 sec)
mysql> use test;
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_test |
+----------------+
| anjan_test
|
| dept
|
| latest12
|
| mahesh
|
| sample123
|
| srini_test
|
+----------------+
6 rows in set (0.00 sec)
mysql>

## APPLYING LOG SEQUENCE NUMBER 93 AND VERIFY THE DB FOR THE APPLIED CHANGES - W
ORKED FINE !! ##
[mysql@mysqldbs1 binary_logs_backup]$ cat 93.sql | grep -v '#' | grep -v "SET"
DELIMITER /*!*/;

BINLOG '
aETLUw8BAAAAdAAAAHgAAAAAAAQANS42LjIxLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAbFJ
SZY=
'/*!*/;
/*!\C utf8 *//*!*/;
BEGIN
/*!*/;
use `test`/*!*/;
insert into dept values (10)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into dept values (20)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into dept values (30)
/*!*/;
COMMIT/*!*/;
create database scott
/*!*/;
BEGIN
/*!*/;
use `test`/*!*/;
delete from srini_test where a > 999
/*!*/;
COMMIT/*!*/;
DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
[mysql@mysqldbs1 binary_logs_backup]$ mysqlbinlog /mysqlbackup/binary_logs_bac
kup/arch_mysql-bin.000093 | mysql -u root -p
Enter password:
[mysql@mysqldbs1 binary_logs_backup]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| sample
|
| scott
|
| test
|
+--------------------+

6 rows in set (0.00 sec)


mysql> use test;
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> select * from dept;
+--------+
| deptno |
+--------+
|
10 |
|
20 |
|
30 |
+--------+
3 rows in set (0.00 sec)
mysql> select * from srini_test;
+------+
| a
|
+------+
| 100 |
| 200 |
| 300 |
| 400 |
| 500 |
| 600 |
| 700 |
| 800 |
| 900 |
| 999 |
+------+
10 rows in set (0.00 sec)
mysql> quit
Bye
[mysql@mysqldbs1 binary_logs_backup]$

## APPLYING LOG SEQUENCE NUMBER 94 AND VERIFY THE DB FOR THE APPLIED CHANGES - W
ORKED FINE !! ##
[mysql@mysqldbs1 binary_logs_backup]$ cat 94.sql | grep -v '#' | grep -v "SET
"
DELIMITER /*!*/;
BINLOG '
y0TLUw8BAAAAdAAAAHgAAAAAAAQANS42LjIxLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAQJp
rQY=
'/*!*/;
use `sample`/*!*/;
/*!\C utf8 *//*!*/;
create table emp (a integer(4))
/*!*/;
BEGIN
/*!*/;
insert into emp values (101)
/*!*/;
COMMIT/*!*/;

BEGIN
/*!*/;
insert into emp values (102)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (103)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (104)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (105)
/*!*/;
COMMIT/*!*/;
create database sysdba
/*!*/;
DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
[mysql@mysqldbs1 binary_logs_backup]$ mysqlbinlog /mysqlbackup/binary_logs_backu
p/arch_mysql-bin.000094 | mysql -u root -p
Enter password:
[mysql@mysqldbs1 binary_logs_backup]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| sample
|
| scott
|
| sysdba
|
| test
|
+--------------------+
7 rows in set (0.00 sec)
mysql> use sample;
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_sample |
+------------------+
| emp
|
+------------------+
1 row in set (0.00 sec)
mysql> select * from emp;
+------+
| a
|
+------+
| 101 |
| 102 |
| 103 |
| 104 |
| 105 |
+------+
5 rows in set (0.00 sec)
mysql> quit
Bye
[mysql@mysqldbs1 binary_logs_backup]$
## APPLYING LOG SEQUENCE NUMBER 95 AND VERIFY THE DB FOR THE APPLIED CHANGES - W
ORKED FINE !! ##
[mysql@mysqldbs1 binary_logs_backup]$ cat 95.sql | grep -v '#' | grep -v "SE
T"
DELIMITER /*!*/;
BINLOG '
HkXLUw8BAAAAdAAAAHgAAAAAAAQANS42LjIxLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAUEZ
Ikw=
'/*!*/;
/*!\C utf8 *//*!*/;
BEGIN
/*!*/;
use `sample`/*!*/;
delete from emp where a > 30
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (1001)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (1002)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (1003)
/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;

insert into emp values (1004)


/*!*/;
COMMIT/*!*/;
BEGIN
/*!*/;
insert into emp values (1005)
/*!*/;
COMMIT/*!*/;
drop database sysdba
/*!*/;
DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
[mysql@mysqldbs1 binary_logs_backup]$ mysqlbinlog /mysqlbackup/binary_logs_backu
p/arch_mysql-bin.000095 | mysql -u root -p
Enter password:
[mysql@mysqldbs1 binary_logs_backup]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| mysql
|
| performance_schema |
| sample
|
| scott
|
| test
|
+--------------------+
6 rows in set (0.00 sec)
mysql> use sample;
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_sample |
+------------------+
| emp
|
+------------------+
1 row in set (0.00 sec)
mysql> select * from emp;
+------+
| a
|
+------+
| 1001 |

| 1002 |
| 1003 |
| 1004 |
| 1005 |
+------+
5 rows in set (0.00 sec)
mysql> quit
Bye
[mysql@mysqldbs1 binary_logs_backup]$

Você também pode gostar