作业:
1.创建数据库tpcc,在数据库tpcc中创建模式schema1,在模式schema1中建表products
omm=# create database tpcc;
CREATE DATABASE
omm=# \c tpcc
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "tpcc" as user "omm".
tpcc=# create schema schema1;
CREATE SCHEMA
tpcc=# create table schema1.products(id int,name char(20));
CREATE TABLE
tpcc=# insert into schema1.products values (1,'lili'),(2,'nini');
tpcc=# INSERT 0 2
2.使用gs_dump工具以文本格式导出数据库tpcc的全量数据
omm@modb:~$ gs_dump -f /home/omm/backup_db_all.sql tpcc -F p
gs_dump[port='5432'][tpcc][2021-12-16 15:08:30]: The total objects number is 389.
gs_dump[port='5432'][tpcc][2021-12-16 15:08:30]: [100.00%] 389 objects have been dumped.
gs_dump[port='5432'][tpcc][2021-12-16 15:08:30]: dump database tpcc successfully
gs_dump[port='5432'][tpcc][2021-12-16 15:08:30]: total time: 96 ms
3.使用gs_dump工具以文本格式导出模式schema1的定义
omm@modb:~$ gs_dump -f /home/omm/backup_schema.sql tpcc -n schema1 -s -F p
gs_dump[port='5432'][tpcc][2021-12-16 15:10:32]: The total objects number is 379.
gs_dump[port='5432'][tpcc][2021-12-16 15:10:32]: [100.00%] 379 objects have been dumped.
gs_dump[port='5432'][tpcc][2021-12-16 15:10:32]: dump database tpcc successfully
gs_dump[port='5432'][tpcc][2021-12-16 15:10:32]: total time: 182 ms
4.使用gs_dump工具以文本格式导出数据库tpcc的数据,不包含定义
omm@modb:~$ gs_dump -f /home/omm/backup_db_data.sql tpcc -a -F p
gs_dump[port='5432'][tpcc][2021-12-16 15:11:55]: dump database tpcc successfully
gs_dump[port='5432'][tpcc][2021-12-16 15:11:55]: total time: 79 ms
5.删除表、模式和数据库
omm=# \c tpcc
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "tpcc" as user "omm".
tpcc=# drop table schema1.products ;
DROP TABLE
tpcc=# drop schema schema1 ;
DROP SCHEMA
tpcc=# \c omm
omm=# Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "omm" as user "omm".
omm=#
drop database tpcc;
DROP DATABASE




