返回首页

gbase数据、南大通用产品文档:GBase8s从 200 至 899 的错误代码

更新日期:2024年09月11日

从 -200 至 -899 的错误代码表明执行 SQL 语句产生的问题。

参数说明

-U
指定运行GBase 8c 的用户名称。以root 用户身份执行命令时,必须指定该参数。
取值范围:运行GBase 8c 的用户名称。

-o

GBase 8c 工具参考手册
南大通用数据技术股份有限公司
113
指定性能检查报告输出到指定的文件。不指定则将检查结果输出到屏幕上。
取值范围:指定的文件名称。

-i
指定检查项编号,-i 参数值不区分大小写。格式:-i PMK、-i SSD。
取值范围:PMK、SSD。

只有GBase 8c 用户才能检查PMK 选项。

只有root 用户才能检查SSD 选项。

如果不指定该参数,
以GBase 8c 用户身份默认检查PMK,
以root 用户身份默认检
查SSD。

--detail
显示PMK 检查结果详情。

-l
指定日志文件的存储路径。
默认路径为:/var/log/om/gs_checkperf-YYYY-MM-DD_hhmmss.log

-?, --help
显示帮助信息。

-V, --version
显示版本号信息。
表3-7 性能检查项
分类
性能参数项
描述
数据库级别
CPU 占用率
CPU 占用率。

GBase 8c 工具参考手册
南大通用数据技术股份有限公司
114
分类
性能参数项
描述
共享内存击中率
共享内存的击中率。
内存中排序比率
内存中完成的排序所占比率。
I/O 使用情况
文件读写次数和时间。
磁盘使用情况
文件写次数和平均写时间、最大写时间等。
事务统计
当前SQL 执行数和Session 数。
节点级别
CPU 使用情况
主机使用CPU 情况,
包括cpu busy time、
cpu
idle time 等。
内存使用情况
主机使用内存情况,包括物理内存总量、已
使用量等。
I/O 使用情况
文件读写次数和时间。
会话/进程级

CPU 使用情况
会话使用CPU 情况,
包括cpu busy time、
cpu
idle time 等。
内存使用情况
会话使用内存情况,包括物理内存总量、已
使用量等。
I/O 使用情况
会话共享缓冲区命中次数等。
SSD 性能
(只
用root 用户
才能查看)
写入性能
使用dd 命令
(flag=direct bs=8M count=2560)
向每个SSD 写入内容,
写入每个SSD 时间应
在10s 左右。
读取性能
使用dd 命令
(flag=direct bs=8M count=2560)
从每个SSD 读取内容,
读取每个SSD 时间应

GBase 8c 工具参考手册
南大通用数据技术股份有限公司
115
分类
性能参数项
描述
在7s 左右。

create_clob 演示如何对智能大对象执行下列任务:
以用户定义的存储特征来创建智能大对象。

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

将新的智能大对象插入至数据库列内。
示例的存储特征
create_clob 程序创建 advert_descr 智能大对象,其有下列用户定义的存储特征:
开启日志记录:LO_LOG
保持最后的访问时间(缺省来自 advert_descr 列):LO_KEEP_ACCESSTIME
完整性高
分配 extent 大小为 10 KB
EXEC SQL include int8;
EXEC SQL include locator;
EXEC SQL define BUFSZ 10;

extern char statement[80];

main()
{
EXEC SQL BEGIN DECLARE SECTION;
int8 catalog_num, estbytes, offset;
int error, numbytes, lofd, ic_num, buflen = 256;
char buf[256], srvr_name[256], col_name[300];
ifx_lo_create_spec_t *create_spec;
fixed binary 'clob' ifx_lo_t descr;
EXEC SQL END DECLARE SECTION;

void nullterm(char *);
void handle_lo_error(int);

EXEC SQL whenever sqlerror call whenexp_chk;
EXEC SQL whenever sqlwarning call whenexp_chk;

printf("CREATE_CLOB Sample ESQL program running.\n\n");
strcpy(statement, "CONNECT stmt");
EXEC SQL connect to 'stores7';
EXEC SQL get diagnostics exception 1
:srvr_name = server_name;
nullterm(srvr_name);

/* Allocate and initialize the LO-specification structure */
error = ifx_lo_def_create_spec(&create_spec);
if (error < 0)
{
strcpy(statement, "ifx_lo_def_create_spec()");
handle_lo_error(error);
}

/* Get the column-level storage characteristics for the
* CLOB column, advert_descr.
*/
sprintf(col_name, "stores7@%s:catalog.advert_descr",
srvr_name);
error = ifx_lo_col_info(col_name, create_spec);
if (error < 0)

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

{
strcpy(statement, "ifx_lo_col_info()");
handle_lo_error(error);
}

/* Override column-level storage characteristics for
* advert_desc with the following user-defined storage
* characteristics:
* no logging
* extent size = 10 kilobytes
*/
ifx_lo_specset_flags(create_spec,LO_LOG);
ifx_int8cvint(BUFSZ, &estbytes);
ifx_lo_specset_estbytes(create_spec, &estbytes);

/* Create an LO-specification structure for the smart large object */

if ((lofd = ifx_lo_create(create_spec, LO_RDWR,
&descr, &error)) == -1)
{
strcpy(statement, "ifx_lo_create()");
handle_lo_error(error);
}
/* Copy data into the character buffer 'buf' */

sprintf(buf, "%s %s",
"Pro model infielder's glove. Highest quality leather and
stitching. "
"Long-fingered, deep pocket, generous web.");

/* Write contents of character buffer to the open smart
* large object that lofd points to. */

ifx_int8cvint(0, &offset);
numbytes = ifx_lo_writewithseek(lofd, buf, buflen,
&offset, LO_SEEK_SET, &error);
if ( numbytes < buflen )
{
strcpy(statement, "ifx_lo_writewithseek()");
handle_lo_error(error);
}

/* Insert the smart large object into the table */
strcpy(statement, "INSERT INTO catalog");
EXEC SQL insert into catalog values (0, 1, 'HSK', 'case', ROW(NULL,
NULL),:descr);

/* Need code to find out what the catalog_num value was
* assigned to new row */
/* Close the LO file descriptor */
ifx_lo_close(lofd);

/* Select back the newly inserted value. The SELECT
* returns an LO-pointer structure, which you then use to
* open a smart large object to get an LO file descriptor.
*/
ifx_getserial8(&catalog_num);

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

strcpy(statement, "SELECT FROM catalog");
EXEC SQL select advert_descr into :descr from catalog
where catalog_num = :catalog_num;

/* Use the returned LO-pointer structure to open a smart
* large object and get an LO file descriptor.
*/
lofd = ifx_lo_open(&descr, LO_RDONLY, &error);
if (error < 0)
{
strcpy(statement, "ifx_lo_open()");
handle_lo_error(error);
}
/* Use the LO file descriptor to read the data in the
* smart large object.
*/
ifx_int8cvint(0, &offset);
strcpy(buf, "");
numbytes = ifx_lo_readwithseek(lofd, buf, buflen,
&offset, LO_SEEK_CUR, &error);
if (error || numbytes == 0)
{
strcpy(statement, "ifx_lo_readwithseek()");
handle_lo_error(error);
}
if(ifx_int8toint(&catalog_num, ⁣_num) != 0)
printf("\nifx_int8toint failed to convert catalog_num to int");
printf("\nContents of column \'descr\' for catalog_num:
%d \n\t%s\n",
ic_num, buf);
/* Close open smart large object */
ifx_lo_close(lofd);
/* Free LO-specification structure */
ifx_lo_spec_free(create_spec);
}

void handle_lo_error(error_num)
int error_num;
{
printf("%s generated error %d\n", statement, error_num);
exit(1);
}

void nullterm(str)
char *str;
{
char *end;

end = str + 256;
while(*str != ' ' && *str != '\0' && str < end)
{
++str;
}
if(str >= end)
printf("Error: end of str reached\n");
if(*str == ' ')
*str = '\0';

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

}

/* Include source code for whenexp_chk() exception-checking
* routine
*/

EXEC SQL include exp_chk.ec;
get_lo_info.ec 程序
此程序检索关于存储在 BLOB 列中的智能大对象的信息。
#include

EXEC SQL define BUFSZ 10;

extern char statement[80];

main()
{
int error, ic_num, oflags, cflags, extsz, imsize, isize, iebytes;
time_t time;
struct tm *date_time;
char col_name[300], sbspc[129];

EXEC SQL BEGIN DECLARE SECTION;
fixed binary 'blob' ifx_lo_t picture;
char srvr_name[256];
ifx_lo_create_spec_t *cspec;
ifx_lo_stat_t *stats;
ifx_int8_t size, c_num, estbytes, maxsize;
int lofd;
long atime, ctime, mtime, refcnt;
EXEC SQL END DECLARE SECTION;

void nullterm(char *);
void handle_lo_error(int);

imsize = isize = iebytes = 0;
EXEC SQL whenever sqlerror call whenexp_chk;
EXEC SQL whenever sqlwarning call whenexp_chk;

printf("GET_LO_INFO Sample ESQL program running.\n\n");
strcpy(statement, "CONNECT stmt");
EXEC SQL connect to 'stores7';
EXEC SQL get diagnostics exception 1
:srvr_name = server_name;
nullterm(srvr_name);

EXEC SQL declare ifxcursor cursor for
select catalog_num, advert.picture
into :c_num, :picture
from catalog
where advert.picture is not null;

EXEC SQL open ifxcursor;
while(1)
{
EXEC SQL fetch ifxcursor;
if (strncmp(SQLSTATE, "00", 2) != 0)

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

{
if(strncmp(SQLSTATE, "02", 2) != 0)
printf("SQLSTATE after fetch is %s\n", SQLSTATE);
break;
}
/* Use the returned LO-pointer structure to open a smart
* large object and get an LO file descriptor.
*/
lofd = ifx_lo_open(&picture, LO_RDONLY, &error);
if (error < 0)
{
strcpy(statement, "ifx_lo_open()");
handle_lo_error(error);
}
if(ifx_lo_stat(lofd, &stats) < 0)
{
printf("\nifx_lo_stat() < 0");
break;
}
if(ifx_int8toint(&c_num, ⁣_num) != 0)
ic_num = 99999;
if((ifx_lo_stat_size(stats, &size)) < 0)
isize = 0;
else
if(ifx_int8toint(&size, &isize) != 0)
{
printf("\nFailed to convert size");
isize = 0;
}
if((refcnt = ifx_lo_stat_refcnt(stats)) < 0)
refcnt = 0;
printf("\n\nCatalog number %d", ic_num);
printf("\nSize is %d, reference count is %d", isize, refcnt);

if((atime = ifx_lo_stat_atime(stats)) < 0)
printf("\nNo atime available");
else
{
time = (time_t)atime;
date_time = localtime(&time);
printf("\nTime of last access: %s", asctime(date_time));
}
if((ctime = ifx_lo_stat_ctime(stats)) < 0)
printf("\nNo ctime available");
else
{
time = (time_t)ctime;
date_time = localtime(&time);
printf("Time of last change: %s", asctime(date_time));
}

if((mtime = ifx_lo_stat_mtime_sec(stats)) < 0)
printf("\nNo mtime available");
else
{
time = (time_t)mtime;
date_time = localtime(&time);

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

printf("Time to the second of last modification: %s",
asctime(date_time));
}
if((cspec = ifx_lo_stat_cspec(stats)) == NULL)
{
printf("\nUnable to access ifx_lo_create_spec_t structure");
break;
}
oflags = ifx_lo_specget_def_open_flags(cspec);
printf("\nDefault open flags are: %d", oflags);
if(ifx_lo_specget_estbytes(cspec, &estbytes) == -1)
{
printf("\nifx_lo_specget_estbytes() failed");
break;
}
if(ifx_int8toint(&estbytes, &iebytes) != 0)
{
printf("\nFailed to convert estimated bytes");
}
printf("\nEstimated size of smart LO is: %d", iebytes);
if((extsz = ifx_lo_specget_extsz(cspec)) == -1)
{
printf("\nifx_lo_specget_extsz() failed");
break;
}
printf("\nAllocation extent size of smart LO is: %d", extsz);
if((cflags = ifx_lo_specget_flags(cspec)) == -1)
{
printf("\nifx_lo_specget_flags() failed");
break;
}
printf("\nCreate-time flags of smart LO are: %d", cflags);
if(ifx_lo_specget_maxbytes(cspec, &maxsize) == -1)
{
printf("\nifx_lo_specget_maxsize() failed");
break;
}
if(ifx_int8toint(&maxsize, &imsize) != 0)
{
printf("\nFailed to convert maximum size");
break;
}
if(imsize == -1)
printf("\nMaximum size of smart LO is: No limit");
else
printf("\nMaximum size of smart LO is: %d\n", imsize);
if(ifx_lo_specget_sbspace(cspec, sbspc, sizeof(sbspc)) == -1)
printf("\nFailed to obtain sbspace name");
else
printf("\nSbspace name is %s\n", sbspc);

}
/* Close smart large object */
ifx_lo_close(lofd);
ifx_lo_stat_free(stats);
EXEC SQL close ifxcursor;
EXEC SQL free ifxcursor;

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

}

void handle_lo_error(error_num)
int error_num;
{
printf("%s generated error %d\n", statement, error_num);
exit(1);
}

void nullterm(str)
char *str;
{
char *end;

end = str + 256;
while(*str != ' ' && *str != '\0' && str < end)
{
++str;
}
if(str >= end)
printf("Error: end of str reached\n");
if(*str == ' ')
*str = '\0';
}
/* Include source code for whenexp_chk() exception-checking
* routine
*/

EXEC SQL include exp_chk.ec;