第一天 安装
gbasedbt
GBase001
export GBASEDBTSERVER=gbaseserver
export GBASEDBTDIR=/opt/GBase8s
export GBASEDBTSQLHOSTS=$GBASEDBTDIR/etc/sqlhosts.gbaseserver
export ONCONFIG=onconfig.gbaseserver
export PATH=$GBASEDBTDIR/bin:$PATH
export GL_DATE="%m/%d/%iY"
export DATETIME="%iY-%m-%d %H:%M:%S"
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
onspaces -c -d plogdbs -p /home/gbasedbt/dbs/plogdbs -o 0 -s 1000000;
onspaces -c -d llogdbs -p /home/gbasedbt/dbs/llogdbs -o 0 -s 2000000;
onspaces -c -d tmpdbs1 -p /home/gbasedbt/dbs/tmpdbs1 -o 0 -s 1000000 -t -k 16k;
onspaces -c -S sbspace1 -p /home/gbasedbt/dbs/sbspace1 -o 0 -s 1000000;
onspaces -c -S tmpsbspace1 -t -p /home/gbasedbt/dbs/tmpsbspace1 -o 0 -s 1000000;
onspaces -c -d datadbs1 -p /home/gbasedbt/dbs/datadbs1 -o 0 -s 2000000 -k 16k;
for i in {1..20};do onparams -a -d llogdbs -s 100000;done;
onparams -p -s 999000 -d plogdbs -y;
create database testdb1 in datadbs1 with log;
create database testdb2 in datadbs1 with log;
第二天 数据装载测试
测试表准备
mkdir /home/gbasedbt/shenyanditie
cd /home/gbasedbt/shenyanditie
cat > tab.sql << EOF
drop table if exists t;
create table t(
id serial not null,
col1 datetime year to second default current year to second,
col2 char(200),
col3 varchar(200),
primary key(id)
);
drop procedure if exists insert_t;
create procedure insert_t()
define i int;
for i=1 to 6
insert into t(col2,col3) values ('aaabbb','aaaaaaa');
end for;
end procedure;
call insert_t();
EOF
dbaccess testdb1 tab.sql
echo "select * from t ;" |dbaccess testdb1
unload/load 导数
unload导出数据
mkdir /home/gbasedbt/shenyanditie/load
cd /home/gbasedbt/shenyanditie/load
dbaccess testdb1 <<!
unload to t.unl select * from t;
!
cat t.unl
load导入数据
mkdir /home/gbasedbt/shenyanditie/load
cd /home/gbasedbt/shenyanditie/load
dbaccess testdb2 -
create table t(
id serial not null,
col1 datetime year to second default current year to second,
col2 char(200),
col3 varchar(200),
primary key(id)
);
select * from t;
load from t.unl insert into t;
select * from t;
onunload/onload导数
onunload导出数据
mkdir /home/gbasedbt/shenyanditie/onload
cd /home/gbasedbt/shenyanditie/onload
touch t.onl
onunload -t t.onl -b 16 testdb1:t
onunload导入数据
mkdir /home/gbasedbt/shenyanditie/onload
cd /home/gbasedbt/shenyanditie/onload
dbaccess sysmaster <<!
create database db3 in datadbs1;
!
onload -t t.onl -b 16 -d datadbs1 db3:t2
dbaccess db3 <<!
select * from t2;
!
dbload导数
dbload导入数据
mkdir /home/gbasedbt/shenyanditie/dbload
cd /home/gbasedbt/shenyanditie/dbload
#控制文件
cat > tab.ctl << EOF
file "../load/t.unl" delimiter "|" 4;
insert into t4;
EOF
#导入数据