[gbasedbt@gbase8s ~]$ dbaccess - - Your evaluation license will expire on 2025-10-10 00:00:00 ## 选择数据库 > database lucifer;
Database selected.
Elapsed time: 0.031 sec
## 创建一张测试表 > create table test(id int, name varchar2(20));
Table created.
Elapsed time: 0.002 sec
## 插入一条数据 > insert into test values (1,'lucifer');
1 row(s) inserted.
Elapsed time: 0.002 sec
## 查询测试表数据 > select * from test;
id name
1 lucifer
1 row(s) retrieved.
Elapsed time: 0.002 sec
## 删除测试表 > drop table if exists test;
Table dropped.
Elapsed time: 0.003 sec
## ctrl+d 可以命令交互模式
>
Database closed.
看起来就是一个简陋的客户端工具,命令行需要以 ; 结束,没有找到 help 帮助信息以及合理的退出命令。
非交互模式
管道模式
dbaccess 可以接收 STDIN 中的内容,做为 dbaccess 需要执行的指令:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[gbasedbt@gbase8s ~]$ echo"select trim(name) db_name from sysdatabases where name = 'lucifer';" | dbaccess sysmaster Your evaluation license will expire on 2025-10-10 00:00:00
[gbasedbt@gbase8s ~]$ cat<<-EOF>test.sql database lucifer; create table test(id int, name varchar(20)); insert into test values(1, 'lucifer'); select * from test; drop table if exists test; EOF