1.对指定库进行备份还原
1.1 备份
sys_dump -Usystem -Fc -f /home/kingbase/temp/test.dmp -d TEST
1.2 还原
新建 TEST1 库
create database TEST1;
逻辑还原至 TEST1 库
sys_restore -Usystem -d TEST1 /home/kingbase/temp/test.dmp
2.对指定表进行备份还原
2.1 备份
sys_dump -Usystem -Fc -f /home/kingbase/temp/t1.dmp -t t1 -d TEST
2.2 还原
删除 t1 表 drop table t1;
逻辑还原 t1 表
sys_restore -Usystem -d test -t t1 /home/kingbase/temp/t1.dmp
3.对指定模式进行备份还原
3.1 备份
sys_dump -Usystem -Fc -f /home/kingbase/temp/schema.dmp -n systest -d TEST
3.2还原
删除 systest 模式
drop schema systest cascade;
创建模式
create schema systest;
逻辑还原 systest 模式
sys_restore -Usystem -d TEST -n systest /home/kingbase/temp/schema.dmp
4.只导出表结构
sys_dump -Usystem -d TEST -s -f /home/kingbase/backup/test.sql
tail -n 20 /home/kingbase/backup/test.sql
5.只导出数据
sys_dump -Usystem -d TEST -a -f /home/kingbase/backup/test.sql
tail -n 20 /home/kingbase/backup/test.sql
6.备份数据格式
6.1 备份为copy格式
sys_dump -U system -p55555 -Fp -t sch.tab2 -f /backup/tab2.sql db
grep COPY /backup/tab2.sql
6.2 备份为insert格式
sys_dump -U system -p55555 -Fp -t sch.tab2 -f /backup/tab2i.sql db --inserts
grep INSERT /backup/tab2i.sql