提交 9fde925f 编写于 作者: Y youxiangyang

高级维护部分知识点

上级 50c0d6a9
# Gbase8s中的CLOB数据迁移
Note:
- Gbase8s中可以存储大文本对象clob,最大可以支持4T
- 对于CLOB数据,不好直接导出,需要特殊的方式来处理.
导出clob数据到文件:
```sql
-- 测试表:
create table t_user1(
f_userid int,
f_username varchar(20),
f_attachment clob
) put f_attachment in (sbspace1);
-- 先导出其他字段:
unload to 'user_data/user1.txt' select f_userid, f_username, null as f_photo from t_user1;
-- 再处理clob
select lotofile(f_attachment, concat(concat('user_clob/', f_username), '.txt!'), 'client') from t_user1;
-- 导入数据
load from 'user_data/user1.txt' insert into t_user2;
-- 使用文件更新表中的clob字段
update t_user2 set f_attachment = filetoclob(concat(concat('user_clob/', f_username), '.txt'), 'client');
```
注意:在导出文件命名时,要以!进行结尾,不然GBase 8s会自动在文件名后加上后缀,以防止文件重名。
\ No newline at end of file
# 高级运维部分
数据库的备份、恢复,其实在我的工作中,用到的概率几乎为0。嗯,所以这里不再进行整理。主要参考的还是冀工的文章即可。
**参考资料:**
[基于gbaskuprestore的备份与恢复]:https://blog.csdn.net/jihui8848/article/details/121124972?spm=1001.2014.3001.5501
[基于gtape的备份和恢复]:https://blog.csdn.net/jihui8848/article/details/121006201?spm=1001.2014.3001.5501
[管理员命令]:https://blog.csdn.net/jihui8848/article/details/121124857?spm=1001.2014.3001.5501
# Gbase8s数据备份和恢复
[toc]
## gtape
note:
* 使用gtape命令进行数据的备份和恢复时,可以选择只进行物理恢复和完全恢复(物理恢复+逻辑日志恢复).
* 基于gtape的备份,无法直接使用gtape命令进行基于时间点的恢复.如果需要使用基于时间点的恢复功能,需要使用gbackuprestore命令进行数据备份.
* gtape和gbackuprestore两个命令的数据备份不兼容.
* 安装的过程中,如果备份设置的目录为空,需要提前重新设定存储目录
* 创建物理备份和逻辑备份的目录
* gadmin -wf “TAPDEV=/data/backup”
* gadmin -wf “LTAPEDEV=/data/backup”
语法:
> gtape -s -L 0
>
> -s 表示备份整个系统
>
> -L 表示备份级别
```shell
gtape -s -L 0
# 备份目录中会生成一个devsvr_1_LO的备份文件。L0表示一个0级备份。
# 执行L1备份
gtape -s -L 1
# 执行L2备份
gtape -s -L 2
# 恢复
gtape -r
```
## gbackuprestore
gbackuprestore 由各种组件组成,它需要与存储管理器一起使用,来备份和恢复数据。
gbackuprestore组件:
- sysutils 数据库,其中包含gbackuprestore目录表
- gbackuprestore 和 gbackuprestore_d 命令行实用程序
- 系统上存储管理器的 XBSA 共享库
- 用于存储备份的存储介质
- gbackuprestore活动日志
- gbackuprestore紧急引导文件
![img](%E6%95%B0%E6%8D%AE%E5%A4%87%E4%BB%BD%E5%92%8C%E6%81%A2%E5%A4%8D.assets/1.png)
GBase 8s 的gbackuprestore支持第三方的存储管理器,进行数据库的备份与恢复。GBase 8s也内置了一个存储管理器PSM(Primary Storage Manager)。
对于备份会话,gbackuprestore 从数据库服务器请求存储空间和逻辑日志的内容,并将它们传递到存储管理器。存储管理器将数据存储在存储介质上。
对于恢复会话,gbackuprestore 从存储管理器请求已备份的数据,然后在数据库服务器上恢复该数据。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册