kingbaseESV8常用ksql命令

S = 显示系统对象 

+ = 显示详细信息

\d[S+]  = 表、视图、序列

\d[S+] 名称 = 描述 表、视图、序列

\db[+] = 表空间

\du[+] = 用户   ==  \dg[S+] = 角色

\dp[+] = 对象权限

\dn[S+] = 模式

\dt[S+]= 表

\dv[S+] = 视图

\ds[S+] = 序列

\l[+] = 所有数据库

\s = 历史命令

test=# \i /aaa.sql   执行脚本

#下面命令,显示客户端ip和端口

select inet_client_addr(),inet_client_port() ;

#kingbase环境变量

export KINGBASE_HOST=127.0.0.1

export KINGBASE_PORT=54321

export KINGBASE_DATABASE=test

export KINGBASE_USER=system

#ksql执行sql

ksql test system -c 'select * from scott.aaa'

#ksql执行sql脚本

ksql -dtest -Usystem -f "/tmp/aa.sql"

#三种帮助

test=# \?

test=# \h select

[kingbase@localhost KingbaseESV8]$ ksql --help

#导入导出

test=# \copy public.aaa to aaa.txt
COPY 1
test=# \copy public.aaa to aaa.csv csv
COPY 1
test=# \copy public.aaa to aaa.dat binary
COPY 1

test=# \copy public.aaa1 from aaa.txt

test=# \copy public.aaa2 from aaa.csv csv

test=# \copy public.aaa3 from aaa.dat binary

\copy 任何用户在客户端、服务端都可用

copy 只能超级用户在服务端运行