基于ontape的备份与恢复实验

        通过本文的备份恢复实验,我们可以深入了解ontape的使用方法和原理,包括如何进行完整备份、增量备份以及如何利用备份文件进行数据恢复。

1. 配置onconfig参数

        通过修改onconfig参数文件,或使用onmode -wf命令,设置备份默认使用的存储设备。

  • 检查onconfig文件中备份的存储设备参数,发现未指定

[informix@vm84145 ~]$ onstat -g cfg |grep TAPEDEV
TAPEDEV                   /dev/null
LTAPEDEV                  /dev/null

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

[informix@vm84145 ~]$ mkdir backup
[informix@vm84145 ~]$ onmode -wf "LTAPEDEV=/home/informix/backup"
Value of LTAPEDEV has been changed to /home/informix/backup.
[informix@vm84145 ~]$ onmode -wf "TAPEDEV=/home/informix/backup"
Value of TAPEDEV has been changed to /home/informix/backup.

  • 再次查看备份设备参数,确认已经指向新创建的目录。

[informix@vm84145 ~]$ onstat -g cfg |grep TAPEDEV |grep -v '#'
TAPEDEV                   /home/informix/backup
LTAPEDEV                  /home/informix/backup

2. 备份与恢复实验

业务场景:数据库空间文件被删除时的数据恢复

image

image656×570 17.2 KB

步骤1:创建数据库与表

  • 操作演示

 

[informix@vm84145 ~]$ dbaccess - -
> create database tapedb in datadbs1 with log;

Database created.

> create table t_dept(f_deptid int, f_deptname varchar(20));     

Table created.

> create table t_employee(f_employeeid int, f_deptid int, f_employeename varchar(20));

Table created.

> info tables;

Table name

t_dept             t_employee         

>

实验的数据库和表创建完成。

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

  • 插入数据

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

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');

  • 查看数据情况

> 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备份需要的测试数据。
在L0备份前,t_dept表有3条记录,t_employee表有5条记录。在将数据库物理恢复到L0时,可恢复t_dept中的3条记录和t_employee中的5条记录。

步骤3:执行L0备份

  • 语法

 ontape -s -L 0

其中
-s:表示备份整个系统
-L:表示备份级别
操作演示

[informix@vm84145 ~]$ ontape -s -L 0
100 percent done.
File created: /home/informix/backup/vm84145_0_L0

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

 7

Program over.
[informix@vm84145 ~]$ cd backup/
[informix@vm84145 backup]$ ll
total 204320
-rw-rw---- 1 informix informix 209223680 Feb 23 23:14 vm84145_0_L0
[informix@vm84145 backup]$

执行L0备份后,目录中生成一个名称为vm84145_0_L0的备份文件。vm84145是服务器名,0是数据库实例ID,L0表示一个0级备份。

步骤4:L1备份前的数据准备

  • 插入数据
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');
  • 查看数据情况

> 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.

>

t_employee中数据新增5条记录,用于L1的备份测试。

步骤5:执行L1备份

  • 语法 
ontape -s -L 1
  • 操作演示

[informix@vm84145 backup]$ ontape -s -L 1
100 percent done.
File created: /home/informix/backup/vm84145_0_L1

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

 7

Program over.
[informix@vm84145 backup]$ ll
total 381152
-rw-rw---- 1 informix informix 209223680 Feb 23 23:14 vm84145_0_L0
-rw-rw---- 1 informix informix 181075968 Feb 23 23:20 vm84145_0_L1
[informix@vm84145 backup]$

执行L1备份后,目录中生成一个名称为vm84145_0_L1的备份文件。vm84145是服务器名,0是数据库实例ID,L1表示一个1级备份。

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

  • 插入数据
insert into t_employee values(16, 3, 'employee_16');
  • 查看数据情况

[informix@vm84145 backup]$ dbaccess tapedb -

Database selected.

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

1 row(s) inserted.

> 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备份(第二次)

  • 语法
ontape -s -L 1
  • 操作演示

[informix@vm84145 backup]$ ontape -s -L 1
100 percent done.
File created: /home/informix/backup/vm84145_0_L1

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

 7

Program over.
[informix@vm84145 backup]$ ll
total 557984
-rw-rw---- 1 informix informix 181075968 Feb 23 23:20 vm84145_0_20220223_232007_L1
-rw-rw---- 1 informix informix 209223680 Feb 23 23:14 vm84145_0_L0
-rw-rw---- 1 informix informix 181075968 Feb 23 23:25 vm84145_0_L1
[informix@vm84145 backup]$

当连续执行L 1备份时,原来的L1备份会被重命名为
<server_name><instance_id>格式
新备份的文件仍为
<server_name>
<instance_id>_格式

步骤8:L2备份前的数据准备

  • 插入数据

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');

  • 查看数据情况

> 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备份

  • 语法
ontape -s -L 2
  • 操作演示

[informix@vm84145 backup]$ ontape -s -L 2
100 percent done.
File created: /home/informix/backup/vm84145_0_L2

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

 7

Program over.
[informix@vm84145 backup]$ ll
total 734848
-rw-rw---- 1 informix informix 181075968 Feb 23 23:20 vm84145_0_20220223_232007_L1
-rw-rw---- 1 informix informix 209223680 Feb 23 23:14 vm84145_0_L0
-rw-rw---- 1 informix informix 181075968 Feb 23 23:25 vm84145_0_L1
-rw-rw---- 1 informix informix 181108736 Feb 23 23:43 vm84145_0_L2
[informix@vm84145 backup]$

至此,三级备份已经完成。

步骤10:切换逻辑日志前的数据准备

  • 数据操作

[informix@vm84145 backup]$ dbaccess tapedb -

Database selected.

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

1 row(s) inserted.

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

1 row(s) updated.

>

  • 查看数据

> 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:切换逻辑日志

  • 切换前,当前的逻辑日志文件(number)是7,唯一编号(uniqid)为7。

[informix@vm84145 backup]$ onstat -l

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 5 days 03:53:53 -- 2374324 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-2  24       1024     34255      924        37.07
      phybegin         physize    phypos     phyused    %used   
      3:53             1023945    46558      24         0.00    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-2  0        512      448373     62687      49756      7.2        1.3     
        Subsystem    numrecs    Log Space used
        OLDRSAM      447573     48095856      
        HA           667        29348         
        DDL          133        46284         

address          number   flags    uniqid   begin                size     used    %used
475dffa8         7        U---C-L  7        2:53               102390    88177    86.12
475fbf88         8        A------  0        2:102443           102390        0     0.00
48882d90         9        A------  0        2:204833           102390        0     0.00
48882df8         10       A------  0        2:307223           102390        0     0.00
48882e60         11       A------  0        2:409613           102390        0     0.00
48882ec8         12       A------  0        2:512003           102390        0     0.00
48882f30         13       A------  0        2:614393           102390        0     0.00
48882f98         14       A------  0        2:716783           102390        0     0.00
473abf68         15       A------  0        2:819173           102390        0     0.00
47481f40         16       A------  0        2:921563           102390        0     0.00
 10 active, 10 total

[informix@vm84145 backup]$

  • 执行逻辑日志切换命令
[informix@vm84145 backup]$ onmode -l
  • 切换后,当前的逻辑日志文件(number)是8,唯一编号(uniqid)为8。

[informix@vm84145 backup]$ onstat -l

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 5 days 03:55:14 -- 2374324 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-2  16       1024     34294      926        37.03
      phybegin         physize    phypos     phyused    %used   
      3:53             1023945    46597      31         0.00    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-3  0        512      448398     62694      49763      7.2        1.3     
        Subsystem    numrecs    Log Space used
        OLDRSAM      447597     48098256      
        HA           668        29392         
        DDL          133        46284         

address          number   flags    uniqid   begin                size     used    %used
475dffa8         7        U-----L  7        2:53               102390    88180    86.12
475fbf88         8        U---C--  8        2:102443           102390        4     0.00
48882d90         9        A------  0        2:204833           102390        0     0.00
48882df8         10       A------  0        2:307223           102390        0     0.00
48882e60         11       A------  0        2:409613           102390        0     0.00
48882ec8         12       A------  0        2:512003           102390        0     0.00
48882f30         13       A------  0        2:614393           102390        0     0.00
48882f98         14       A------  0        2:716783           102390        0     0.00
473abf68         15       A------  0        2:819173           102390        0     0.00
47481f40         16       A------  0        2:921563           102390        0     0.00
 10 active, 10 total

[informix@vm84145 backup]$

步骤12:灾难前的最后一次数据变更

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

[informix@vm84145 backup]$ dbaccess tapedb -

Database selected.

> 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.

>

步骤13:模拟灾难发生

我们在步骤1中执行create database tapedb in datadbs1 with log;,指定演示数据库创建在datadbs1中,我们可以删除该数据库空间对应的文件,破坏数据。

使用onstat -d列出数据库中的表空间。

[informix@vm84145 ~]$ onstat -d

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 5 days 21:29:58 -- 2374324 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
47481028         1        0x1        1        1        2048     N  BA    informix rootdbs
48ab60d8         2        0x1        2        1        2048     N  BA    informix llogdbs
48ab6318         3        0x1        3        1        2048     N  BA    informix plogdbs
48ab6558         4        0x2001     4        1        8192     N TBA    informix tempdbs1
48ab6798         5        0x2001     5        1        8192     N TBA    informix tempdbs2
48ab69d8         6        0x2001     6        1        8192     N TBA    informix tempdbs3
48ab6c18         7        0x11       7        1        8192     N BBA    informix bindbs1
48ab7028         8        0x8001     8        1        2048     N SBA    informix sbdbs1
48ab7268         9        0x1        9        1        2048     N  BA    informix datadbs1
48ab74a8         10       0x1        10       1        2048     N  BA    informix datadbs2
48ab76e8         11       0x1        11       1        2048     N  BA    informix datadbs3
48ab7928         12       0x1        12       1        2048     N  BA    informix datadbs4
48ab7b68         13       0x1        13       1        2048     N  BA    informix datadbs5
 13 active, 2047 maximum

Note: For BLOB chunks, the number of free pages shown is out of date.
      Run 'onstat -d update' for current stats.

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
47481268         1      1      0          1024000    1010153               PO-B-D /home/informix/dbs/rootdbs
48ab9028         2      2      0          1024000    47                    PO-B-D /home/informix/dbs/llogdbs
48aba028         3      3      0          1024000    2                     PO-B-D /home/informix/dbs/plogdbs
48abb028         4      4      0          64000      63947                 PO-B-- /home/informix/dbs/tempdbs1
48abc028         5      5      0          64000      63947                 PO-B-- /home/informix/dbs/tempdbs2
48abd028         6      6      0          64000      63947                 PO-B-- /home/informix/dbs/tempdbs3
48abe028         7      7      0          512000    ~127872     128000     POBB-D /home/informix/dbs/bindbs1
48abf028         8      8      0          512000     477454     477465     POSB-D /home/informix/dbs/sbdbs1
                                 Metadata 34482      25659      34482   
48ac0028         9      9      0          1024000    1019161               PO-B-D /home/informix/dbs/datadbs1-1
48ac1028         10     10     0          1024000    1023947               PO-B-D /home/informix/dbs/datadbs2-1
48ac2028         11     11     0          1024000    1023947               PO-B-D /home/informix/dbs/datadbs3-1
48ac3028         12     12     0          1024000    1023947               PO-B-D /home/informix/dbs/datadbs4-1
48ac4028         13     13     0          1024000    1023947               PO-B-D /home/informix/dbs/datadbs5-1
 13 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.

Expanded chunk capacity mode: always

[informix@vm84145 ~]$

根据Dbspaces部分的name列中的datadbs1,得到datadbs1的编号(number)为9。

address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
......
48ab7268         9        0x1        9        1        2048     N  BA    informix datadbs1

进入目录,删除文件。

[informix@vm84145 dbs]$ cd /home/informix/dbs/
[informix@vm84145 dbs]$ ll
total 19968000
-rw-rw---- 1 informix informix 1048576000 Feb 14 23:49 bindbs1
-rw-rw---- 1 informix informix 2097152000 Feb 24 19:28 datadbs1-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs2-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs3-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs4-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs5-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:03 llogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:03 plogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:03 rootdbs
-rw-rw---- 1 informix informix 1048576000 Feb 18 19:53 sbdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 21:13 tempdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 21:13 tempdbs2
-rw-rw---- 1 informix informix  524288000 Feb 24 20:13 tempdbs3
[informix@vm84145 dbs]$ rm -rf datadbs1-1
[informix@vm84145 dbs]$ ll
total 17920000
-rw-rw---- 1 informix informix 1048576000 Feb 14 23:49 bindbs1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs2-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs3-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs4-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs5-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:08 llogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:08 plogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:08 rootdbs
-rw-rw---- 1 informix informix 1048576000 Feb 18 19:53 sbdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 21:13 tempdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 21:13 tempdbs2
-rw-rw---- 1 informix informix  524288000 Feb 24 20:13 tempdbs3
[informix@vm84145 dbs]$

删除数据空间文件成功。

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

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

[informix@vm84145 ~]$ dbaccess tapedb -

Database selected.

> 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.

>

虽然删除了文件,但数据库在短时间内还可以工作。

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

为了演示效果,我们重启一下数据库。

[informix@vm84145 ~]$ onmode -ky
[informix@vm84145 ~]$ oninit -vy
Reading configuration file '/home/informix/sinodb/etc/onconfig.sinodb'...succeeded
Creating /INFORMIXTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 22166 kbytes...succeeded
Creating infos file "/home/informix/sinodb/etc/.infos.sinodb"...succeeded
Linking conf file "/home/informix/sinodb/etc/.conf.sinodb"...succeeded
Initializing rhead structure...rhlock_t 32768 (1024K)... rlock_t (13281K)... Writing to infos file...succeeded
Initialization of Encryption...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Initializing encryption-at-rest if necessary...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 '/home/informix/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 VP cache drain thread...succeeded
Creating limits manager thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5
[informix@vm84145 ~]$

在数据库启动时报错,信息:Cannot open chunk ‘/home/informix/dbs/datadbs1-1’. errno = 2。
因为这个文件被删除,所以SinoDB找不到这个文件了。

步骤16:备份逻辑日志。

当出现灾难时,我们需要保护好数据库的逻辑日志。
我们先尝试进行一次逻辑日志的备份。

ontape -a

执行逻辑日志备份时,发现数据库处于Blocked状态,无法备份逻辑日志

[informix@vm84145 data]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Fast Recovery (CKPT REQ) -- Up 00:05:34 -- 2374324 Kbytes
Blocked:CKPT

步骤17:恢复数据库到L0

当数据库空间的文件丢失或损坏时,在进行恢复前,需要手工创建一个空文件,并设置相应权限(660)。
为丢失的数据库空间文件,创建一个同名的空文件,并设置好相应的权限。

操作演示

[informix@vm84145 dbs]$ touch /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ chmod 660 /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ ll
total 17920000
-rw-rw---- 1 informix informix 1048576000 Feb 14 23:49 bindbs1
-rw-rw---- 1 informix informix          0 Feb 24 22:24 datadbs1-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs2-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs3-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs4-1
-rw-rw---- 1 informix informix 2097152000 Feb 18 19:53 datadbs5-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:12 llogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:12 plogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:12 rootdbs
-rw-rw---- 1 informix informix 1048576000 Feb 18 19:53 sbdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 22:11 tempdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 21:13 tempdbs2
-rw-rw---- 1 informix informix  524288000 Feb 24 22:11 tempdbs3
[informix@vm84145 dbs]$

恢复数据到L0备份。

检查恢复结果

[informix@vm84145 backup]$ onmode -m
[informix@vm84145 backup]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:02:32 -- 2374324 Kbytes

[informix@vm84145 backup]$ dbaccess - -
> database tapedb;

Database selected.

> 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备份时的状态。

步骤18:恢复数据库到L1

文件准备

[informix@vm84145 dbs]$ rm -rf /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ ll
total 17920000
-rw-rw---- 1 informix informix 1048576000 Feb 24 22:31 bindbs1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs2-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs3-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs4-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs5-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:41 llogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:36 plogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:41 rootdbs
-rw-rw---- 1 informix informix 1048576000 Feb 24 22:31 sbdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 22:36 tempdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 22:36 tempdbs2
-rw-rw---- 1 informix informix  524288000 Feb 24 22:36 tempdbs3
[informix@vm84145 dbs]$ touch /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ chmod 660 /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ ll
total 17920000
-rw-rw---- 1 informix informix 1048576000 Feb 24 22:31 bindbs1
-rw-rw---- 1 informix informix          0 Feb 24 22:43 datadbs1-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs2-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs3-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs4-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:31 datadbs5-1
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:41 llogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:36 plogdbs
-rw-rw---- 1 informix informix 2097152000 Feb 24 22:41 rootdbs
-rw-rw---- 1 informix informix 1048576000 Feb 24 22:31 sbdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 22:36 tempdbs1
-rw-rw---- 1 informix informix  524288000 Feb 24 22:36 tempdbs2
-rw-rw---- 1 informix informix  524288000 Feb 24 22:36 tempdbs3
[informix@vm84145 dbs]$

恢复数据到L1备份

[informix@vm84145 dbs]$ onmode -ky
[informix@vm84145 dbs]$ ontape -r
Restore will use level 0 archive file /home/informix/backup/vm84145_0_L0. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:14:22 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  0
Tape device:    /home/informix/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 [bindbs1                                                                                                                         ]
3 [llogdbs                                                                                                                         ]
4 [plogdbs                                                                                                                         ]
5 [datadbs1                                                                                                                        ]
6 [datadbs2                                                                                                                        ]
7 [datadbs3                                                                                                                        ]
8 [datadbs4                                                                                                                        ]
9 [datadbs5                                                                                                                        ]
10 [sbdbs1                                                                                                                          ]

Archive Information

Sinoregal SinoDB Dynamic Server Copyright 2001, 2017  Sinoregal Corporation
Initialization Time       02/14/2022 23:09:43
System Page Size          2048
Version                   29
Index Page Logging        OFF
Archive CheckPoint Time   02/23/2022 23:14:22


Dbspaces

number   flags    fchunk   nchunks  flags    owner                            name
1        30001    1        1        N   A    informix                         rootdbs                                                                                                                         
2        20001    2        1        N   A    informix                         llogdbs                                                                                                                         
3        30001    3        1        N   A    informix                         plogdbs                                                                                                                         
4        2001     4        1        N T A    informix                         tempdbs1                                                                                                                        
5        2001     5        1        N T A    informix                         tempdbs2                                                                                                                        
6        2001     6        1        N T A    informix                         tempdbs3                                                                                                                        
7        20011    7        1        N B A    informix                         bindbs1                                                                                                                         
8        28001    8        1        N S A    informix                         sbdbs1                                                                                                                          
9        20001    9        1        N   A    informix                         datadbs1                                                                                                                        
10       20001    10       1        N   A    informix                         datadbs2                                                                                                                        
11       20001    11       1        N   A    informix                         datadbs3                                                                                                                        
12       20001    12       1        N   A    informix                         datadbs4                                                                                                                        
13       20001    13       1        N   A    informix                         datadbs5                                                                                                                        


Chunks  

chk/dbs offset   size     free     bpages   flags pathname
1   1   0        1024000  1010409           PO--- /home/informix/dbs/rootdbs
2   2   0        1024000  47                PO--- /home/informix/dbs/llogdbs
3   3   0        1024000  2                 PO--- /home/informix/dbs/plogdbs
4   4   0        256000   255564            PO--- /home/informix/dbs/tempdbs1
5   5   0        256000   255788            PO--- /home/informix/dbs/tempdbs2
6   6   0        256000   255788            PO--- /home/informix/dbs/tempdbs3
7   7   0        512000            128000   POB-- /home/informix/dbs/bindbs1
8   8   0        512000   25659             POS-- /home/informix/dbs/sbdbs1
9   9   0        1024000  1019161           PO--- /home/informix/dbs/datadbs1-1
10  10  0        1024000  1023947           PO--- /home/informix/dbs/datadbs2-1
11  11  0        1024000  1023947           PO--- /home/informix/dbs/datadbs3-1
12  12  0        1024000  1023947           PO--- /home/informix/dbs/datadbs4-1
13  13  0        1024000  1023947           PO--- /home/informix/dbs/datadbs5-1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)y
No log files to salvage. Logs 7 - 8 already exists in directory /home/informix/backup/
Log salvage is complete, continuing restore of archive.
Restore a level 1 archive (y/n) y
Ready for level 1 tape
Restore will use level 1 archive file /home/informix/backup/vm84145_0_L1. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:25:03 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  1
Tape device:    /home/informix/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
Do you want to restore log tapes? (y/n)n
/home/informix/sinodb/bin/onmode -sy

Program over.
[informix@vm84145 dbs]$

检查恢复结果

[informix@vm84145 dbs]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:03:03 -- 2374324 Kbytes

[informix@vm84145 dbs]$ onmode -m
[informix@vm84145 dbs]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:03:21 -- 2374324 Kbytes

[informix@vm84145 dbs]$ dbaccess tapedb -

Database selected.

> 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         
          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备份前的数据已经恢复完成。

步骤19:恢复数据库到L2

文件准备

[informix@vm84145 dbs]$ rm -rf /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ touch /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ chmod 660 /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ ll /home/informix/dbs/datadbs1-1
-rw-rw---- 1 informix informix 0 Feb 24 22:50 /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$

恢复数据到L2备份

[informix@vm84145 dbs]$ onmode -ky
[informix@vm84145 dbs]$ ontape -r
Restore will use level 0 archive file /home/informix/backup/vm84145_0_L0. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:14:22 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  0
Tape device:    /home/informix/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 [bindbs1                                                                                                                         ]
3 [llogdbs                                                                                                                         ]
4 [plogdbs                                                                                                                         ]
5 [datadbs1                                                                                                                        ]
6 [datadbs2                                                                                                                        ]
7 [datadbs3                                                                                                                        ]
8 [datadbs4                                                                                                                        ]
9 [datadbs5                                                                                                                        ]
10 [sbdbs1                                                                                                                          ]


Archive Information

Sinoregal SinoDB Dynamic Server Copyright 2001, 2017  Sinoregal Corporation
Initialization Time       02/14/2022 23:09:43
System Page Size          2048
Version                   29
Index Page Logging        OFF
Archive CheckPoint Time   02/23/2022 23:14:22

Dbspaces

number   flags    fchunk   nchunks  flags    owner                            name
1        30001    1        1        N   A    informix                         rootdbs                                                                                                                         
2        20001    2        1        N   A    informix                         llogdbs                                                                                                                         
3        30001    3        1        N   A    informix                         plogdbs                                                                                                                         
4        2001     4        1        N T A    informix                         tempdbs1                                                                                                                        
5        2001     5        1        N T A    informix                         tempdbs2                                                                                                                        
6        2001     6        1        N T A    informix                         tempdbs3                                                                                                                        
7        20011    7        1        N B A    informix                         bindbs1                                                                                                                         
8        28001    8        1        N S A    informix                         sbdbs1                                                                                                                          
9        20001    9        1        N   A    informix                         datadbs1                                                                                                                        
10       20001    10       1        N   A    informix                         datadbs2                                                                                                                        
11       20001    11       1        N   A    informix                         datadbs3                                                                                                                        
12       20001    12       1        N   A    informix                         datadbs4                                                                                                                        
13       20001    13       1        N   A    informix                         datadbs5                                                                                                                        


Chunks

chk/dbs offset   size     free     bpages   flags pathname
1   1   0        1024000  1010409           PO--- /home/informix/dbs/rootdbs
2   2   0        1024000  47                PO--- /home/informix/dbs/llogdbs
3   3   0        1024000  2                 PO--- /home/informix/dbs/plogdbs
4   4   0        256000   255564            PO--- /home/informix/dbs/tempdbs1
5   5   0        256000   255788            PO--- /home/informix/dbs/tempdbs2
6   6   0        256000   255788            PO--- /home/informix/dbs/tempdbs3
7   7   0        512000            128000   POB-- /home/informix/dbs/bindbs1
8   8   0        512000   25659             POS-- /home/informix/dbs/sbdbs1
9   9   0        1024000  1019161           PO--- /home/informix/dbs/datadbs1-1
10  10  0        1024000  1023947           PO--- /home/informix/dbs/datadbs2-1
11  11  0        1024000  1023947           PO--- /home/informix/dbs/datadbs3-1
12  12  0        1024000  1023947           PO--- /home/informix/dbs/datadbs4-1
13  13  0        1024000  1023947           PO--- /home/informix/dbs/datadbs5-1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)y
No log files to salvage. Logs 7 - 7 already exists in directory /home/informix/backup/
Log salvage is complete, continuing restore of archive.
y

Restore a level 1 archive (y/n) Ready for level 1 tape
Restore will use level 1 archive file /home/informix/backup/vm84145_0_L1. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:25:03 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  1
Tape device:    /home/informix/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
Ready for level 2 tape
Restore will use level 2 archive file /home/informix/backup/vm84145_0_L2. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:43:13 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  2
Tape device:    /home/informix/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)n
/home/informix/sinodb/bin/onmode -sy

Program over.
[informix@vm84145 dbs]$

检查恢复结果

[informix@vm84145 dbs]$ onmode -m
[informix@vm84145 dbs]$ dbaccess tapedb -

Database selected.

> 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         
          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.
>

步骤20:完全恢复数据库

文件准备

[informix@vm84145 dbs]$ rm -rf /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ touch /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ chmod 660 /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$ ll /home/informix/dbs/datadbs1-1
-rw-rw---- 1 informix informix 0 Feb 24 22:55 /home/informix/dbs/datadbs1-1
[informix@vm84145 dbs]$

完全恢复数据库

[informix@vm84145 dbs]$ onmode -ky
[informix@vm84145 dbs]$ ontape -r
Restore will use level 0 archive file /home/informix/backup/vm84145_0_L0. Press Return to continue ...

Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:14:22 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  0
Tape device:    /home/informix/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 [bindbs1                                                                                                                         ]
3 [llogdbs                                                                                                                         ]
4 [plogdbs                                                                                                                         ]
5 [datadbs1                                                                                                                        ]
6 [datadbs2                                                                                                                        ]
7 [datadbs3                                                                                                                        ]
8 [datadbs4                                                                                                                        ]
9 [datadbs5                                                                                                                        ]
10 [sbdbs1                                                                                                                          ]

Archive Information

Sinoregal SinoDB Dynamic Server Copyright 2001, 2017  Sinoregal Corporation
Initialization Time       02/14/2022 23:09:43
System Page Size          2048
Version                   29
Index Page Logging        OFF
Archive CheckPoint Time   02/23/2022 23:14:22


Dbspaces

number   flags    fchunk   nchunks  flags    owner                            name
1        30001    1        1        N   A    informix                         rootdbs                                                                                                                         
2        20001    2        1        N   A    informix                         llogdbs                                                                                                                         
3        30001    3        1        N   A    informix                         plogdbs                                                                                                                         
4        2001     4        1        N T A    informix                         tempdbs1                                                                                                                        
5        2001     5        1        N T A    informix                         tempdbs2                                                                                                                        
6        2001     6        1        N T A    informix                         tempdbs3                                                                                                                        
7        20011    7        1        N B A    informix                         bindbs1                                                                                                                         
8        28001    8        1        N S A    informix                         sbdbs1                                                                                                                          
9        20001    9        1        N   A    informix                         datadbs1                                                                                                                        
10       20001    10       1        N   A    informix                         datadbs2                                                                                                                        
11       20001    11       1        N   A    informix                         datadbs3                                                                                                                        
12       20001    12       1        N   A    informix                         datadbs4                                                                                                                        
13       20001    13       1        N   A    informix                         datadbs5                                                                                                                        

Chunks

chk/dbs offset   size     free     bpages   flags pathname
1   1   0        1024000  1010409           PO--- /home/informix/dbs/rootdbs
2   2   0        1024000  47                PO--- /home/informix/dbs/llogdbs
3   3   0        1024000  2                 PO--- /home/informix/dbs/plogdbs
4   4   0        256000   255564            PO--- /home/informix/dbs/tempdbs1
5   5   0        256000   255788            PO--- /home/informix/dbs/tempdbs2
6   6   0        256000   255788            PO--- /home/informix/dbs/tempdbs3
7   7   0        512000            128000   POB-- /home/informix/dbs/bindbs1
8   8   0        512000   25659             POS-- /home/informix/dbs/sbdbs1
9   9   0        1024000  1019161           PO--- /home/informix/dbs/datadbs1-1
10  10  0        1024000  1023947           PO--- /home/informix/dbs/datadbs2-1
11  11  0        1024000  1023947           PO--- /home/informix/dbs/datadbs3-1
12  12  0        1024000  1023947           PO--- /home/informix/dbs/datadbs4-1
13  13  0        1024000  1023947           PO--- /home/informix/dbs/datadbs5-1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)y
No log files to salvage. Logs 7 - 7 already exists in directory /home/informix/backup/
Log salvage is complete, continuing restore of archive.

Restore a level 1 archive (y/n) Restore a level 1 archive (y/n) y
Ready for level 1 tape
Restore will use level 1 archive file /home/informix/backup/vm84145_0_L1. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:25:03 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  1
Tape device:    /home/informix/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
Ready for level 2 tape
Restore will use level 2 archive file /home/informix/backup/vm84145_0_L2. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape
Online version: Sinoregal SinoDB Dynamic Server Version 12.10.FC8
Archive date:   Wed Feb 23 23:43:13 2022
User id:        informix
Terminal id:    /dev/pts/2
Archive level:  2
Tape device:    /home/informix/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

Roll forward should start with log number 7
Restore will use log backup file /home/informix/backup/vm84145_0_Log0000000007. Press Return to continue ...

Rollforward log file /home/informix/backup/vm84145_0_Log0000000007 ...
Rollforward log file /home/informix/backup/vm84145_0_Log0000000008 ...

Program over.
[informix@vm84145 dbs]$

检查恢复结果

[informix@vm84145 dbs]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:01:26 -- 2374324 Kbytes

[informix@vm84145 dbs]$ onmode -m
[informix@vm84145 dbs]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:01:35 -- 2374324 Kbytes

[informix@vm84145 dbs]$ dbaccess tapedb -

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.

>

这次的恢复结果是正确的,在L2备份后INSERT、UPDATE和DELETE的数据都生效了。

3.附录

数据库与表(t1)

create database tapedb 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');

  更多信息内容请移步星瑞格官方社区,期待大家加入

Sinoregal Tech ForumAsk questions, share solutions, and get to know the Sinoregal community.icon-default.png?t=N7T8https://forum.sinoregal.cn/ 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/566918.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

pmp好考么?知道这些PMP一个多月拿下~

过来人想说的是PMP考试没那么难&#xff0c;学习也没那么复杂的&#xff0c;只要能好好学基础知识&#xff0c;积累实践案例&#xff0c;接着多做做题摸清题意套路&#xff0c;考试的时候就跟考科一似的。 尽管听上去描述的可能过于简单&#xff0c;但事实便是如是&#xff0c…

容器云平台运维的范围与架构设计新思潮

容器云平台运维的范围与架构设计 【导读】容器云平台有其独特的特点&#xff0c;不同于传统系统的运维。本文分享了作者对容器云平台运维范围和运维架构设计的思考与实践。 一、容器云平台运维范围 &#xff08;一&#xff09; 梳理要运维哪些内容 作为运维专家&#xff0c;…

被删除的照片和视频能找回吗?如何恢复手机删除的照片和视频?

手机里的照片和视频是我们记录生活的每一个瞬间&#xff0c;也是工作学习等场合经常用到的东西&#xff0c;一旦不慎丢失&#xff0c;将对我们造成很大损失。那么我们该如何恢复手机删除的照片和视频呢&#xff1f;通过掌握正确的恢复方法&#xff0c;能够最大程度地保护手机中…

【Leetcode笔记】501.二叉搜索树中的众数

文章目录 题目要求ACM 模式代码知识点 题目要求 给你一个含重复值的二叉搜索树&#xff08;BST&#xff09;的根节点 root &#xff0c;找出并返回 BST 中的所有 众数&#xff08;即&#xff0c;出现频率最高的元素&#xff09;。 如果树中有不止一个众数&#xff0c;可以按 …

PDF文件去除文字水印

文章目录 0、背景1、准备工作2、查看是否是文字水印3、批量去除水印 0、背景 本文主题为去除PDF文件中的水印。源文件来自这里。防止丢失&#xff0c;我在这里做个记录&#xff0c;感谢原作者的付出&#xff0c;也欢迎大家关注原作者。 1、准备工作 下载Adobe Acrobat DC软件…

GUI测试首推!TestComplete 帮助有效缩短 40-50% 测试时长!

TestComplete 是一款自动化UI测试工具&#xff0c;这款工具目前在全球范围内被广泛应用于进行桌面、移动和Web应用的自动化测试。 TestComplete 集成了一种精心设计的自动化引擎&#xff0c;可以自动记录和回放用户的操作&#xff0c;方便用户进行UI&#xff08;用户界面&…

C++ 面向对象-封装

C 是一种多范式编程语言&#xff0c;它支持面向对象编程&#xff08;OOP&#xff09;范式。面向对象编程是一种程序设计思想&#xff0c;其中程序由对象组成&#xff0c;每个对象都是一个实例&#xff0c;具有数据和相关操作。在C中&#xff0c;实现面向对象编程主要通过类和对…

Vue3、 Vue2 Diff算法比较

Vue2 Diff算法 源码位置:src/core/vdom/patch.ts 源码所在函数:updateChildren() 源码讲解: 有新旧两个节点数组:oldCh和newCh; 有下面几个变量: oldStartIdx 初始值=0 oldStartVnode 初始值=oldCh[0] oldEndIdx 初始值=oldCh.length - 1 oldEndVnode 初始值=oldCh[ol…

如何在PostgreSQL中设置定期任务(如定时备份、数据分析等),并使用pgAgent或其他方式实现

文章目录 使用pgAgent实现定期任务步骤一&#xff1a;安装pgAgent步骤二&#xff1a;配置pgAgent步骤三&#xff1a;创建和调度任务示例代码&#xff1a; 使用操作系统的任务调度功能实现定期任务步骤一&#xff1a;编写脚本步骤二&#xff1a;设置cron任务示例代码&#xff1a…

ssh日志的独立与ssh远程日志

日志相关介绍&#xff1a; 1.系统日志&#xff1a;是记录了历史事件&#xff1a;包括时间地点人物事件等。日志级别&#xff1a;事件的关键性程度&#xff0c;Loglevel。 级号消息级别说明0EMERG紧急会导致主机系统不可用的的情况1ALERT警告必须马上采取措施解决的问题2CRIT严…

vue3实现全局事件总线

1、vue3中使用全局事件总线是变化最大的。在vue2中&#xff0c;我们在new Vue中在beforeCreate钩子函数中使用vue.prototype.$busthis来创建全局事件总线。vue3中我需要借助第三方库来完成创建全局事件总线。 2、安装依赖 npm i mitt -s3、封装event-bus.js文件 import mitt …

【白菜学习问问问系列】if __name__ == ‘__main__‘:怎么理解

可以让.py文件既可以当成一个模块调用&#xff0c;也可以单独的作为一个函数执行

【基础算法】双指针

1.移动零 移动零 思路&#xff1a; 利用双指针算法 cur&#xff1a;从左往右扫描数组&#xff0c;遍历数组 dest&#xff1a;处理好的区间包括dest dest初始化为-1&#xff0c;因为刚开始dest前应该没有非零元素。 即将非零元素移到dest之前即可 class Solution { public…

2016年新华三杯复赛实验试题

2016年新华三杯复赛实验试题 拓扑图 配置需求 考生根据以下配置需求在 HCL 中的设备上进行相关配置。 以太网接口配置 将 S1、S2 的以太网接口 G1/0/1 至 G1/0/16 的模式用命令 combo enable copper 激活为电口。 虚拟局域网 为了减少广播&#xff0c;需要规划并配置 VLA…

浏览器工作原理与实践--HTTPS:浏览器如何验证数字证书

你好&#xff0c;我是李兵。 在《HTTPS&#xff1a;让数据传输更安全》这篇文章中&#xff0c;我们聊了下面几个问题&#xff1a; HTTPS使用了对称和非对称的混合加密方式&#xff0c;这解决了数据传输安全的问题&#xff1b; HTTPS引入了中间机构CA&#xff0c;CA通过给服务器…

重生奇迹mu卷轴有什么用

问题一&#xff1a;重生奇迹mu里面的国王卷轴有什么用啊?创造宝石怎么用啊?国王卷不晓得~~宝石用来创造果实的。&#xff08;属性果实&#xff09; 问题二&#xff1a;请问重生奇迹mu里国王卷轴去哪弄&#xff1f;天空之城有&#xff0c;废墟1和2也有&#xff0c;遗址230也有…

付费SSL证书比免费SSL证书好在哪?

1. 身份证明更权威&#xff1a;付费证书可进行深度身份验证&#xff0c;让访客知道你的网站是真实、合法的公司运营&#xff0c;尤其高级证书能在浏览器地址栏显示公司名&#xff0c;让人一看就放心。 2. 适用范围广&#xff1a;有单域名、多域名、通配符等多种证书类型&#x…

基于SpringBoot的“幼儿园管理系统”的设计与实现(源码+数据库+文档+PPT)

基于SpringBoot的“幼儿园管理系统”的设计与实现&#xff08;源码数据库文档PPT) 开发语言&#xff1a;Java 数据库&#xff1a;MySQL 技术&#xff1a;SpringBoot 工具&#xff1a;IDEA/Ecilpse、Navicat、Maven 系统展示 系统功能结构图 个人信息界面图 缴费信息管理界…

重温javascript --(一)值的介绍

值的介绍 一、 值类型&#xff1a; 原始值 stack栈: 遵循后进先出原则&#xff0c;中主要存放一些基本类型的变量和对象的引用。如&#xff1a;Number String Boolean undefined null symbol BigInt 栈内不可修改值&#xff0c;内存满才会实现二次值覆盖 引用值 heap堆&#x…

C盘满了如何清理

1.更改位置 &#xff08;1&#xff09;找到要更改的用户 &#xff08;2&#xff09;找到要更改的部分&#xff0c;右键点击“属性” &#xff08;3&#xff09;选择“位置”——“移动”——选择要移动的盘及地方 点击“确定”——“是”&#xff0c;等待迁移完成