root@modb:~#
root@modb:~# su - omm
omm@modb:~$ gsql -r
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:03:52 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# create database ww;
CREATE DATABASE
omm=# \c ww;
omm@modb:~$
omm@modb:~$
omm@modb:~$ gsql -r
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:03:52 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# create database backup;
CREATE DATABASE
omm=# \c backup;
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "backup" as user "omm".
backup=# \ds
backup=# No relations found.
backup=# \du
List of roles
Role name | Attributes
| Member of
-----------+------------------------------------------------------------------------------------------------------------------
+-----------
gaussdb | Sysadmin
| {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyadmin, UseFT
| {}
backup=# \dn
cstore | omm
dbe_perf | omm
pkg_service | omm
public | omm
snapshot | omm
(5 rows)
omm@modb:~$ gsql -r
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:03:52 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
omm | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
(4 rows)
omm=# create database backup;
CREATE DATABASE
omm=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
backup | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
omm | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
(5 rows)
omm=# \c backup;
backup=# Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "backup" as user "omm".
backup=# \dn
List of schemas
Name | Owner
-------------+-------
cstore | omm
pkg_service | omm
public | omm
snapshot | omm
(5 rows)
backup=# dbe_perf | omm
create schema ds;
CREATE SCHEMA
backup=# \dn
List of schemas
Name | Owner
-------------+-------
cstore | omm
dbe_perf | omm
ds | omm
pkg_service | omm
public | omm
snapshot | omm
(6 rows)
backup=# create table ds.t1(id int,name char(30));
CREATE TABLE
backup=# insert into ds.t1 values(1,'xxxx');
INSERT 0 1
backup=# CREATE TABLE customer_t
backup-# ( c_customer_sk integer,
backup(# c_customer_id char(5),
backup(# c_first_name char(6),
backup(# c_last_name char(8)
backup(# ) ;
CREATE TABLE
backup=# INSERT INTO customer_t VALUES
backup-# backup-# (6885, 1, 'Joes', 'Hunter'),
(4321, 2, 'Lily','Carter'),
backup-# (9527, 3, 'James', 'Cook'),
backup-# (9500, 4, 'Lucy', 'Baker');
INSERT 0 4
backup=# \d
List of relations
Schema | Name | Type | Owner | Storage
--------+------------+-------+-------+----------------------------------
public | customer_t | table | omm | {orientation=row,compression=no}
(1 row)
backup=# \d ds.*
Table "ds.t1"
Column | Type | Modifiers
--------+---------------+-----------
id | integer |
name | character(30) |
backup=# select * from customer_t;
c_customer_sk | c_customer_id | c_first_name | c_last_name
---------------+---------------+--------------+-------------
6885 | 1 | Joes | Hunter
4321 | 2 | Lily | Carter
9527 | 3 | James | Cook
9500 | 4 | Lucy | Baker
(4 rows)
backup=# \q
omm@modb:~$ gs
gs_basebackup gs_ctl gs_dumpall gs_guc gs_probackup gs_tar gstrace
gs_clean gs_dump gs_encrypt gs_initdb gs_restore gsql
omm@modb:~$ gs_dump -f /home/omm/backup_database_all.sql backup -F p
gs_dump[port='5432'][backup][2021-12-14 09:57:55]: The total objects number is 391.
gs_dump[port='5432'][backup][2021-12-14 09:57:55]: [100.00%] 391 objects have been dumped.
gs_dump[port='5432'][backup][2021-12-14 09:57:55]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 09:57:55]: total time: 105 ms
omm@modb:~$ cat /home/omm/backup_database_all.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: ds; Type: SCHEMA; Schema: -; Owner: omm
--
CREATE SCHEMA ds;
ALTER SCHEMA ds OWNER TO omm;
SET search_path = ds;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: t1; Type: TABLE; Schema: ds; Owner: omm; Tablespace:
--
CREATE TABLE t1 (
id integer,
name character(30)
)
WITH (orientation=row, compression=no);
ALTER TABLE ds.t1 OWNER TO omm;
SET search_path = public;
--
-- Name: customer_t; Type: TABLE; Schema: public; Owner: omm; Tablespace:
--
CREATE TABLE customer_t (
c_customer_sk integer,
c_customer_id character(5),
c_first_name character(6),
c_last_name character(8)
)
WITH (orientation=row, compression=no);
ALTER TABLE public.customer_t OWNER TO omm;
SET search_path = ds;
--
-- Data for Name: t1; Type: TABLE DATA; Schema: ds; Owner: omm
--
COPY t1 (id, name) FROM stdin;
1 xxxx
\.
;
SET search_path = public;
--
-- Data for Name: customer_t; Type: TABLE DATA; Schema: public; Owner: omm
--
COPY customer_t (c_customer_sk, c_customer_id, c_first_name, c_last_name) FROM stdin;
6885 1 Joes Hunter
4321 2 Lily Carter
9527 3 James Cook
9500 4 Lucy Baker
\.
;
--
-- Name: public; Type: ACL; Schema: -; Owner: omm
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM omm;
GRANT CREATE,USAGE ON SCHEMA public TO omm;
GRANT USAGE ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/backup_database_data.sql backup -a -F p
gs_dump[port='5432'][backup][2021-12-14 09:58:40]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 09:58:40]: total time: 85 ms
omm@modb:~$ cat /home/omm/backup_database_data.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = ds;
--
-- Data for Name: t1; Type: TABLE DATA; Schema: ds; Owner: omm
--
COPY t1 (id, name) FROM stdin;
1 xxxx
\.
;
SET search_path = public;
--
-- Data for Name: customer_t; Type: TABLE DATA; Schema: public; Owner: omm
--
COPY customer_t (c_customer_sk, c_customer_id, c_first_name, c_last_name) FROM stdin;
6885 1 Joes Hunter
4321 2 Lily Carter
9527 3 James Cook
9500 4 Lucy Baker
\.
;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/backup_database_define.sql backup -s -F p
gs_dump[port='5432'][backup][2021-12-14 09:59:18]: The total objects number is 389.
gs_dump[port='5432'][backup][2021-12-14 09:59:18]: [100.00%] 389 objects have been dumped.
gs_dump[port='5432'][backup][2021-12-14 09:59:18]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 09:59:18]: total time: 192 ms
omm@modb:~$ cat /home/omm/backup_database_define.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: ds; Type: SCHEMA; Schema: -; Owner: omm
--
CREATE SCHEMA ds;
ALTER SCHEMA ds OWNER TO omm;
SET search_path = ds;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: t1; Type: TABLE; Schema: ds; Owner: omm; Tablespace:
--
CREATE TABLE t1 (
id integer,
name character(30)
)
WITH (orientation=row, compression=no);
ALTER TABLE ds.t1 OWNER TO omm;
SET search_path = public;
--
-- Name: customer_t; Type: TABLE; Schema: public; Owner: omm; Tablespace:
--
CREATE TABLE customer_t (
c_customer_sk integer,
c_customer_id character(5),
c_first_name character(6),
c_last_name character(8)
)
WITH (orientation=row, compression=no);
ALTER TABLE public.customer_t OWNER TO omm;
--
-- Name: public; Type: ACL; Schema: -; Owner: omm
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM omm;
GRANT CREATE,USAGE ON SCHEMA public TO omm;
GRANT USAGE ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/backup_schema_all.sql backup -n ds -F p
gs_dump[port='5432'][backup][2021-12-14 10:00:26]: The total objects number is 380.
gs_dump[port='5432'][backup][2021-12-14 10:00:26]: [100.00%] 380 objects have been dumped.
gs_dump[port='5432'][backup][2021-12-14 10:00:26]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 10:00:26]: total time: 90 ms
omm@modb:~$ cat /home/omm/backup_schema_all.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: ds; Type: SCHEMA; Schema: -; Owner: omm
--
CREATE SCHEMA ds;
ALTER SCHEMA ds OWNER TO omm;
SET search_path = ds;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: t1; Type: TABLE; Schema: ds; Owner: omm; Tablespace:
--
CREATE TABLE t1 (
id integer,
name character(30)
)
WITH (orientation=row, compression=no);
ALTER TABLE ds.t1 OWNER TO omm;
--
-- Data for Name: t1; Type: TABLE DATA; Schema: ds; Owner: omm
--
COPY t1 (id, name) FROM stdin;
1 xxxx
\.
;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/backup_schema_data.sql backup -n ds -a -F p
gs_dump[port='5432'][backup][2021-12-14 10:01:08]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 10:01:08]: total time: 80 ms
omm@modb:~$ cat /home/omm/backup_schema_data.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = ds;
--
-- Data for Name: t1; Type: TABLE DATA; Schema: ds; Owner: omm
--
COPY t1 (id, name) FROM stdin;
1 xxxx
\.
;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/backup_schema_define.sql backup -n ds -s -F p
gs_dump[port='5432'][backup][2021-12-14 10:01:42]: The total objects number is 379.
gs_dump[port='5432'][backup][2021-12-14 10:01:42]: [100.00%] 379 objects have been dumped.
gs_dump[port='5432'][backup][2021-12-14 10:01:42]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 10:01:42]: total time: 184 ms
omm@modb:~$ cat /home/omm/backup_schema_define.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: ds; Type: SCHEMA; Schema: -; Owner: omm
--
CREATE SCHEMA ds;
ALTER SCHEMA ds OWNER TO omm;
SET search_path = ds;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: t1; Type: TABLE; Schema: ds; Owner: omm; Tablespace:
--
CREATE TABLE t1 (
id integer,
name character(30)
)
WITH (orientation=row, compression=no);
ALTER TABLE ds.t1 OWNER TO omm;
--
-- PostgreSQL database dump complete
--
omm@modb:~$
omm@modb:~$ gs_dump -f /home/omm/backup_table_all.sql backup -t customer_t -F p
gs_dump[port='5432'][backup][2021-12-14 10:02:33]: The total objects number is 379.
gs_dump[port='5432'][backup][2021-12-14 10:02:33]: [100.00%] 379 objects have been dumped.
gs_dump[port='5432'][backup][2021-12-14 10:02:33]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 10:02:33]: total time: 73 ms
omm@modb:~$ cat /home/omm/backup_table_all.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: customer_t; Type: TABLE; Schema: public; Owner: omm; Tablespace:
--
CREATE TABLE customer_t (
c_customer_sk integer,
c_customer_id character(5),
c_first_name character(6),
c_last_name character(8)
)
WITH (orientation=row, compression=no);
ALTER TABLE public.customer_t OWNER TO omm;
--
-- Data for Name: customer_t; Type: TABLE DATA; Schema: public; Owner: omm
--
COPY customer_t (c_customer_sk, c_customer_id, c_first_name, c_last_name) FROM stdin;
6885 1 Joes Hunter
4321 2 Lily Carter
9527 3 James Cook
9500 4 Lucy Baker
\.
;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/backup_table_data.sql backup -t customer_t -a -F p
gs_dump[port='5432'][backup][2021-12-14 10:03:04]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 10:03:04]: total time: 66 ms
omm@modb:~$ cat /home/omm/backup_table_data.sql
4 Lucy Baker
\.
;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public;
--
-- Data for Name: customer_t; Type: TABLE DATA; Schema: public; Owner: omm
--
COPY customer_t (c_customer_sk, c_customer_id, c_first_name, c_last_name) FROM stdin;
6885 1 Joes Hunter
4321 2 Lily Carter
9527 3 James Cook
9500 omm@modb:~$
omm@modb:~$ gs_dump -f /home/omm/backup_table_define.sql backup -t customer_t -s -F p
gs_dump[port='5432'][backup][2021-12-14 10:03:37]: The total objects number is 378.
gs_dump[port='5432'][backup][2021-12-14 10:03:37]: [100.00%] 378 objects have been dumped.
gs_dump[port='5432'][backup][2021-12-14 10:03:37]: dump database backup successfully
gs_dump[port='5432'][backup][2021-12-14 10:03:37]: total time: 170 ms
omm@modb:~$ cat /home/omm/backup_table_define.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: customer_t; Type: TABLE; Schema: public; Owner: omm; Tablespace:
--
CREATE TABLE customer_t (
c_customer_sk integer,
c_customer_id character(5),
c_first_name character(6),
c_last_name character(8)
)
WITH (orientation=row, compression=no);
ALTER TABLE public.customer_t OWNER TO omm;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ create database tpcc;
-bash: create: command not found
omm@modb:~$ gsql -r
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:03:52 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# create database tpcc;
CREATE DATABASE
omm=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
backup | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
omm | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
tpcc | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(6 rows)
omm=# \c tpcc
tpcc=# Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "tpcc" as user "omm".
tpcc=# \dn
List of schemas
Name | Owner
-------------+-------
cstore | omm
dbe_perf | omm
pkg_service | omm
public | omm
snapshot | omm
(5 rows)
tpcc=# create schema schema1;
CREATE SCHEMA
tpcc=# \dn
List of schemas
Name | Owner
-------------+-------
cstore | omm
dbe_perf | omm
pkg_service | omm
public | omm
schema1 | omm
snapshot | omm
(6 rows)
tpcc=# create table schema1.products(id int,name char(10));
CREATE TABLE
tpcc=# \d schema1.products;
Table "schema1.products"
Column | Type | Modifiers
--------+---------------+-----------
id | integer |
name | character(10) |
tpcc=# insert into schema1.products values(1,'aaaa'),(2,'bbbb'),(3,'cccc');
INSERT 0 3
tpcc=# select * from schema1.products;
id | name
----+------------
1 | aaaa
2 | bbbb
3 | cccc
(3 rows)
tpcc=# create table products(id int,name char(10));
CREATE TABLE
tpcc=# \d
List of relations
Schema | Name | Type | Owner | Storage
--------+----------+-------+-------+----------------------------------
public | products | table | omm | {orientation=row,compression=no}
(1 row)
tpcc=# insert into products select * from schema1.products;
INSERT 0 3
tpcc=# select * from products;
id | name
----+------------
1 | aaaa
2 | bbbb
3 | cccc
(3 rows)
tpcc=# \q
omm@modb:~$ gs_dump -f /home/omm/tpcc_database_all.sql tpcc -F p
gs_dump[port='5432'][tpcc][2021-12-14 10:08:50]: The total objects number is 391.
gs_dump[port='5432'][tpcc][2021-12-14 10:08:50]: [100.00%] 391 objects have been dumped.
gs_dump[port='5432'][tpcc][2021-12-14 10:08:50]: dump database tpcc successfully
gs_dump[port='5432'][tpcc][2021-12-14 10:08:50]: total time: 102 ms
omm@modb:~$ cat /home/omm/tpcc_database_all.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: schema1; Type: SCHEMA; Schema: -; Owner: omm
--
CREATE SCHEMA schema1;
ALTER SCHEMA schema1 OWNER TO omm;
SET search_path = public;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: products; Type: TABLE; Schema: public; Owner: omm; Tablespace:
--
CREATE TABLE products (
id integer,
name character(10)
)
WITH (orientation=row, compression=no);
ALTER TABLE public.products OWNER TO omm;
SET search_path = schema1;
--
-- Name: products; Type: TABLE; Schema: schema1; Owner: omm; Tablespace:
--
CREATE TABLE products (
id integer,
name character(10)
)
WITH (orientation=row, compression=no);
ALTER TABLE schema1.products OWNER TO omm;
SET search_path = public;
--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: omm
--
COPY products (id, name) FROM stdin;
1 aaaa
2 bbbb
3 cccc
\.
;
SET search_path = schema1;
--
-- Data for Name: products; Type: TABLE DATA; Schema: schema1; Owner: omm
--
COPY products (id, name) FROM stdin;
1 aaaa
2 bbbb
3 cccc
\.
;
--
-- Name: public; Type: ACL; Schema: -; Owner: omm
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM omm;
GRANT CREATE,USAGE ON SCHEMA public TO omm;
GRANT USAGE ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/tpcc_schema_define.sql tpcc -n schema1 -s -F p
gs_dump[port='5432'][tpcc][2021-12-14 10:10:28]: The total objects number is 379.
gs_dump[port='5432'][tpcc][2021-12-14 10:10:28]: [100.00%] 379 objects have been dumped.
gs_dump[port='5432'][tpcc][2021-12-14 10:10:28]: dump database tpcc successfully
gs_dump[port='5432'][tpcc][2021-12-14 10:10:28]: total time: 184 ms
omm@modb:~$ cat /home/omm/tpcc_schema_define.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: schema1; Type: SCHEMA; Schema: -; Owner: omm
--
CREATE SCHEMA schema1;
ALTER SCHEMA schema1 OWNER TO omm;
SET search_path = schema1;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: products; Type: TABLE; Schema: schema1; Owner: omm; Tablespace:
--
CREATE TABLE products (
id integer,
name character(10)
)
WITH (orientation=row, compression=no);
ALTER TABLE schema1.products OWNER TO omm;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gs_dump -f /home/omm/tpcc_database_data.sql tpcc -a -F p
gs_dump[port='5432'][tpcc][2021-12-14 10:11:28]: dump database tpcc successfully
gs_dump[port='5432'][tpcc][2021-12-14 10:11:28]: total time: 83 ms
omm@modb:~$ cat /home/omm/tpcc_database_data.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET xmloption = content;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public;
--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: omm
--
COPY products (id, name) FROM stdin;
1 aaaa
2 bbbb
3 cccc
\.
;
SET search_path = schema1;
--
-- Data for Name: products; Type: TABLE DATA; Schema: schema1; Owner: omm
--
COPY products (id, name) FROM stdin;
1 aaaa
2 bbbb
3 cccc
\.
;
--
-- PostgreSQL database dump complete
--
omm@modb:~$ gsql
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:03:52 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# \d
No relations found.
omm=# \dn
List of schemas
Name | Owner
-------------+-------
cstore | omm
dbe_perf | omm
pkg_service | omm
public | omm
snapshot | omm
(5 rows)
omm=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
(6 rows)
omm=# backup | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
omm | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
tpcc | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
omm=# \d tpcc.*
Did not find any relation named "tpcc.*".
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=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
backup | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
omm | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm +
| | | | | omm=CTc/omm
tpcc | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(6 rows)
tpcc=# \d
List of relations
Schema | Name | Type | Owner | Storage
--------+----------+-------+-------+----------------------------------
public | products | table | omm | {orientation=row,compression=no}
(1 row)
tpcc=# drop product products;
ERROR: syntax error at or near "product"
LINE 1: drop product products;
^
tpcc=# drop table products;
DROP TABLE
tpcc=# \dn
pkg_service | omm
public | omm
schema1 | omm
snapshot | omm
(6 rows)
tpcc=# List of schemas
Name | Owner
-------------+-------
cstore | omm
dbe_perf | omm
drop schema schema1;
ERROR: cannot drop schema schema1 because other objects depend on it
DETAIL: table schema1.products depends on schema schema1
HINT: Use DROP ... CASCADE to drop the dependent objects too.
tpcc=#
tpcc=# drop schema schema1 cascade;
NOTICE: drop cascades to table schema1.products
DROP SCHEMA
tpcc=# \c 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
omm=#
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




