基于ontape的备份与恢复实验

news2024/11/23 21:39:31

        通过本文的备份恢复实验,我们可以深入了解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/ 

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

电商巨头亚马逊公布新算法!或将颠覆跨境选品风向…

亚马逊每一次算法的变动&#xff0c;都会牵扯到无数卖家的利益。电商巨头亚马逊发布了一则报告&#xff0c;正式公布了一个名为“COSMO”的新算法。该算法全称为“亚马逊大型电商常识知识生成与服务系统”&#xff0c;顾名思义&#xff0c;就是利用大量语言模型训练机器&#x…

DSP系统的设计过程与选型

DSP的设计步骤分几个阶段&#xff0c;应用系统的设计过程如图所示。 技术指标的确定 器件的选型原则 其他因素的考虑

谈谈mysql中的各个关键字

1.为什么学习mysql mysql是当今最主流且开放源码的关系型数据库&#xff0c;开发者为瑞典 MySQL AB 公司。目前 MySQL 被广泛地应用在 Internet 上的中小型网站中。由于其体积小、速度快、总体拥有成本低&#xff0c;尤其是开放源码这一特点&#xff0c;许多中小型网站为了降低…

第G8周:ACGAN任务

&#x1f368; 本文为&#x1f517;365天深度学习训练营 中的学习记录博客&#x1f356; 原作者&#xff1a;K同学啊 | 接辅导、项目定制&#x1f680; 文章来源&#xff1a;K同学的学习圈子 参考论文 这周主要任务就是根据之前GAN&#xff0c;CGAN&#xff0c;SGAN网络架构搭建…

OpenStack云计算(十一)——OpenStack网络管理,验证OpenStack网络资源模型,验证来巩固和加深对OpenStack网络资源模型的理解

项目实训一 【实训题目】 验证OpenStack网络资源模型 【实训目的】 通过验证来巩固和加深对OpenStack网络资源模型的理解。 【实训准备】 &#xff08;1&#xff09;复习Neutron网络资源模型。 &#xff08;2&#xff09;重点理解网络、子网、端口和路由器的概念。 【实…

使用LLM-API开发应用-DataWhale笔记

调用API 先使用一个例子 from openai import OpenAI ​ client OpenAI(# This is the default and can be omittedapi_keyos.environ.get("OPENAI_API_KEY"), //这个在环境env中 ) ​ completion client.chat.completions.create(# 调用模型&#xff1a;ChatGPT-…

科研基础与工具(论文写作)

免责申明&#xff1a; 本文内容只是学习笔记&#xff0c;不代表个人观点&#xff0c;希望各位看官自行甄别 参考文献 科研基础与工具&#xff08;YouTube&#xff09; 学术写作句型 Academic Phrase bank 曼彻斯特大学维护的一个网站 写论文的时候&#xff0c;不不知道怎么…

vue快速入门(四十一)组件通信-依赖注入

注释很详细&#xff0c;直接上代码 上一篇 新增内容 祖先组件向下传值子代组件接受数据 源码 App.vue <template><div id"app"><sonComponent></sonComponent></div> </template> <script> import sonComponent from &qu…

广东海洋大学成功部署(泰迪智能科技)大数据人工智能实验室建设

广东海洋大学简称广东海大&#xff0c;坐落于广东省湛江市&#xff0c;是国家海洋局与广东省人民政府共建的省属重点建设大学、广东省高水平大学重点学科建设高校、粤港澳高校联盟成员 &#xff0c;入选卓越农林人才教育培养计划&#xff0c;是教育部本科教学水平评估优秀院校。…

隋总分享的Temu蓝海项目究竟能不能做?

在当前的互联网经济大潮中&#xff0c;跨境电商作为一个新兴的商业模式&#xff0c;吸引了众多创业者和投资者的目光。其中&#xff0c;Temu作为拼多多旗下的跨境电商平台&#xff0c;凭借其独特的模式和强大的背景&#xff0c;成为了不少人心中的蓝海项目。近日&#xff0c;网…

java中线程的生命周期和线程安全

目录 生命周期 线程安全 生命周期 在Java中&#xff0c;线程的生命周期可以分为以下几个状态&#xff1a; 新建状态&#xff08;New&#xff09;&#xff1a; 当线程对象被创建后&#xff0c;它就处于新建状态。此时线程对象已经在内存中了&#xff0c;但是还没有开始执行。…

提升效率与质量:钣金加工行业设备数据采集的重要性

钣金加工作为制造业的重要一环&#xff0c;在现代工业中扮演着举足轻重的角色。随着市场竞争的日益激烈&#xff0c;钣金加工企业必须不断提升生产效率和产品质量&#xff0c;以应对市场的挑战。在这一背景下&#xff0c;设备数据采集变得尤为重要&#xff0c;因为它可以帮助企…

Dapp智能合约开发搭建

随着区块链技术的飞速发展&#xff0c;去中心化应用&#xff08;Dapp&#xff09;逐渐崭露头角&#xff0c;成为金融科技领域的一股新势力。而在Dapp中&#xff0c;智能合约发挥着不可或缺的作用。本文将从专业角度深入探讨Dapp智能合约的概念、优势、挑战以及未来发展趋势&…

Service: Amazon S3; Status Code: 403; Error Code: AccessDenied

1、使用minio报错 Access Denied. (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 17C8C89ED481E74E; S3 Extended Request ID: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8; Proxy: null) 2、将Access Policy值改为…

Bentley二次开发教程17-文件及模型管理-模拟输入调用命令

对于目前使用C#在Addin框架编程来说&#xff0c;对于某些方法可能封装的并不是十分完全&#xff0c;或者说目前的MicroStation软件中的原生功能可以完美的实现业务需求&#xff0c;但是需要对其进行参数化&#xff0c;自动化并进行重复工作&#xff0c;那么模拟输入调用命令的方…

Redis入门到通关之Redis实现Session共享

文章目录 ☃️前期概要☃️基于Session实现登录方案☃️现有方案存在的问题☃️Redis代替Session的业务流程❄️❄️设计key的结构❄️❄️设计key的具体细节❄️❄️整体访问流程 欢迎来到 请回答1024 的博客 &#x1f353;&#x1f353;&#x1f353;欢迎来到 请回答1024的博…

CSS基础:width,height尺寸属性详解

你好&#xff0c;我是云桃桃。 一个希望帮助更多朋友快速入门 WEB 前端的程序媛。云桃桃&#xff0c;大专生&#xff0c;一枚程序媛&#xff0c;感谢关注。回复 “前端基础题”&#xff0c;可免费获得前端基础 100 题汇总&#xff0c;回复 “前端工具”&#xff0c;可获取 Web…

C++中的stack(容器适配器)

目录 一、成员函数 一、构造函数 二、入栈 三、出栈 四、判空 empty () 五、栈大小 size 六、取栈顶元素 top 七、入栈 emplace 八、交换函数 swap 二、非成员函数重载 一、关系运算符重载 二、交换函数 C中的stack不再是容器&#xff0c;而是容器适配器 注意&a…

详解汽车充电桩主板的硬件设计与软件系统

随着电动汽车时代的到来&#xff0c;充电桩逐渐成为城市新地标。而在每一个充电桩的核心&#xff0c;隐藏着一颗强大的“心脏”——充电桩主板。 充电桩主板是充电桩的核心部件&#xff0c;决定着充电桩的充电效率、安全和用户体验。今天&#xff0c;我们将深入探索汽车充电桩主…

ubuntu18.04安装F4PGA教程

环境搭建教程&#xff1a; f4pga-arch-defs/xilinx/xc7 at main f4pga/f4pga-arch-defs GitHub git clone https://github.com/SymbiFlow/f4pga-arch-defs.git cd f4pga-arch-defs make env cd build 主要是make env&#xff0c;会下载很多东西&#xff0c;然后生成很多描…