bash执行gaussdb的sql文件:sql文件可以嵌套执行sql文件。
【create.sql】注意sql文件编码为UTF8与数据库字符集相同
create table tab01(
c1 varchar2(6),
c2 number(38)
) ;
comment on table tab01 is '测试';
comment on column tab01.c1 is '字段1';
comment on column tab01.c2 is '字段2';
【main_DB.sql】
\i 'create.sql';
【setupDB_gaussdb.sh】
#!/bin/bash
gsql -d <db_name> -U <user> -W <password> -f main_DB.sql;
\q;
浙公网安备 33010602011771号