返回首页

gbase数据、南大通用产品文档:GBase8a表级备份

更新日期:2024年09月11日

功能说明
将GBase 8a MPP Cluster 数据库中的某个表全量备份至指定路径中。
语法格式
backup table [vcname].. level < 0 | 1 >
示例
示例1:使用命令行模式进行表级备份。
检查集群状态:
$ gcadmin
CLUSTER STATE:
ACTIVE
===========================================================
=====
|
GBASE COORDINATOR CLUSTER INFORMATION
|
===========================================================
=====
|
NodeName
|
IpAddress
| gcware | gcluster | DataState |
----------------------------------------------------------------
| coordinator1 | 172.168.83.11 |
OPEN
|
OPEN
|
0
|
----------------------------------------------------------------
| coordinator2 | 172.168.83.12 |
OPEN
|
OPEN
|
0
|

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
387
----------------------------------------------------------------
| coordinator3 | 172.168.83.13 |
OPEN
|
OPEN
|
0
|
----------------------------------------------------------------
===========================================================
|
GBASE VIRTUAL CLUSTER INFORMATION
|
===========================================================
|
VcName
| DistributionId |
comment
|
-----------------------------------------------------------
|
vc1
|
1
| comment message for vc1 |
-----------------------------------------------------------
|
vc2
|
2
| comment message for vc2 |
-----------------------------------------------------------
2 virtual cluster: vc1, vc2
3 coordinator node
0 free data node
$ gcadmin showcluster vc vc1
CLUSTER STATE:
ACTIVE
VIRTUAL CLUSTER MODE:
NORMAL
==========================================================
|
GBASE VIRTUAL CLUSTER INFORMATION
|
==========================================================
|
VcName
| DistributionId |
comment
|
----------------------------------------------------------
|
vc1
|
1
| comment message for vc1 |
----------------------------------------------------------
===========================================================
=======
|
VIRTUAL CLUSTER DATA NODE INFORMATION
|
===========================================================
=======
|NodeName|
IpAddress
|DistributionId|gnode|syncserver|DataState|
------------------------------------------------------------------
| node1
|172.168.83.11|
1
|OPEN |
OPEN
|
0
|
------------------------------------------------------------------
| node2
|172.168.83.12|
1
|OPEN |
OPEN
|
0
|
------------------------------------------------------------------
2 data node
$ gcadmin showcluster vc vc2

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
388
CLUSTER STATE:
ACTIVE
VIRTUAL CLUSTER MODE:
NORMAL
===========================================================
|
GBASE VIRTUAL CLUSTER INFORMATION
|
===========================================================
|
VcName
| DistributionId |
comment
|
-----------------------------------------------------------
|
vc2
|
2
| comment message for vc2 |
-----------------------------------------------------------
===========================================================
=======
|
VIRTUAL CLUSTER DATA NODE INFORMATION
|
===========================================================
=======
|NodeName|
IpAddress
|DistributionId|gnode|syncserver|DataState|
------------------------------------------------------------------
| node1
|172.168.83.13|
2
|OPEN |
OPEN
|
0
|
------------------------------------------------------------------
| node2
|172.168.83.14|
2
|OPEN |
OPEN
|
0
|
------------------------------------------------------------------
2 data node
使用命令行模式进行全备:
$ python $GCLUSTER_BASE/server/bin/gcrcman.py -d /home/gbase/backupT -P
gbasedba
–p ******
-e "backup table vc1.demo.t level 0"

decdiv() 函数将两个 decimal 类型值相除。

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 640 -
语法
mint decdiv(n1, n2, result) /* result = n1 / n2 */
dec_t *n1;
dec_t *n2;
dec_t *result;
n1
指向第一个运算对象的 decimal 结构的指针。
n2
指向第二个运算对象的 decimal 结构的指针。
quotient
指向包含 n1 除以 n2 的商的 decimal 结构的指针。

语法
quotient 可与 n1 或 n2 相同。

返回代码
0
操作成功。
-1200
操作导致溢出。
-1201
操作导致下溢。
-1202
操作尝试除零。

示例

demo 目录中的文件 decdiv.ec 包含下列样例程序。
/*
* decdiv.ec *

The following program divides two DECIMAL numbers and displays the result.

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 641 -
*/

#include

EXEC SQL include decimal;

char string1[] = "480";
char string2[] = "80";
char result[41];

main()
{
mint x;
dec_t num1, num2, dvd;

printf("DECDIV Sample ESQL Program running.\n\n");

if (x = deccvasc(string1, strlen(string1), &num1))
{
printf("Error %d in converting string1 to DECIMAL\n", x);
exit(1);

}
if (x = deccvasc(string2, strlen(string2), &num2))
{
printf("Error %d in converting string2 to DECIMAL\n", x);
exit(1);
}
if (x = decdiv(&num1, &num2, &dvd))
{
printf("Error %d in converting divide num1 by num2\n", x);
exit(1);
}

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 642 -
if (x = dectoasc(&dvd, result, sizeof(result), -1))
{
printf("Error %d in converting dividend to string\n", x);
exit(1);
}
result[40] = '\0';
printf("\t%s / %s = %s\n", string1, string2, result);

printf("\nDECDIV Sample Program over.\n\n");
exit(0);
}
输出
DECDIV Sample ESQL Program running.

480 / 80 = 6.0

DECDIV Sample Program over.

根据贵组织的需求,您可以负责执行以下各段中描述的定期任务。并不是所有这些任务都
适合每个安装。例如,如果您的数据库服务器每天运行 24 小时、每周运行 7 天,那么
您就不可以使数据库服务器进入脱机方式,这样数据库服务器的运行方式将不能定期更
改。
更改数据库服务器方式
数据库服务器管理员负责通过更改方式来启动和关闭数据库服务器。数据库服务器运行方
式说明了如何更改数据库服务器方式。
备份数据和逻辑日志文件
要确保能够在发生故障时恢复数据库,请经常备份存储空间和逻辑日志。您也可以使用
archecker 实用程序验证 ON-Bar 备份。
每隔多少时间备份一次存储空间将取决于更新数据的频率以及数据的重要性如何。备份调
度可以包括每周进行一次完全(0 级)备份、每天进行增量(1 级)备份以及每小时进行
2 级备份。还必须在执行管理任务(如添加数据库空间、删除逻辑日志文件或启用镜像)
后执行 0 级备份。
每个逻辑日志文件一满就立即备份该文件。可以手动或自动备份这些文件。有关使用ON-
Bar 和 ontape 的信息,请参阅《GBase 8s 备份与复原指南》。
监视活动
GBase 8s 数据库服务器的设计使您能够监视数据库服务器的每个方面。监视数据库服务
器活动提供了对于可用信息的描述、有关获取信息的指示信息以及有关使用信息的建议。
检查一致性
对数据的一致性执行不定期的检查。有关这些任务的描述,请参 阅一致性检查。