首页 > 其他分享 >ontape的备份与恢复

ontape的备份与恢复

时间:2023-08-29 21:32:31浏览次数:39  
标签:10 00 rw 恢复 备份 gbasedbt ontape employee devsvr

ontape的备份与恢复

ontape简介

使用ontape,可以进行GBase 8s数据库的备份与恢复。

  • ontape支持L0,L1,L2三级备份与恢复。
  • ontape支持逻辑日志的备份与恢复。
  • ontape本身不支持基于时间点的恢复,但可通过其它工具,将ontape备份的单个表中数据,恢复到指定的时间点(暂不讨论)。基于时间点的数据库备份与恢复,建议使用onbar实现。

备份命令:

命令

说明

ontape -s -L 0

进行L0级备份

ontape -s -L 1

进行L1级备份

ontape -s -L 2

进行L2级备份

ontape -a

进行自动逻辑日志备份

ontape -c

启动连续逻辑日志备份

ontape -S

抢救逻辑日志

恢复命令:

命令

说明

ontape -r

完成恢复

ontape -p

进行物理恢复

ontape -l

进行逻辑恢复

ontape -C

连续逻辑日志恢复

ontape -X

停止连续逻辑日志恢复

业务场景模拟规划

模拟数据库在遇到数据库空间文件被删除时和表被删除时,如何尽可能的抢救数据。

时间

业务

说明

t1

系统上线

创建t_dept和t_employee

t2

t_dept新增3条数据

t3

t_employee新增5条数据

t4

系统进行L0备份

用于验证L0物理恢复

t5

t_employee新增5条数据

t6

系统进行L1备份

t7

t_employee新增1条数据

t8

系统进行L1备份

用于观察多次备份对文件名的影响

t9

t_employee新增5条数据

t10

系统进行L2备份

用于验证L2物理恢复

t11

t_dept新增1条数据

t12

t_employee更新1条数据

t13

切换逻辑日志

模拟因业务变化导致日志切换

t14

t_employee删除1条数据

t15

删除Chunk文件

模拟灾难

t16

t_dept新增1条数据

t17

备份逻辑日志

t18

进行完全恢复

t19

t_employee新增5条数据

t20

删除t_employee表

模拟灾难

t21

尝试L0级物理恢复

t22

尝试L1级物理恢复

t23

尝试L2级物理恢复

t24

尝试L2级物理恢复+部分逻辑恢复

备份/恢复操作演示

ontape环境参数设置

使用ontape进行数据库的备份与恢复时,需要设置ontape默认使用的存储设备。

可通过修改参数文件,或使用 onmode -wf 命令,设置GBase 8s的参数。可通过 onstat -c 命令,查看GBase 8s的参数设置。

检查 GBase 8s 备份的存储设备参数,发现未指定备份存储设备。

[gbasedbt@devsvr ~]$ onstat -c | grep TAPEDEV | grep -v '#'
Your evaluation license will expire on 2022-06-18 00:00:00
TAPEDEV         /dev/null       
LTAPEDEV        /dev/null

创建一个目录,并设置物理备份和逻辑备份的存储设备为新创建的目录。

[gbasedbt@devsvr ~]$ mkdir backup
[gbasedbt@devsvr ~]$ onmode -wf "TAPEDEV=/home/gbasedbt/backup"
Your evaluation license will expire on 2022-06-18 00:00:00
Value of TAPEDEV has been changed to /home/gbasedbt/backup.
[gbasedbt@devsvr ~]$ onmode -wf "LTAPEDEV=/home/gbasedbt/backup"
Your evaluation license will expire on 2022-06-18 00:00:00
Value of LTAPEDEV has been changed to /home/gbasedbt/backup.

查看备份设备参数,已经指向新创建的目录。

[gbasedbt@devsvr ~]$ onstat -c | grep TAPEDEV | grep -v '#'
Your evaluation license will expire on 2022-06-18 00:00:00
TAPEDEV         /home/gbasedbt/backup 
LTAPEDEV        /home/gbasedbt/backup

实验步骤

  • 步骤1:创建数据库与表



[gbasedbt@devsvr ~]$ dbaccess - - Your evaluation license will expire on 2022-06-18 00:00:00 create database mydb in datadbs1 with log; create table t_dept(f_deptid int, f_deptname varchar(20)); create table t_employee(f_employeeid int, f_deptid int, f_employeename varchar(20)); Database created. > Table created. > Table created. > info tables; Table name t_dept t_employee >



  • 步骤2:L0备份前的数据准备



> select * from t_dept; f_deptid f_deptname 1 dept_1 2 dept_2 3 dept_3 3 row(s) retrieved. > select * from t_employee; f_employeeid f_deptid f_employeename 1 1 employee_01 2 1 employee_02 3 2 employee_03 4 2 employee_04 5 3 employee_05 5 row(s) retrieved. >



在L0备份前,t_dept表有3条记录,t_employee表有5条记录。在将数据库物理恢复到L0时,可恢复t_dept中的3条记录和t_employee中的5条记录。

  • 步骤3:L0备份
[gbasedbt@devsvr backup]$ ontape -s -L 0
Your evaluation license will expire on 2022-06-18 00:00:00
100 percent done.
File created: /home/gbasedbt/backup/devsvr_120_L0

Please label this tape as number 1 in the arc tape sequence. 
This tape contains the following logical logs:

 33

Program over.
[gbasedbt@devsvr backup]$ ll
total 43584
-rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
[gbasedbt@devsvr backup]$

执行L0备份后,目录中生成一个名称为devsvr_120_L0的备份文件。

备份文件的命名规则:

<hostname>_<serverid>_<L0 | L1 | L2>
  • 步骤4:L1备份前的数据准备



> select * from t_employee; f_employeeid f_deptid f_employeename 1 1 employee_01 2 1 employee_02 3 2 employee_03 4 2 employee_04 5 3 employee_05 11 1 employee_11 12 1 employee_12 13 2 employee_13 14 2 employee_14 15 3 employee_15 10 row(s) retrieved.



  • 步骤5:L1备份
* [gbasedbt@devsvr backup]$ ontape -s -L 1
  Your evaluation license will expire on 2022-06-18 00:00:00
  100 percent done.
  File created: /home/gbasedbt/backup/devsvr_120_L1

  Please label this tape as number 1 in the arc tape sequence. 
  This tape contains the following logical logs:

   33

  Program over.
  [gbasedbt@devsvr backup]$ ll
  total 50176
  -rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
  -rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:14 devsvr_120_L1
  [gbasedbt@devsvr backup]$

步骤6:L1备份前的数据准备(第二次)



> select * from t_employee;


f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         
          11           1 employee_11         
          12           1 employee_12         
          13           2 employee_13         
          14           2 employee_14         
          15           3 employee_15         
          16           3 employee_16         

11 row(s) retrieved.



在第二次L1备份前,t_employee表有11条记录。
可通过L1的物理恢复,得到t_employee表的11条记录。

  • 步骤7:L1备份
[gbasedbt@devsvr backup]$ ontape -s -L 1
Your evaluation license will expire on 2022-06-18 00:00:00
100 percent done.
File created: /home/gbasedbt/backup/devsvr_120_L1

Please label this tape as number 1 in the arc tape sequence. 
This tape contains the following logical logs:

 33

Program over.
[gbasedbt@devsvr backup]$ ll
total 56768
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:14 devsvr_120_20210724_101445_L1
-rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:17 devsvr_120_L1
[gbasedbt@devsvr backup]$

GBase 8s最后一次的备份文件名为

<hostname>_<serviceid>_<L0 | L1 | L2>

。当连续使用同一级别进行备份时,前一次的备份会被自动更名为

<hostname>_<serviceid>-<timestamp>_<L0 | L1 | L2>
  • 步骤8:L2备份前的数据准备



> select * from t_employee; f_employeeid f_deptid f_employeename 1 1 employee_01 2 1 employee_02 3 2 employee_03 4 2 employee_04 5 3 employee_05 11 1 employee_11 12 1 employee_12 13 2 employee_13 14 2 employee_14 15 3 employee_15 16 3 employee_16 21 1 employee_21 22 1 employee_22 23 2 employee_23 24 2 employee_24 25 3 employee_25 16 row(s) retrieved. >



在L2备份前,t_employee表有16条记录。
可通过L2的物理恢复,得到t_employee表的16条记录。

  • 步骤9:L2备份
[gbasedbt@devsvr backup]$ ontape -s -L 2
Your evaluation license will expire on 2022-06-18 00:00:00
100 percent done.
File created: /home/gbasedbt/backup/devsvr_120_L2

Please label this tape as number 1 in the arc tape sequence. 
This tape contains the following logical logs:

 33

Program over.
[gbasedbt@devsvr backup]$ ll
total 63360
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:14 devsvr_120_20210724_101445_L1
-rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:17 devsvr_120_L1
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:20 devsvr_120_L2
[gbasedbt@devsvr backup]$
  • 步骤10:切换逻辑日志前的数据准备



> select * from t_dept; f_deptid f_deptname 1 dept_1 2 dept_2 3 dept_3 4 dept_4 4 row(s) retrieved. > select * from t_employee; f_employeeid f_deptid f_employeename 1 1 employee_01 2 1 employee_02 3 2 employee_03 4 2 employee_04 5 3 employee_05 11 1 employee_updated 12 1 employee_12 13 2 employee_13 14 2 employee_14 15 3 employee_15 16 3 employee_16 21 1 employee_21 22 1 employee_22 23 2 employee_23 24 2 employee_24 25 3 employee_25 16 row(s) retrieved. >



  • 步骤11 切换逻辑日志

切换前,当前的逻辑日志文件是10,唯一编号为33。

[gbasedbt@devsvr ~]$ onstat -l
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 15 days 01:56:16 -- 1135464 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-2  0        1024     6312       454        13.90
      phybegin         physize    phypos     phyused    %used   
      3:53             99400      36167      14         0.01    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-1  0        512      99535      23065      21000      4.3        1.1     
	Subsystem    numrecs    Log Space used
	OLDRSAM      99037      9833936       
	HA           452        19888         
	DDL          46         16008         

address          number   flags    uniqid   begin                size     used    %used
4713df88         4        U-B----  27       2:53                 5000        3     0.06
48445970         5        U-B----  28       2:5053               5000        5     0.10
484459d8         6        U-B----  29       2:10053              5000     5000   100.00
48445a40         7        U-B----  30       2:15053              5000     5000   100.00
48445aa8         8        U-B----  31       2:20053              5000     5000   100.00
48445b10         9        U-B----  32       2:25053              5000     5000   100.00
48445b78         10       U---C-L  33       2:30053              5000     3060    61.20
48445be0         11       F------  0        2:35053              5000        0     0.00
48445c48         12       F------  0        2:40053              5000        0     0.00
48445cb0         13       F------  0        2:45053              5000        0     0.00
48445d18         14       F------  0        2:50053              5000        0     0.00
48445d80         15       F------  0        2:55053              5000        0     0.00
48445de8         16       F------  0        2:60053              5000        0     0.00
48445e50         17       F------  0        2:65053              5000        0     0.00
48445eb8         18       F------  0        2:70053              5000        0     0.00
48445f20         19       F------  0        2:75053              5000        0     0.00
48445f88         20       F------  0        2:80053              5000        0     0.00
46f1cf30         21       U-B----  24       2:85053              5000       30     0.60
46f1cf98         22       U-B----  25       2:90053              5000       13     0.26
46febf30         23       U-B----  26       2:95053              5000        3     0.06
 20 active, 20 total

[gbasedbt@devsvr ~]$

执行逻辑日志切换命令

[gbasedbt@devsvr ~]$ onmode -l
Your evaluation license will expire on 2022-06-18 00:00:00

切换后,当前逻辑日志文件为11,唯一编号为34。

[gbasedbt@devsvr ~]$ onstat -l
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 15 days 01:57:06 -- 1135464 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-2  0        1024     6312       454        13.90
      phybegin         physize    phypos     phyused    %used   
      3:53             99400      36167      14         0.01    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-2  0        512      99535      23065      21000      4.3        1.1     
	Subsystem    numrecs    Log Space used
	OLDRSAM      99037      9833936       
	HA           452        19888         
	DDL          46         16008         

address          number   flags    uniqid   begin                size     used    %used
4713df88         4        U-B----  27       2:53                 5000        3     0.06
48445970         5        U-B----  28       2:5053               5000        5     0.10
484459d8         6        U-B----  29       2:10053              5000     5000   100.00
48445a40         7        U-B----  30       2:15053              5000     5000   100.00
48445aa8         8        U-B----  31       2:20053              5000     5000   100.00
48445b10         9        U-B----  32       2:25053              5000     5000   100.00
48445b78         10       U-----L  33       2:30053              5000     3061    61.22
48445be0         11       U---C--  34       2:35053              5000        0     0.00
48445c48         12       F------  0        2:40053              5000        0     0.00
48445cb0         13       F------  0        2:45053              5000        0     0.00
48445d18         14       F------  0        2:50053              5000        0     0.00
48445d80         15       F------  0        2:55053              5000        0     0.00
48445de8         16       F------  0        2:60053              5000        0     0.00
48445e50         17       F------  0        2:65053              5000        0     0.00
48445eb8         18       F------  0        2:70053              5000        0     0.00
48445f20         19       F------  0        2:75053              5000        0     0.00
48445f88         20       F------  0        2:80053              5000        0     0.00
46f1cf30         21       U-B----  24       2:85053              5000       30     0.60
46f1cf98         22       U-B----  25       2:90053              5000       13     0.26
46febf30         23       U-B----  26       2:95053              5000        3     0.06
 20 active, 20 total

[gbasedbt@devsvr ~]$
  • 步骤12 灾难前的最后一次数据变更

在灾难发生前,删除一个记录,用于后续恢复时的验证用例。

> delete from t_employee where f_employeeid = 14;

1 row(s) deleted.

> select * from t_employee;

f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         
          11           1 employee_updated    
          12           1 employee_12         
          13           2 employee_13         
          15           3 employee_15         
          16           3 employee_16         
          21           1 employee_21         
          22           1 employee_22         
          23           2 employee_23         
          24           2 employee_24         
          25           3 employee_25         

15 row(s) retrieved.

> select * from t_dept;

   f_deptid f_deptname           

          1 dept_1              
          2 dept_2              
          3 dept_3              
          4 dept_4              

4 row(s) retrieved.

>

在灾难发生前,t_employee表有15条记录,t_dept表有4条记录。
可通过完全恢复,得到t_employee表的15条记录,t_dept表的4条记录。

  • 步骤13 模拟灾难发生
[gbasedbt@devsvr ~]$ cd /opt/gbase/gbaseserver_dbs/
[gbasedbt@devsvr gbaseserver_dbs]$ ll
total 1536000
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:32 datadbs1_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs2_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs3_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs4_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs5_1
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:32 llogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:32 plogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:32 rootdbs
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 sbspace1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:22 tmpdbs1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:22 tmpdbs2
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:19 tmpdbs3
[gbasedbt@devsvr gbaseserver_dbs]$ rm -rf datadbs1_1
[gbasedbt@devsvr gbaseserver_dbs]$ ll
total 1433600
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs2_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs3_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs4_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 datadbs5_1
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:32 llogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:32 plogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:32 rootdbs
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul  9 08:29 sbspace1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:22 tmpdbs1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:22 tmpdbs2
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:19 tmpdbs3
[gbasedbt@devsvr gbaseserver_dbs]$

删除数据空间文件成功。

  • 步骤14 灾难后的第一次数据变更

在数据库空间文件被删除后,对t_dept表的INSERT操作可以成功。

> insert into t_dept values(5, 'dept_5');

1 row(s) inserted.

> select * from t_dept;

   f_deptid f_deptname           

          1 dept_1              
          2 dept_2              
          3 dept_3              
          4 dept_4              
          5 dept_5              

5 row(s) retrieved.

>

灾难发生后,对t_dept表的操作成功,t_dept表共有5条记录。

  • 步骤15 重启数据库,出现错误信息。

数据库报错,信息:Cannot open chunk ‘/opt/gbase/gbaseserver_dbs/datadbs1_1’.

因为这个文件被删除,所以GBase 8s找不到这个文件了。

[gbasedbt@devsvr ~]$ onmode -ky
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ oninit -vy
Your evaluation license will expire on 2022-06-18 00:00:00
Reading configuration file '/opt/gbase/etc/onconfig.gbaseserver'...succeeded
Creating /GBASEDBTTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 36470 kbytes...succeeded
Creating infos file "/opt/gbase/etc/.infos.gbaseserver"...succeeded
Linking conf file "/opt/gbase/etc/.conf.gbaseserver"...succeeded
Initializing rhead structure...rhlock_t 65536 (2048K)... rlock_t (26562K)... Writing to infos file...succeeded
Initialization of Encryption...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'soctcp' listener threads...succeeded
Starting tracing...succeeded
Initializing 32 flushers...succeeded
Initializing SDS Server network connections...succeeded
Initializing log/checkpoint information...succeeded
Initializing dbspaces...succeeded
Opening primary chunks...oninit: Cannot open chunk '/opt/gbase/gbaseserver_dbs/datadbs1_1'. errno = 2
succeeded
Validating chunks...succeeded
Initialize Async Log Flusher...succeeded
Starting B-tree Scanner...succeeded
Init ReadAhead Daemon...succeeded
Init DB Util Daemon...succeeded
Initializing DBSPACETEMP list...succeeded
Init Auto Tuning Daemon...succeeded
Checking database partition index...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop...succeeded
Updating Global Row Counter...succeeded
Forking onmode_mon thread...succeeded
Creating periodic thread...succeeded
Creating periodic thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5
[gbasedbt@devsvr ~]$
  • 步骤16 备份逻辑日志。

执行逻辑日志的备份后,目录中出现两个备份的逻辑日志(devsvr_120_Log0000000033和devsvr_120_Log0000000034)。

[gbasedbt@devsvr backup]$ ontape -a
Your evaluation license will expire on 2022-06-18 00:00:00

Performing automatic backup of logical logs.

File created: /home/gbasedbt/backup/devsvr_120_Log0000000033
Do you want to back up the current logical log? (y/n) y
File created: /home/gbasedbt/backup/devsvr_120_Log0000000034

Program over.
[gbasedbt@devsvr backup]$ ll
total 69664
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:14 devsvr_120_20210724_101445_L1
-rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:17 devsvr_120_L1
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:20 devsvr_120_L2
-rw-rw----. 1 gbasedbt gbasedbt  6356992 Jul 24 10:48 devsvr_120_Log0000000033
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:48 devsvr_120_Log0000000034
[gbasedbt@devsvr backup]$

进行逻辑日志备份时,会产生逻辑日志切换。当前的逻辑日志文件变为12,唯一编号为35。

[gbasedbt@devsvr backup]$ onstat -l
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line (CKPT INP) -- Up 00:07:06 -- 597864 Kbytes
Blocked:OVERRIDE_DOWN_SPACE

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-1  0        1024     42         1          42.00
      phybegin         physize    phypos     phyused    %used   
      3:53             99400      36253      42         0.04    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-3  0        512      6          2          2          3.0        1.0     
	Subsystem    numrecs    Log Space used
	OLDRSAM      6          340           

address          number   flags    uniqid   begin                size     used    %used
4713df88         4        U-B----  27       2:53                 5000        3     0.06
4844a970         5        U-B----  28       2:5053               5000        5     0.10
4844a9d8         6        U-B----  29       2:10053              5000     5000   100.00
4844aa40         7        U-B----  30       2:15053              5000     5000   100.00
4844aaa8         8        U-B----  31       2:20053              5000     5000   100.00
4844ab10         9        U-B----  32       2:25053              5000     5000   100.00
4844ab78         10       U-B----  33       2:30053              5000     3061    61.22
4844abe0         11       U-B---L  34       2:35053              5000       14     0.28
4844ac48         12       U---C--  35       2:40053              5000        0     0.00
4844acb0         13       F------  0        2:45053              5000        0     0.00
4844ad18         14       F------  0        2:50053              5000        0     0.00
4844ad80         15       F------  0        2:55053              5000        0     0.00
4844ade8         16       F------  0        2:60053              5000        0     0.00
4844ae50         17       F------  0        2:65053              5000        0     0.00
4844aeb8         18       F------  0        2:70053              5000        0     0.00
4844af20         19       F------  0        2:75053              5000        0     0.00
4844af88         20       F------  0        2:80053              5000        0     0.00
46f1cf30         21       U-B----  24       2:85053              5000       30     0.60
46f1cf98         22       U-B----  25       2:90053              5000       13     0.26
46febf30         23       U-B----  26       2:95053              5000        3     0.06
 20 active, 20 total

[gbasedbt@devsvr backup]$
  • 步骤17 恢复数据库。

为丢失的数据库空间文件,创建一个同名的空文件,并设置好相应的权限。

[gbasedbt@devsvr gbaseserver_dbs]$ pwd
/opt/gbase/gbaseserver_dbs
[gbasedbt@devsvr gbaseserver_dbs]$ ll
total 1433600
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs2_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs3_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs4_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs5_1
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:48 llogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:44 plogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:44 rootdbs
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 sbspace1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs2
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs3
[gbasedbt@devsvr gbaseserver_dbs]$ touch datadbs1_1
[gbasedbt@devsvr gbaseserver_dbs]$ ll
total 1433600
-rw-rw-r--. 1 gbasedbt gbasedbt         0 Jul 24 10:55 datadbs1_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs2_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs3_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs4_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs5_1
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:48 llogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:44 plogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:44 rootdbs
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 sbspace1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs2
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs3
[gbasedbt@devsvr gbaseserver_dbs]$ chmod o-r datadbs1_1
[gbasedbt@devsvr gbaseserver_dbs]$ ll
total 1433600
-rw-rw----. 1 gbasedbt gbasedbt         0 Jul 24 10:55 datadbs1_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs2_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs3_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs4_1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 datadbs5_1
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:48 llogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:44 plogdbs
-rw-rw----. 1 gbasedbt gbasedbt 209715200 Jul 24 10:44 rootdbs
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 sbspace1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs1
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs2
-rw-rw----. 1 gbasedbt gbasedbt 104857600 Jul 24 10:44 tmpdbs3
[gbasedbt@devsvr gbaseserver_dbs]$

关闭GBase 8s数据库实例,并进行完全恢复。

[gbasedbt@devsvr gbaseserver_dbs]$ onmode -ky
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr gbaseserver_dbs]$ ontape -r
Your evaluation license will expire on 2022-06-18 00:00:00
Restore will use level 0 archive file /home/gbasedbt/backup/devsvr_120_L0. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:08:47 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  0 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 

Spaces to restore:1 [rootdbs                                                                                                                         ] 
2 [llogdbs                                                                                                                         ] 
3 [plogdbs                                                                                                                         ] 
4 [datadbs1                                                                                                                        ] 
5 [datadbs2                                                                                                                        ] 
6 [datadbs3                                                                                                                        ] 
7 [datadbs4                                                                                                                        ] 
8 [datadbs5                                                                                                                        ] 
9 [sbspace1                                                                                                                        ] 

Archive Information

GBase Database Server Copyright 2001, 2021  General Data Corporation
Initialization Time       06/18/2021 17:36:36
System Page Size          2048
Version                   32
Index Page Logging        OFF
Archive CheckPoint Time   07/24/2021 10:08:47

Dbspaces
number   flags    fchunk   nchunks  flags    owner                            name
1        40001    1        1        N  BA    gbasedbt                         rootdbs                                                                                                                         
2        40001    2        1        N  BA    gbasedbt                         llogdbs                                                                                                                         
3        40001    3        1        N  BA    gbasedbt                         plogdbs                                                                                                                         
4        48001    4        1        N SBA    gbasedbt                         sbspace1                                                                                                                        
5        42001    5        1        N TBA    gbasedbt                         tmpdbs1                                                                                                                         
6        42001    6        1        N TBA    gbasedbt                         tmpdbs2                                                                                                                         
7        42001    7        1        N TBA    gbasedbt                         tmpdbs3                                                                                                                         
8        40001    8        1        N  BA    gbasedbt                         datadbs1                                                                                                                        
9        40001    9        1        N  BA    gbasedbt                         datadbs2                                                                                                                        
10       40001    10       1        N  BA    gbasedbt                         datadbs3                                                                                                                        
11       40001    11       1        N  BA    gbasedbt                         datadbs4                                                                                                                        
12       40001    12       1        N  BA    gbasedbt                         datadbs5                                                                                                                        

Chunks
chk/dbs offset   size     free     bpages   flags pathname
1   1   0        102400   89290             PO-B- /opt/gbase/gbaseserver_dbs/rootdbs
2   2   0        102400   2347              PO-B- /opt/gbase/gbaseserver_dbs/llogdbs
3   3   0        102400   2947              PO-B- /opt/gbase/gbaseserver_dbs/plogdbs
4   4   0        51200    2581              POSB- /opt/gbase/gbaseserver_dbs/sbspace1
5   5   0        51200    50712             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs1
6   6   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs2
7   7   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs3
8   8   0        51200    41768             PO-BE /opt/gbase/gbaseserver_dbs/datadbs1_1
9   9   0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs2_1
10  10  0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs3_1
11  11  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs4_1
12  12  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs5_1

Continue restore? (y/n)y    --##### 输入y #####--
Do you want to back up the logs? (y/n)y    --##### 输入y #####--
File created: /home/gbasedbt/backup/devsvr_120_Log0000000024
File created: /home/gbasedbt/backup/devsvr_120_Log0000000025
File created: /home/gbasedbt/backup/devsvr_120_Log0000000026
File created: /home/gbasedbt/backup/devsvr_120_Log0000000027
File created: /home/gbasedbt/backup/devsvr_120_Log0000000028
File created: /home/gbasedbt/backup/devsvr_120_Log0000000029
File created: /home/gbasedbt/backup/devsvr_120_Log0000000030
File created: /home/gbasedbt/backup/devsvr_120_Log0000000031
File created: /home/gbasedbt/backup/devsvr_120_Log0000000032
File created: /home/gbasedbt/backup/devsvr_120_Log0000000033
File created: /home/gbasedbt/backup/devsvr_120_Log0000000034
Log salvage is complete, continuing restore of archive.
Your evaluation license will expire on 2022-06-18 00:00:00
Restore a level 1 archive (y/n) y    --##### 输入y #####--
Ready for level 1 tape 
Restore will use level 1 archive file /home/gbasedbt/backup/devsvr_120_L1. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:17:11 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  1 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 
Restore a level 2 archive (y/n) y    --##### 输入y #####--
Ready for level 2 tape 
Restore will use level 2 archive file /home/gbasedbt/backup/devsvr_120_L2. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:20:04 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  2 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 
Do you want to restore log tapes? (y/n)y    --##### 输入y #####--

Roll forward should start with log number 33
Restore will use log backup file /home/gbasedbt/backup/devsvr_120_Log0000000033. Press Return to continue ...

Rollforward log file /home/gbasedbt/backup/devsvr_120_Log0000000033 ...
Rollforward log file /home/gbasedbt/backup/devsvr_120_Log0000000034 ...

Program over.
[gbasedbt@devsvr gbaseserver_dbs]$
  • 步骤18 查看表数据。

完全恢复后,在数据空间文件删除前的数据验证通过。即使在数据空间文件被删除后的操作成功的事务数据,也可以被完全恢复。

[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Quiescent -- Up 00:03:54 -- 1135464 Kbytes

[gbasedbt@devsvr ~]$ onmode -m
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ dbaccess - -
Your evaluation license will expire on 2022-06-18 00:00:00
> database mydb;

Database selected.

> select * from t_dept;

   f_deptid f_deptname           

          1 dept_1              
          2 dept_2              
          3 dept_3              
          4 dept_4              
          5 dept_5              

5 row(s) retrieved.

> select * from t_employee;

f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         
          11           1 employee_updated    
          12           1 employee_12         
          13           2 employee_13         
          15           3 employee_15         
          16           3 employee_16         
          21           1 employee_21         
          22           1 employee_22         
          23           2 employee_23         
          24           2 employee_24         
          25           3 employee_25         

15 row(s) retrieved.

>

检查结果:数据表完全恢复到数据库空间被删除前的状态,且在数据库空间文件被删除后新增的记录,也被正确恢复。

  • 步骤19 删除表之前的数据准备



> select * from t_employee order by f_employeeid; f_employeeid f_deptid f_employeename 1 1 employee_01 2 1 employee_02 3 2 employee_03 4 2 employee_04 5 3 employee_05 11 1 employee_updated 12 1 employee_12 13 2 employee_13 15 3 employee_15 16 3 employee_16 21 1 employee_21 22 1 employee_22 23 2 employee_23 24 2 employee_24 25 3 employee_25 101 1 employee_101 102 1 employee_102 103 2 employee_103 104 2 employee_104 105 3 employee_105 20 row(s) retrieved.



此处构造的5条测试数据,由于没有基于时间点的恢复,可能在数据表被删除时,无法正确恢复。

  • 步骤20 删除t_employee数据表



> drop table t_employee; Table dropped. > select * from t_employee; 206: The specified table (t_employee) is not in the database. 111: ISAM error: no record found. Error in line 1 Near character position 24



  • 步骤21 L0级物理恢复
[gbasedbt@devsvr ~]$ onmode -ky
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ ontape -p
Your evaluation license will expire on 2022-06-18 00:00:00
Restore will use level 0 archive file /home/gbasedbt/backup/devsvr_120_L0. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:08:47 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  0 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 

Spaces to restore:1 [rootdbs                                                                                                                         ] 
2 [llogdbs                                                                                                                         ] 
3 [plogdbs                                                                                                                         ] 
4 [datadbs1                                                                                                                        ] 
5 [datadbs2                                                                                                                        ] 
6 [datadbs3                                                                                                                        ] 
7 [datadbs4                                                                                                                        ] 
8 [datadbs5                                                                                                                        ] 
9 [sbspace1                                                                                                                        ] 

Archive Information

GBase Database Server Copyright 2001, 2021  General Data Corporation
Initialization Time       06/18/2021 17:36:36
System Page Size          2048
Version                   32
Index Page Logging        OFF
Archive CheckPoint Time   07/24/2021 10:08:47

Dbspaces
number   flags    fchunk   nchunks  flags    owner                            name
1        40001    1        1        N  BA    gbasedbt                         rootdbs                                                                                                                         
2        40001    2        1        N  BA    gbasedbt                         llogdbs                                                                                                                         
3        40001    3        1        N  BA    gbasedbt                         plogdbs                                                                                                                         
4        48001    4        1        N SBA    gbasedbt                         sbspace1                                                                                                                        
5        42001    5        1        N TBA    gbasedbt                         tmpdbs1                                                                                                                         
6        42001    6        1        N TBA    gbasedbt                         tmpdbs2                                                                                                                         
7        42001    7        1        N TBA    gbasedbt                         tmpdbs3                                                                                                                         
8        40001    8        1        N  BA    gbasedbt                         datadbs1                                                                                                                        
9        40001    9        1        N  BA    gbasedbt                         datadbs2                                                                                                                        
10       40001    10       1        N  BA    gbasedbt                         datadbs3                                                                                                                        
11       40001    11       1        N  BA    gbasedbt                         datadbs4                                                                                                                        
12       40001    12       1        N  BA    gbasedbt                         datadbs5                                                                                                                        


Chunks
chk/dbs offset   size     free     bpages   flags pathname
1   1   0        102400   89290             PO-B- /opt/gbase/gbaseserver_dbs/rootdbs
2   2   0        102400   2347              PO-B- /opt/gbase/gbaseserver_dbs/llogdbs
3   3   0        102400   2947              PO-B- /opt/gbase/gbaseserver_dbs/plogdbs
4   4   0        51200    2581              POSB- /opt/gbase/gbaseserver_dbs/sbspace1
5   5   0        51200    50712             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs1
6   6   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs2
7   7   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs3
8   8   0        51200    41768             PO-BE /opt/gbase/gbaseserver_dbs/datadbs1_1
9   9   0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs2_1
10  10  0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs3_1
11  11  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs4_1
12  12  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs5_1

Continue restore? (y/n)y                       --##### 输入y #####--
Do you want to back up the logs? (y/n)y        --##### 输入y #####--
File created: /home/gbasedbt/backup/devsvr_120_Log0000000035
Log salvage is complete, continuing restore of archive.
Your evaluation license will expire on 2022-06-18 00:00:00
Restore a level 1 archive (y/n) n              --##### 输入n,不进行L1恢复 #####--

Program over.
[gbasedbt@devsvr ~]$

查看L0级物理恢复后,被删除表的恢复情况

[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Fast Recovery -- Up 00:01:22 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ onmode -m
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:01:38 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ echo "select * from t_employee" | dbaccess mydb
Your evaluation license will expire on 2022-06-18 00:00:00

Database selected. 

f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         

5 row(s) retrieved.

Database closed.

[gbasedbt@devsvr ~]$
  • 步骤22 L1级物理恢复
[gbasedbt@devsvr ~]$ onmode -ky
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ ontape -p
Your evaluation license will expire on 2022-06-18 00:00:00
Restore will use level 0 archive file /home/gbasedbt/backup/devsvr_120_L0. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:08:47 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  0 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 

Spaces to restore:1 [rootdbs                                                                                                                         ] 
2 [llogdbs                                                                                                                         ] 
3 [plogdbs                                                                                                                         ] 
4 [datadbs1                                                                                                                        ] 
5 [datadbs2                                                                                                                        ] 
6 [datadbs3                                                                                                                        ] 
7 [datadbs4                                                                                                                        ] 
8 [datadbs5                                                                                                                        ] 
9 [sbspace1                                                                                                                        ] 

Archive Information

GBase Database Server Copyright 2001, 2021  General Data Corporation
Initialization Time       06/18/2021 17:36:36
System Page Size          2048
Version                   32
Index Page Logging        OFF
Archive CheckPoint Time   07/24/2021 10:08:47

Dbspaces
number   flags    fchunk   nchunks  flags    owner                            name
1        40001    1        1        N  BA    gbasedbt                         rootdbs                                                                                                                         
2        40001    2        1        N  BA    gbasedbt                         llogdbs                                                                                                                         
3        40001    3        1        N  BA    gbasedbt                         plogdbs                                                                                                                         
4        48001    4        1        N SBA    gbasedbt                         sbspace1                                                                                                                        
5        42001    5        1        N TBA    gbasedbt                         tmpdbs1                                                                                                                         
6        42001    6        1        N TBA    gbasedbt                         tmpdbs2                                                                                                                         
7        42001    7        1        N TBA    gbasedbt                         tmpdbs3                                                                                                                         
8        40001    8        1        N  BA    gbasedbt                         datadbs1                                                                                                                        
9        40001    9        1        N  BA    gbasedbt                         datadbs2                                                                                                                        
10       40001    10       1        N  BA    gbasedbt                         datadbs3                                                                                                                        
11       40001    11       1        N  BA    gbasedbt                         datadbs4                                                                                                                        
12       40001    12       1        N  BA    gbasedbt                         datadbs5                                                                                                                        


Chunks
chk/dbs offset   size     free     bpages   flags pathname
1   1   0        102400   89290             PO-B- /opt/gbase/gbaseserver_dbs/rootdbs
2   2   0        102400   2347              PO-B- /opt/gbase/gbaseserver_dbs/llogdbs
3   3   0        102400   2947              PO-B- /opt/gbase/gbaseserver_dbs/plogdbs
4   4   0        51200    2581              POSB- /opt/gbase/gbaseserver_dbs/sbspace1
5   5   0        51200    50712             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs1
6   6   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs2
7   7   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs3
8   8   0        51200    41768             PO-BE /opt/gbase/gbaseserver_dbs/datadbs1_1
9   9   0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs2_1
10  10  0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs3_1
11  11  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs4_1
12  12  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs5_1

Continue restore? (y/n)y                    --##### 输入y #####--
Do you want to back up the logs? (y/n)y     --##### 输入y #####--
No log files to salvage. Logs 33 - 33 already exists in directory /home/gbasedbt/backup/
Log salvage is complete, continuing restore of archive.
Your evaluation license will expire on 2022-06-18 00:00:00
Restore a level 1 archive (y/n) y           --##### 输入y #####--
Ready for level 1 tape 
Restore will use level 1 archive file /home/gbasedbt/backup/devsvr_120_L1. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:17:11 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  1 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 
Restore a level 2 archive (y/n) n            --##### 输入n,不进行L2的恢复 #####--

Program over.
[gbasedbt@devsvr ~]$

查看L1级物理恢复后,被删除表的恢复情况

[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Fast Recovery -- Up 00:01:17 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ onmode -m
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:01:30 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ echo "select * from t_employee" | dbaccess mydb
Your evaluation license will expire on 2022-06-18 00:00:00

Database selected.
    

f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         
          11           1 employee_11         
          12           1 employee_12         
          13           2 employee_13         
          14           2 employee_14         
          15           3 employee_15         
          16           3 employee_16         

11 row(s) retrieved.
    

Database closed.

[gbasedbt@devsvr ~]$
  • 步骤23 L2级物理恢复
[gbasedbt@devsvr ~]$ onmode -ky
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ ontape -p
Your evaluation license will expire on 2022-06-18 00:00:00
Restore will use level 0 archive file /home/gbasedbt/backup/devsvr_120_L0. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:08:47 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  0 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 

Spaces to restore:1 [rootdbs                                                                                                                         ] 
2 [llogdbs                                                                                                                         ] 
3 [plogdbs                                                                                                                         ] 
4 [datadbs1                                                                                                                        ] 
5 [datadbs2                                                                                                                        ] 
6 [datadbs3                                                                                                                        ] 
7 [datadbs4                                                                                                                        ] 
8 [datadbs5                                                                                                                        ] 
9 [sbspace1                                                                                                                        ] 

Archive Information

GBase Database Server Copyright 2001, 2021  General Data Corporation
Initialization Time       06/18/2021 17:36:36
System Page Size          2048
Version                   32
Index Page Logging        OFF
Archive CheckPoint Time   07/24/2021 10:08:47

Dbspaces
number   flags    fchunk   nchunks  flags    owner                            name
1        40001    1        1        N  BA    gbasedbt                         rootdbs                                                                                                                         
2        40001    2        1        N  BA    gbasedbt                         llogdbs                                                                                                                         
3        40001    3        1        N  BA    gbasedbt                         plogdbs                                                                                                                         
4        48001    4        1        N SBA    gbasedbt                         sbspace1                                                                                                                        
5        42001    5        1        N TBA    gbasedbt                         tmpdbs1                                                                                                                         
6        42001    6        1        N TBA    gbasedbt                         tmpdbs2                                                                                                                         
7        42001    7        1        N TBA    gbasedbt                         tmpdbs3                                                                                                                         
8        40001    8        1        N  BA    gbasedbt                         datadbs1                                                                                                                        
9        40001    9        1        N  BA    gbasedbt                         datadbs2                                                                                                                        
10       40001    10       1        N  BA    gbasedbt                         datadbs3                                                                                                                        
11       40001    11       1        N  BA    gbasedbt                         datadbs4                                                                                                                        
12       40001    12       1        N  BA    gbasedbt                         datadbs5                                                                                                                        


Chunks
chk/dbs offset   size     free     bpages   flags pathname
1   1   0        102400   89290             PO-B- /opt/gbase/gbaseserver_dbs/rootdbs
2   2   0        102400   2347              PO-B- /opt/gbase/gbaseserver_dbs/llogdbs
3   3   0        102400   2947              PO-B- /opt/gbase/gbaseserver_dbs/plogdbs
4   4   0        51200    2581              POSB- /opt/gbase/gbaseserver_dbs/sbspace1
5   5   0        51200    50712             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs1
6   6   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs2
7   7   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs3
8   8   0        51200    41768             PO-BE /opt/gbase/gbaseserver_dbs/datadbs1_1
9   9   0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs2_1
10  10  0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs3_1
11  11  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs4_1
12  12  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs5_1

Continue restore? (y/n)y                       --##### 输入y #####--
Do you want to back up the logs? (y/n)y        --##### 输入y #####--
No log files to salvage. Logs 33 - 33 already exists in directory /home/gbasedbt/backup/
Log salvage is complete, continuing restore of archive.
Your evaluation license will expire on 2022-06-18 00:00:00
Restore a level 1 archive (y/n) y              --##### 输入y #####--
Ready for level 1 tape 
Restore will use level 1 archive file /home/gbasedbt/backup/devsvr_120_L1. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:17:11 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  1 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 
Restore a level 2 archive (y/n) y             --##### 输入y #####--
Ready for level 2 tape 
Restore will use level 2 archive file /home/gbasedbt/backup/devsvr_120_L2. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:20:04 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  2 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 

Program over.
[gbasedbt@devsvr ~]$

查看L2级物理恢复后,被删除表的恢复情况

[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Fast Recovery -- Up 00:01:02 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ onmode -m
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:01:14 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ echo "select * from t_employee" | dbaccess mydb
Your evaluation license will expire on 2022-06-18 00:00:00

Database selected.
    

f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         
          11           1 employee_11         
          12           1 employee_12         
          13           2 employee_13         
          14           2 employee_14         
          15           3 employee_15         
          16           3 employee_16         
          21           1 employee_21         
          22           1 employee_22         
          23           2 employee_23         
          24           2 employee_24         
          25           3 employee_25         

16 row(s) retrieved.

Database closed.

[gbasedbt@devsvr ~]$
  • 步骤21 L2级物理恢复+部分逻辑恢复

查看备份设备中的逻辑日志情况,根据实际情况,尝试移除最近的几个逻辑日志。本次演示,移除了最后2个逻辑日志。

[gbasedbt@devsvr ~]$ cd backup/
[gbasedbt@devsvr backup]$ ll
total 116928
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:14 devsvr_120_20210724_101445_L1
-rw-rw----. 1 gbasedbt gbasedbt  6356992 Jul 24 10:48 devsvr_120_20210724_104845_Log0000000033
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:48 devsvr_120_20210724_104857_Log0000000034
-rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:17 devsvr_120_L1
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:20 devsvr_120_L2
-rw-rw----. 1 gbasedbt gbasedbt   131072 Jul 24 10:57 devsvr_120_Log0000000024
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000025
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000026
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000027
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000028
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000029
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000030
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000031
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000032
-rw-rw----. 1 gbasedbt gbasedbt  6356992 Jul 24 10:57 devsvr_120_Log0000000033
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000034
-rw-rw----. 1 gbasedbt gbasedbt   131072 Jul 24 11:56 devsvr_120_Log0000000035
[gbasedbt@devsvr backup]$ mkdir tmp
[gbasedbt@devsvr backup]$ mv devsvr_120_Log0000000034 devsvr_120_Log0000000035 tmp        -- ##### 移除两个逻辑日志文件 #####--
[gbasedbt@devsvr backup]$ ll
total 116704
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:14 devsvr_120_20210724_101445_L1
-rw-rw----. 1 gbasedbt gbasedbt  6356992 Jul 24 10:48 devsvr_120_20210724_104845_Log0000000033
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:48 devsvr_120_20210724_104857_Log0000000034
-rw-rw----. 1 gbasedbt gbasedbt 44630016 Jul 24 10:08 devsvr_120_L0
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:17 devsvr_120_L1
-rw-rw----. 1 gbasedbt gbasedbt  6750208 Jul 24 10:20 devsvr_120_L2
-rw-rw----. 1 gbasedbt gbasedbt   131072 Jul 24 10:57 devsvr_120_Log0000000024
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000025
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000026
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000027
-rw-rw----. 1 gbasedbt gbasedbt    98304 Jul 24 10:57 devsvr_120_Log0000000028
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000029
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000030
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000031
-rw-rw----. 1 gbasedbt gbasedbt 10321920 Jul 24 10:57 devsvr_120_Log0000000032
-rw-rw----. 1 gbasedbt gbasedbt  6356992 Jul 24 10:57 devsvr_120_Log0000000033
drwxrwxr-x. 2 gbasedbt gbasedbt       70 Jul 24 12:08 tmp
[gbasedbt@devsvr backup]$

进行完全恢复。

说明:虽然操作的是完全恢复,但因我们移除了部分最新的逻辑日志,实际上执行的结果是不完全恢复。

[gbasedbt@devsvr backup]$ onmode -ky
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr backup]$ ontape -r
Your evaluation license will expire on 2022-06-18 00:00:00
Restore will use level 0 archive file /home/gbasedbt/backup/devsvr_120_L0. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:08:47 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  0 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 

Spaces to restore:1 [rootdbs                                                                                                                         ] 
2 [llogdbs                                                                                                                         ] 
3 [plogdbs                                                                                                                         ] 
4 [datadbs1                                                                                                                        ] 
5 [datadbs2                                                                                                                        ] 
6 [datadbs3                                                                                                                        ] 
7 [datadbs4                                                                                                                        ] 
8 [datadbs5                                                                                                                        ] 
9 [sbspace1                                                                                                                        ] 

Archive Information

GBase Database Server Copyright 2001, 2021  General Data Corporation
Initialization Time       06/18/2021 17:36:36
System Page Size          2048
Version                   32
Index Page Logging        OFF
Archive CheckPoint Time   07/24/2021 10:08:47

Dbspaces
number   flags    fchunk   nchunks  flags    owner                            name
1        40001    1        1        N  BA    gbasedbt                         rootdbs                                                                                                                         
2        40001    2        1        N  BA    gbasedbt                         llogdbs                                                                                                                         
3        40001    3        1        N  BA    gbasedbt                         plogdbs                                                                                                                         
4        48001    4        1        N SBA    gbasedbt                         sbspace1                                                                                                                        
5        42001    5        1        N TBA    gbasedbt                         tmpdbs1                                                                                                                         
6        42001    6        1        N TBA    gbasedbt                         tmpdbs2                                                                                                                         
7        42001    7        1        N TBA    gbasedbt                         tmpdbs3                                                                                                                         
8        40001    8        1        N  BA    gbasedbt                         datadbs1                                                                                                                        
9        40001    9        1        N  BA    gbasedbt                         datadbs2                                                                                                                        
10       40001    10       1        N  BA    gbasedbt                         datadbs3                                                                                                                        
11       40001    11       1        N  BA    gbasedbt                         datadbs4                                                                                                                        
12       40001    12       1        N  BA    gbasedbt                         datadbs5                                                                                                                        

Chunks
chk/dbs offset   size     free     bpages   flags pathname
1   1   0        102400   89290             PO-B- /opt/gbase/gbaseserver_dbs/rootdbs
2   2   0        102400   2347              PO-B- /opt/gbase/gbaseserver_dbs/llogdbs
3   3   0        102400   2947              PO-B- /opt/gbase/gbaseserver_dbs/plogdbs
4   4   0        51200    2581              POSB- /opt/gbase/gbaseserver_dbs/sbspace1
5   5   0        51200    50712             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs1
6   6   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs2
7   7   0        51200    50776             PO-B- /opt/gbase/gbaseserver_dbs/tmpdbs3
8   8   0        51200    41768             PO-BE /opt/gbase/gbaseserver_dbs/datadbs1_1
9   9   0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs2_1
10  10  0        51200    50376             PO-BE /opt/gbase/gbaseserver_dbs/datadbs3_1
11  11  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs4_1
12  12  0        51200    50776             PO-BE /opt/gbase/gbaseserver_dbs/datadbs5_1

Continue restore? (y/n)y                        --##### 输入y #####--
Do you want to back up the logs? (y/n)n         --##### 输入n,避免将移除的日志再次抢救到备份目录中 #####--
Your evaluation license will expire on 2022-06-18 00:00:00
Restore a level 1 archive (y/n) y                --##### 输入y #####--
Ready for level 1 tape 
Restore will use level 1 archive file /home/gbasedbt/backup/devsvr_120_L1. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:17:11 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  1 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 
Restore a level 2 archive (y/n) y                --##### 输入y #####--
Ready for level 2 tape 
Restore will use level 2 archive file /home/gbasedbt/backup/devsvr_120_L2. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape 
Online version: GBase Database Server Version 12.10.FC4G1TL 
Archive date:   Sat Jul 24 10:20:04 2021 
User id:        gbasedbt 
Terminal id:    /dev/pts/0 
Archive level:  2 
Tape device:    /home/gbasedbt/backup/ 
Tape blocksize (in k): 32 
Tape size (in k): system defined for directory 
Tape number in series: 1 
Do you want to restore log tapes? (y/n)y        --##### 输入y,实现逻辑日志的恢复 #####--

Roll forward should start with log number 33
Restore will use log backup file /home/gbasedbt/backup/devsvr_120_Log0000000033. Press Return to continue ...

Rollforward log file /home/gbasedbt/backup/devsvr_120_Log0000000033 ...

Program over.
[gbasedbt@devsvr backup]$

查看L2级物理恢复+部分逻辑恢复后,被删除表的恢复情况

[gbasedbt@devsvr backup]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Quiescent -- Up 00:02:36 -- 1135464 Kbytes

[gbasedbt@devsvr backup]$ onmode -m
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr backup]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:02:44 -- 1135464 Kbytes

[gbasedbt@devsvr backup]$ echo "select * from t_employee" | dbaccess mydb
Your evaluation license will expire on 2022-06-18 00:00:00

Database selected.

f_employeeid    f_deptid f_employeename       

           1           1 employee_01         
           2           1 employee_02         
           3           2 employee_03         
           4           2 employee_04         
           5           3 employee_05         
          11           1 employee_updated    
          12           1 employee_12         
          13           2 employee_13         
          14           2 employee_14         
          15           3 employee_15         
          16           3 employee_16         
          21           1 employee_21         
          22           1 employee_22         
          23           2 employee_23         
          24           2 employee_24         
          25           3 employee_25         

16 row(s) retrieved.

Database closed.

[gbasedbt@devsvr backup]$

虽然此处恢复的数据仍然是11行,但L2备份后,被更新的记录被恢复成功。

附录

数据库与表

create database mydb in datadbs1 with log;
create table t_dept(f_deptid int, f_deptname varchar(20));
create table t_employee(f_employeeid int, f_deptid int, f_employeename varchar(20));

数据(t2)

insert into t_dept values(1, 'dept_1');
insert into t_dept values(2, 'dept_2');
insert into t_dept values(3, 'dept_3');

数据(t3)

insert into t_employee values(1, 1, 'employee_01');
insert into t_employee values(2, 1, 'employee_02');
insert into t_employee values(3, 2, 'employee_03');
insert into t_employee values(4, 2, 'employee_04');
insert into t_employee values(5, 3, 'employee_05');

数据(t5)

insert into t_employee values(11, 1, 'employee_11');
insert into t_employee values(12, 1, 'employee_12');
insert into t_employee values(13, 2, 'employee_13');
insert into t_employee values(14, 2, 'employee_14');
insert into t_employee values(15, 3, 'employee_15');

数据(t7)

insert into t_employee values(16, 3, 'employee_16');

数据(t9)

insert into t_employee values(21, 1, 'employee_21');
insert into t_employee values(22, 1, 'employee_22');
insert into t_employee values(23, 2, 'employee_23');
insert into t_employee values(24, 2, 'employee_24');
insert into t_employee values(25, 3, 'employee_25');

数据(t11)

insert into t_dept values(4, 'dept_4');

数据(t12)

update t_employee set f_employeename = 'employee_updated' where f_employeeid = 11;

数据(t14)

delete from t_employee where f_employeeid = 14;

数据(t15)

drop table t_employee;

数据(t16)

insert into t_dept values(5, 'dept_5');

数据(t19)

insert into t_employee values(101, 1, 'employee_101');
insert into t_employee values(102, 1, 'employee_102');
insert into t_employee values(103, 2, 'employee_103');
insert into t_employee values(104, 2, 'employee_104');
insert into t_employee values(105, 3, 'employee_105');

数据(t20)

drop table t_employee;

标签:10,00,rw,恢复,备份,gbasedbt,ontape,employee,devsvr
From: https://blog.51cto.com/u_13482808/7280764

相关文章

  • Centos误删系统自带python2.7,yum报错恢复方法
     使用wget分别下载python以及yum的rpm包资源地址如下:          http://vault.centos.orgmkdir/usr/local/src/pythoncd/usr/local/src/pythonwgethttp://vault.centos.org/7.6.1810/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpmwgethtt......
  • Cisco Catalyst 4506E密码恢复
    用户实际环境中的一台思科4506交换机无法登录,由于维护人员也不记得修改后的密码,只能对系统进行恢复。环境:CiscoCatalyst4506E交换机,引擎为WS-X45-SUP8-E,系统版本是cat4500es8-UNIVERSAL-M恢复步骤:重启交换机,按ctrl+c中止交换机的启动过程,如下所示:VerifyingFPGA(P)Signature........
  • 数据库备份和Shell基础测试及AWK(运维)
    第一题:使用MySQL命令进行备份和恢复的步骤如下:备份test库:使用mysqldump命令备份test库,并将备份写入一个.sql文件中。命令示例:mysqldump-u用户名-p密码test>backup.sql恢复备份:使用mysql命令将备份文件中的数据恢复到test库中。命令示例:mysql-u用户名-p密码test<backu......
  • golang 协程、延迟函数调用、以及恐慌和恢复
    此篇文章将介绍协程和延迟函数调用。协程和延迟函数调用是Go中比较独特的两个特性。恐慌和恢复也将在此篇文章中得到简单介绍。本文并非全面地对这些特性进行介绍,后面的其它文章会陆续补全本文的未介绍的内容。协程(goroutine)现代CPU一般含有多个核,并且一个核可能支持多线程。......
  • pg_dump备份加密
    瀚高数据库目录文档用途详细信息文档用途通常目前备份过程中,备份出的数据都为明文,而在备份数据的传输或者使用过程中,都有可能出现备份数据丢失的情况。在这种情况下,需要对备份出的数据进行加密处理。详细信息1.介绍对于备份时输入的口令,使用SM3加密算法,生成类似SM3***格式的16......
  • 【8.0】Docker迁移备份
    【一】镜像的来源:通过dockerpull命令拉取镜像:dockerpull<image_name>该命令将从Docker镜像仓库(如DockerHub)下载指定名称的镜像,并将其存储到本地。通过容器打包成镜像:dockercommit<container_name><image_name>这条命令会将指定的容器打包成一个新的镜像,并根据......
  • Mysql主从备份时遇到的坑
    SHOWVARIABLESLIKE 'server_id' 配置完不同步时,一定要看一下这个值是否一致, 原因是我在my.ini里手工加了一条server-id=2,在手工加的下面,还有一条系统自带的server-id=1,把我的那条冲掉了,所以一直失败!!!......
  • MySQL主从数据恢复
    主要步骤:导出主库数据,恢复到从库,重新开启主从同步。 1.先停止从库从库上执行stopslave; 2 在从库mysqlbin目录下导出主库数据./mysqldump-h192.168.174.201--port=3359-uroot-p'pwd'--default-character-set=UTF8MB4--single-transaction--events--triggers......
  • 服务器数据恢复-RAID6磁盘重组RAID5导致原RAID6数据丢失的数据恢复案例
    服务器数据恢复环境:一台存储设备中有一组由12块硬盘组建的RAID6磁盘阵列,上层采用EXT3文件系统,共划分3个LUN。服务器故障&分析:存储设备在运行过程中RAID6阵列突然不可用,管理员对故障存储进行了重新分配RAID的操作并进行了初始化。初始化一段时间后,管理员察觉有异,于是强行终止初始......
  • MySQL借助ibd文件恢复数据技巧?
    还记得我们之前写过的《只需一招,让失控的研发爱上你》吗?前文提到过我们日常使用的比较多的两种数据库恢复方法是:以上两种方法都可以实现实时性的回档,但是你会认为有了这两种技能就够了吗?不….!在线上这种错综复杂的架构中,其实还有很多未知的原因,我们是没法预知的。例如以下这......