ontape备份异机还原的样例

1. 查看实例备份参数文件

[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ onstat -g dis
Your evaluation license will expire on 2025-05-26 00:00:00
On-Line -- Up 00:00:15 -- 266536 Kbytes
There are 1 servers found
Server        : node1
Server Number : 1
Server Type   : IDS
Server Status : Up
Server Version: GBase Database Server Version 12.10.FC4G1TL
Shared Memory : 0x44000000
GBASEDBTDIR   : /home/gbasedbt/gbase
ONCONFIG      : /home/gbasedbt/gbase/etc/onconfig.node1
SQLHOSTS      : /home/gbasedbt/gbase/etc/sqlhosts.node1
Host          : iZ2ze5s78e4tanwe5q2znxZ


[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ mkdir backup1
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ chmod 777 backup1
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cp profile.node1 backup1/
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cp /home/gbasedbt/gbase/etc/onconfig.node1 backup1/
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cp /home/gbasedbt/gbase/etc/sqlhosts.node1 backup1/
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$

2. 备份数据文件

[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ onstat -d
Your evaluation license will expire on 2025-05-26 00:00:00
On-Line -- Up 00:03:44 -- 274728 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
452a5028         1        0x40001    1        2        2048     N  BA    gbasedbt rootdbs
453bd308         2        0x40001    2        1        2048     N  BA    gbasedbt llogdbs
453bd538         3        0x1040001  3        1        2048     N PBA    gbasedbt plogdbs
453bd768         4        0x40001    4        2        16384    N  BA    gbasedbt datadbs1
453bd998         5        0x42001    5        1        16384    N TBA    gbasedbt tempdbs1
453bdbc8         6        0x40011    6        1        32768    N BBA    gbasedbt bindbs
453bddf8         7        0x48001    7        1        2048     N SBA    gbasedbt sbdbs
52c6d028         8        0x40001    8        1        16384    N  BA    gbasedbt datadbs2
 8 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
452a5258         1      1      0          100000     80711                 PO-B-- /home/gbasedbt/gbase/node1_dbs/rootdbs
52c6d258         2      2      0          1024000    123947                PO-B-- /home/gbasedbt/gbase/node1_dbs/llogdbs
52c6e028         3      3      0          1024000    0                     PO-BE- /home/gbasedbt/gbase/node1_dbs/plogdbs
52c6f028         4      4      0          128000     117249                PO-B-- /home/gbasedbt/gbase/node1_dbs/datadbs1
52c70028         5      5      0          128000     127947                PO-B-- /home/gbasedbt/gbase/node1_dbs/tempdbs1
52c71028         6      6      0          1024000   ~1          64000      POBB-- /home/gbasedbt/gbase/node1_dbs/bindbs
52c72028         7      7      0          1024000    954986     955004     POSB-- /home/gbasedbt/gbase/node1_dbs/sbdbs
                                 Metadata 68943      51302      68943
52c73028         8      8      0          18750      17539                 PO-B-- /home/gbasedbt/gbase/node1_dbs/datadbs2
52c74028         9      1      0          50000      34407                 PO-B-- /home/gbasedbt/gbase/node1_dbs/rootchk2
52c75028         10     4      0          250000     249997                PO-B-- /home/gbasedbt/gbase/node1_dbs/datadbs1_2
 10 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
--由上述可得数据文件在/home/gbasedbt/gbase/node1_dbs/,到备机需要mkdir -p /home/gbasedbt/gbase/node1_dbs/
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cd /home/gbasedbt/gbase/node1_dbs/
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ node1_dbs]$ ls -l|awk '{print "touch " $NF }'
touch 16888032
touch bindbs
touch datadbs1
touch datadbs1_2
touch datadbs2
touch llogdbs
touch plog2
touch plogdbs
touch rootchk2
touch rootdbs
touch sbdbs
touch tempdbs1
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ node1_dbs]$ ls -l|awk '{print "chmod 660 " $NF }'
chmod 660 16888032
chmod 660 bindbs
chmod 660 datadbs1
chmod 660 datadbs1_2
chmod 660 datadbs2
chmod 660 llogdbs
chmod 660 plog2
chmod 660 plogdbs
chmod 660 rootchk2
chmod 660 rootdbs
chmod 660 sbdbs
chmod 660 tempdbs1
mkdir -p /home/gbasedbt/gbase/node1_dbs/
chmod 755 /home/gbasedbt/gbase/node1_dbs/
cd /home/gbasedbt/gbase/node1_dbs/
touch bindbs
touch datadbs1
touch datadbs1_2
touch datadbs2
touch llogdbs
touch plog2
touch plogdbs
touch rootchk2
touch rootdbs
touch sbdbs
touch tempdbs1
chmod 660 bindbs
chmod 660 datadbs1
chmod 660 datadbs1_2
chmod 660 datadbs2
chmod 660 llogdbs
chmod 660 plog2
chmod 660 plogdbs
chmod 660 rootchk2
chmod 660 rootdbs
chmod 660 sbdbs
chmod 660 tempdbs1
chown -R gbasedbt:gbasedbt /home/gbasedbt/gbase/node1_dbs/

3. 进行备份

[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ ontape -s -L 0 -t backup1/
Your evaluation license will expire on 2025-05-26 00:00:00
100 percent done.
File created: backup1/iZ2ze5s78e4tanwe5q2znxZ_1_L0

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

 47

Program over.

4. 发送到异机


[root@iZ2ze5s78e4tanwe5q2znxZ ~]# scp -r /home/gbasedbt/backup1 8.140.51.164:/home/gbasedbt/
iZ2ze5s78e4tanwe5q2znxZ_1_L0                                                                                                                       100%  374MB 413.8KB/s   15:25
sqlhosts.node1                                                                                                                                     100% 2137     1.7MB/s   00:00
profile.node1                                                                                                                                      100%  411   313.6KB/s   00:00
onconfig.node1                                                                                                                                     100%   79KB 374.4KB/s   00:00

5. 备机准备文件

[root@iZ2ze4p3q6wy4hzagubdmbZ ~]# cd /home/gbasedbt/
[root@iZ2ze4p3q6wy4hzagubdmbZ gbasedbt]# chown -R gbasedbt:gbasedbt backup1/
[root@iZ2ze4p3q6wy4hzagubdmbZ gbasedbt]# ls -l
总用量 36
drwxrwxrwx  5 gbasedbt gbasedbt 4096 7月   9 18:00 backup
drwxr-xr-x  2 gbasedbt gbasedbt 4096 7月  10 20:09 backup1
-rw-rw-r--  1 gbasedbt gbasedbt 1510 7月   9 18:00 dbexport.out
drwxr-xr-x 22 gbasedbt gbasedbt 4096 7月   9 17:44 gbase
drwxrwxr-x  2 gbasedbt gbasedbt 4096 6月  24 15:24 info
drwxr-xr-x  4 gbasedbt gbasedbt 4096 7月   9 19:38 install
drwxrwxr-x  4 gbasedbt gbasedbt 4096 5月  22 14:03 jiaoben_sh
-rw-rw-r--  1 gbasedbt gbasedbt  399 6月  25 20:38 profile.HT
-rw-rw-r--  1 gbasedbt gbasedbt  325 7月   9 17:51 profile.node3
[root@iZ2ze4p3q6wy4hzagubdmbZ gbasedbt]# su - gbasedbt
上一次登录:三 7月 10 19:46:32 CST 2024pts/0 上

[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ ls -l
total 10632
drwxrwxr-x  5 gbasedbt gbasedbt    4096 Jul  3 17:44 backup
drwxrwxrwx  2 gbasedbt gbasedbt    4096 Jul 10 19:45 backup1
drwxr-xr-x 21 gbasedbt gbasedbt    4096 May 31 14:23 gbase
-rwxr-xr-x  1 gbasedbt gbasedbt 3089020 Jul  8 14:52 gbasedbt.jar
drwxr-xr-x 20 gbasedbt gbasedbt    4096 Jul  9 14:29 gbasenew
drwxr-xr-x  3 gbasedbt gbasedbt    4096 Jul  9 14:27 install
-rw-rw-r--  1 gbasedbt gbasedbt     374 Jun 25 15:07 profile.fuxiuliang_03
-rw-rw-r--  1 gbasedbt gbasedbt     411 Jul 10 19:43 profile.node1
drwxrwxr-x  2 gbasedbt gbasedbt    4096 Jul  9 10:31 sh
-rw-rw-r--  1 gbasedbt gbasedbt 7745529 Jul 10 19:33 test27.sql
-rw-rw-r--  1 gbasedbt gbasedbt    4852 Jul  8 15:16 Test.class
-rw-rw-r--  1 gbasedbt gbasedbt    4882 Jul  8 15:16 Test.java
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cp backup1/profile.node1 ./
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cat profile.node1
export GBASEDBTSERVER=node1
export KAIOON=0
export GBASEDBTDIR=/home/gbasedbt/gbase
export GBASEDBTSQLHOSTS=/home/gbasedbt/gbase/etc/sqlhosts.node1
export ONCONFIG=onconfig.node1
export PATH=/home/gbasedbt/gbase/bin:/home/gbasedbt/gbase/sbin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
alias dbaccess="rlwrap dbaccess"
export DBACCESS_SHOW_TIME=1
export PSORT_NPROCS=10
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cp backup1/onconfig.node1 /home/gbasedbt/gbase/etc/
[gbasedbt@iZ2ze5s78e4tanwe5q2znxZ ~]$ cp backup1/sqlhosts.node1 /home/gbasedbt/gbase/etc/

6. 创建数据文件

--将上述准备的数据文件命令执行
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ mkdir -p /home/gbasedbt/gbase/node1_dbs/
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ chmod 755 /home/gbasedbt/gbase/node1_dbs/
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ cd /home/gbasedbt/gbase/node1_dbs/
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch bindbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch datadbs1
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch datadbs1_2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch datadbs2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch llogdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch plog2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch plogdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch rootchk2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch rootdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch sbdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ touch tempdbs1
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 bindbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 datadbs1
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 datadbs1_2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 datadbs2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 llogdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 plog2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 plogdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 rootchk2
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 rootdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 sbdbs
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chmod 660 tempdbs1
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ node1_dbs]$ chown -R gbasedbt:gbasedbt /home/gbasedbt/gbase/node1_dbs/

7. 进行还原

--由于参数文件中的物理备份位置为/home/gbasedbt/backup/phy,所以需要建立文件夹并给予权限
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ mkdir -p backup/phy
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ chmod 777 backup
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ cd backup1/
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ backup1]$ mv iZ2ze5s78e4tanwe5q2znxZ_1_L0 ../backup/phy/
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ backup1]$ cd
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ ontape -r
Your evaluation license will expire on 2025-06-24 00:00:00
Restore will use level 0 archive file /home/gbasedbt/backup/phy/iZ2ze4p3q6wy4hzagubdmbZ_1_L0. Press Return to continue ...
^C
Interrupt received ...
--上述报错提示备份的文件名称不准确,于是进行了更改
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ cd backup/phy/
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ phy]$ ls -l
总用量 383108
-rw-r----- 1 gbasedbt gbasedbt 392298496 7月  10 20:09 iZ2ze5s78e4tanwe5q2znxZ_1_L0
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ phy]$ cp -rf iZ2ze5s78e4tanwe5q2znxZ_1_L0 iZ2ze4p3q6wy4hzagubdmbZ_1_L0
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ ontape -r
Your evaluation license will expire on 2025-06-24 00:00:00
--下面需要回车
Restore will use level 0 archive file /home/gbasedbt/backup/phy/iZ2ze4p3q6wy4hzagubdmbZ_1_L0. Press Return to continue ...


Archive Tape Information

Tape type:      Archive Backup Tape
Online version: GBase Database Server Version 12.10.FC4G1TL
Archive date:   Wed Jul 10 19:45:36 2024
User id:        gbasedbt
Terminal id:    /dev/pts/0
Archive level:  0
Tape device:    backup1/
Tape blocksize (in k): 32
Tape size (in k): system defined for directory
Tape number in series: 1

Spaces to restore:1 [rootdbs                                                                                                                         ]
2 [bindbs                                                                                                                          ]
3 [llogdbs                                                                                                                         ]
4 [plogdbs                                                                                                                         ]
5 [datadbs1                                                                                                                        ]
6 [datadbs2                                                                                                                        ]
7 [sbdbs                                                                                                                           ]

Archive Information

GBase Database Server Copyright 2001, 2023  General Data Corporation
Initialization Time       05/31/2024 14:23:38
System Page Size          2048
Version                   33
Index Page Logging        OFF
Archive CheckPoint Time   07/10/2024 19:45:36

Dbspaces
number   flags    fchunk   nchunks  flags    owner                            name
1        40001    1        2        N  BA    gbasedbt                         rootdbs                                                                                                
2        40001    2        1        N  BA    gbasedbt                         llogdbs                                                                                                
3        1040001  3        1        N PBA    gbasedbt                         plogdbs                                                                                                
4        40001    4        2        N  BA    gbasedbt                         datadbs1                                                                                               
5        42001    5        1        N TBA    gbasedbt                         tempdbs1                                                                                               
6        40011    6        1        N BBA    gbasedbt                         bindbs                                                                                                 
7        48001    7        1        N SBA    gbasedbt                         sbdbs                                                                                                  
8        40001    8        1        N  BA    gbasedbt                         datadbs2                                                                                               


Chunks
chk/dbs offset   size     free     bpages   flags pathname
1   1   0        100000   80711             PO-B- /home/gbasedbt/gbase/node1_dbs/rootdbs
2   2   0        1024000  123947            PO-B- /home/gbasedbt/gbase/node1_dbs/llogdbs
3   3   0        1024000  0                 PO-BE /home/gbasedbt/gbase/node1_dbs/plogdbs
4   4   0        1024000  937992            PO-B- /home/gbasedbt/gbase/node1_dbs/datadbs1
5   5   0        1024000  1023576           PO-B- /home/gbasedbt/gbase/node1_dbs/tempdbs1
6   6   0        1024000           64000    POBB- /home/gbasedbt/gbase/node1_dbs/bindbs
7   7   0        1024000  51302             POSB- /home/gbasedbt/gbase/node1_dbs/sbdbs
8   8   0        150000   140312            PO-B- /home/gbasedbt/gbase/node1_dbs/datadbs2
9   1   0        50000    34382             PO-B- /home/gbasedbt/gbase/node1_dbs/rootchk2
10  4   0        2000000  1999976           PO-B- /home/gbasedbt/gbase/node1_dbs/datadbs1_2
--确认还原,请确保有充足的磁盘空间
Continue restore? (y/n)
--是否备份此次的还原日志
Do you want to back up the logs? (y/n)n
Your evaluation license will expire on 2025-06-24 00:00:00
--是否进行1级备份还原
Restore a level 1 archive (y/n) n
--是否还原逻辑日志
Do you want to restore log tapes? (y/n)n
/home/gbasedbt/gbase/bin/onmode -sy
Your evaluation license will expire on 2025-06-24 00:00:00
--还原成功
Program over.

8. 状态查看并转换

[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ onstat -
Your evaluation license will expire on 2025-06-24 00:00:00
Quiescent -- Up 00:04:27 -- 258344 Kbytes

[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ onmode -m
Your evaluation license will expire on 2025-06-24 00:00:00
[gbasedbt@iZ2ze4p3q6wy4hzagubdmbZ ~]$ onstat -
Your evaluation license will expire on 2025-06-24 00:00:00
On-Line -- Up 00:05:14 -- 258344 Kbytes

相关推荐

  1. ontape备份还原

    2024-07-10 22:10:05       6 阅读
  2. Oracle数据泵和RMAN备份还原速度对比

    2024-07-10 22:10:05       3 阅读
  3. 数据库迁移,备份还原

    2024-07-10 22:10:05       22 阅读
  4. mysql备份还原全部数据库

    2024-07-10 22:10:05       21 阅读
  5. opencvSIFT(CPP/python)

    2024-07-10 22:10:05       38 阅读
  6. PostgreSQL备份还原数据库

    2024-07-10 22:10:05       21 阅读
  7. svnadmin备份还原

    2024-07-10 22:10:05       16 阅读
  8. gitlab 备份还原

    2024-07-10 22:10:05       7 阅读

最近更新

  1. easyExcel

    easyExcel

    2024-07-10 22:10:05      0 阅读
  2. 什么是等保测评

    2024-07-10 22:10:05       0 阅读
  3. acml可用订阅到起始位姿

    2024-07-10 22:10:05       0 阅读
  4. Windows 12 网页版

    2024-07-10 22:10:05       0 阅读
  5. 网络融合的艺术:Xcode中应用Web服务集成全指南

    2024-07-10 22:10:05       0 阅读
  6. 提示工程的技术与策略分类

    2024-07-10 22:10:05       0 阅读
  7. css font 优化

    2024-07-10 22:10:05       0 阅读
  8. 基于深度学习的金融交易

    2024-07-10 22:10:05       0 阅读
  9. MATLAB中balance函数用法

    2024-07-10 22:10:05       0 阅读
  10. 栈和队列之间有哪些区别

    2024-07-10 22:10:05       0 阅读
  11. python 爬虫技术 第04节 函数和模块

    2024-07-10 22:10:05       0 阅读

热门阅读

  1. [PaddlePaddle飞桨] PaddleSpeech语言小模型部署

    2024-07-10 22:10:05       6 阅读
  2. vivado DQS_BIAS

    2024-07-10 22:10:05       6 阅读
  3. PHP框架详解-symfony框架

    2024-07-10 22:10:05       7 阅读
  4. 深入理解UTF-8 Encoding在C#中的应用与异常处理

    2024-07-10 22:10:05       7 阅读
  5. Linux 常用命令 - mkdir【创建新目录】

    2024-07-10 22:10:05       7 阅读
  6. stm32实现IIC读写

    2024-07-10 22:10:05       5 阅读
  7. 中小企业和数智化的距离,只差一块华为IdeaHub

    2024-07-10 22:10:05       8 阅读
  8. C# —— Directory类

    2024-07-10 22:10:05       5 阅读
  9. 在Ubuntu 22.04上安装Docker最新版本

    2024-07-10 22:10:05       5 阅读