课程作业
1.1 创建数据库tpcc
create database tpcc;
\l

1.2 在数据库tpcc中创建模式schema1,在模式schema1中建表products
\c tpcc
create schema schema1;
create table schema1.products
(
product_id integer,
product_name char(20),
category char(30)
);
insert into schema1.products values
(1601,'lamaze','toys'),(1700,'wait interface','Books'),(1666,'harry potter','toys');
select * from schema1.products;


2、使用gs_dump工具以文本格式导出数据库tpcc的全量数据
gs_dump -f /home/omm/backup_database_all.sql tpcc -F p more /home/omm/backup_database_all.sql

3、使用gs_dump工具以文本格式导出模式schema1的定义
gs_dump -f /home/omm/backup_schema_define.sql tpcc -n schema1 -s -F p more /home/omm/backup_schema_define.sql

4、使用gs_dump工具以文本格式导出数据库tpcc的数据,不包含定义
gs_dump -f /home/omm/backup_database_data.sql tpcc -a -F p more /home/omm/backup_database_data.sql

5、删除表、模式和数据库
\c tpcc
drop table schema1.products;
drop schema schema1;
\c omm
drop database tpcc;


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




