Ali cloud RDS (MySQL) database recovery

State clearly: This is just a log, it is not too strict, after all, I am a production environment after the data download (part table) to return to the development environment for the historical data query.

Download hins8247923_data_20191118055735_qp.xb from Ali cloud that * _qp.xb database, handled as follows:
First, install the open source Percona XtraBackup backup and recovery tool:
the operating system installed data recovery tool Percona XtraBackup, Percona XtraBackup can download and install from the official website.
5.6 and previous versions of MySQL need to install Percona XtraBackup 2.3, installation instructions, see https://www.percona.com/doc/percona-xtrabackup/2.3/installation.html?spm=a2c4g.11186623.2.13.3f4d30eb5k7pdZ
MySQL 5.7 version requires installation Percona XtraBackup 2.4, installation instructions, see https://www.percona.com/doc/percona-xtrabackup/2.4/installation.html?spm=a2c4g.11186623.2.14.3f4d30eb5k7pdZ
MySQL version 8.0 will need to install Percona XtraBackup 8.0, installation guide see https://www.percona.com/doc/percona-xtrabackup/8.0/installation.html?spm=a2c4g.11186623.2.15.3f4d30eb5k7pdZ
because I was CentOS7.6 machine, MySQL version 5.7, so:
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
List yum | grep Percona
yum install Percona-xtrabackup-24-
addition, innobackupex unzip command to install qpress, you can use the command yum install qpress -y install.
Second, unzip the file
for xbstream package (_qp.xb suffix), use the command:

Unpack

cat <data backup file name> _qp.xb | xbstream -x -v -C / home / mysql / data

Decompression

innobackupex --decompress --remove-original / home / mysql / data
Third, the physical file copy restore
1. Direct physical copy files to the corresponding MySQL Windows machine, yes, this is my development machine, because the Web and DB put Windows on the same machine, the production is separate
2. copy to the appropriate location and changed its name to the database name you want, the old database folder to change other names
3. mysql query into the corresponding table, error:
mysql> use xxxbakDB
MySQL> SELECT * from UserStudent;
ERROR 1812 (HY000): the Tablespace IS Missing for Table saplatformdb. userstudent.
enter the following command:
MySQL> ALTER Table UserStudent Import TABLESPACE;
if there is:
ERROR 1808 (HY000): the Schema mismatch the (the Table has ROW_TYPE_DYNAMIC Row the format, .ibd
File has the format ROW_TYPE_COMPACT row.)
Description of the form definition table space row format does not match, it is necessary to continue the subsequent operations.
4. The first data file deletion UserStudent.idb
MySQL> the Table Studentfollowlog discard the ALTER TABLESPACE;
5. display table to build a query statement:
mysql> show create table UserStudent;
will be similar to the following block of statements, copy it:

CREATE TABLE UserStudent (
Id int(11) NOT NULL AUTO_INCREMENT COMMENT '自增Id',
.......
KEY idx_et (EndDate) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=29172 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='【用户任务表】' ;

Copy the above statement and matches change ROW_FORMAT = ROW_FORMAT = DYNAMIC or ROW_FORMAT = COMPACT.

There is a small episode between:
a display built table statement or doing other queries, MySQL service directly Down, kept closed, add the following section in the my.ini:
[mysqld]
innodb_force_recovery = 4
End modify the query and then restart show create table UserStudent;
Note: If you built the table behind when newspaper ERROR 1874 (HY000): InnoDB is in read only mode
remember my.ini commented in
[mysqld]
#innodb_force_recovery = 4
then restart the MySQL service

5. Remove the table and then rebuilding the table:
MySQL> Table drop UserStudent;
MySQL> the CREATE TABLE UserStudent(
..... (omitted above is that section)
if there is: ERROR 1808 (HY000): Schema mismatch (Table has ROW_TYPE_DYNAMIC row . format, has ROW_TYPE_COMPACT row .ibd File format)
the CREATE TABLE when you want to specify the last line: COMPACT ROW_FORMAT =
6. At this time, see if you do not have to query the data:
MySQL> the SELECT from UserStudent limit 0,10;
if there is: mysql> select
; from 0,10 UserStudent limit
ERROR 1812 (HY000): Table for the Tablespace Missing iS ' xxxxdb. UserStudent'.
: Perform the following operations
; mysql> alter table UserStudent discard tablespace
then the backup copy of the file to which the present UserStudent.ibd database location input:
MySQL> table UserStudent Import ALTER TABLESPACE;
re-confirmation query, the query can be normally general case the table:
mysql>select * from UserStudent limit 0,10;

Guess you like

Origin blog.51cto.com/soulful/2451942