GBase 8a客户端gccli查询SQL语句历史记录位置

GBase 8a MPP集群提供了命令行客户端gccli,gncli,其将执行过的SQL语句都记录在数据库运行的操作系统用户dbaUser,一般是gbase,的主目录下,文件名是.gbase_history。

文件位置

gbase的主目录下,有2个数据库用到的点开头的文件。其中

  • .gbase_profile 记录着数据库的环境变量
  • .gbase_history 记录着通过命令将工具gccli的SQL语句执行历史,当然连接数据节点的gncli也记录在里面。
[gbase@gbase_rh7_001 ~]$ pwd
/home/gbase
[gbase@gbase_rh7_001 ~]$ ll -rta .gbase*
-rw-rw-r--. 1 gbase gbase    973 Jun 30 09:55 .gbase_profile
-rw-------. 1 gbase gbase 281162 Jun 30 09:59 .gbase_history
[gbase@gbase_rh7_001 ~]$

文件内容

[gbase@gbase_rh7_001 ~]$ tail .gbase_history
select type,(id%3) id,sum(val),count(*),grouping(type),grouping(id%3) from t2 group by cube(type,id%3);
select type,(id%3) id,sum(val),count(*),grouping(type),grouping(id%3) from t2 group by grpuping set(type,id%3);
select type,(id%3) id,sum(val),count(*),grouping(type),grouping(id%3) from t2 group by grpuping_set(type,id%3);
select type,(id%3) id,sum(val),count(*),grouping(type),grouping(id%3) from t2 group by grouping_set(type,id%3);
select type,(id%3) id,sum(val),count(*),grouping(type),grouping(id%3) from t2 group by grouping set(type,id%3);
select type,(id%3) id,sum(val),count(*),grouping(type),grouping(id%3) from t2 group by grouping sets(type,id%3);
initnodedatamap;
create database testdb;
use testdb;
create table t1(id int, name varchar(100), dept int,birth date);
[gbase@gbase_rh7_001 ~]$

使用

在gccli里,通过键盘的上下键,翻找SQL执行历史记录。

在gccli里,通过键盘的上下键,翻找SQL执行历史记录