This commit is contained in:
2023-04-06 14:51:36 +08:00
parent badc52f2f9
commit f1bf1661a8
3 changed files with 112 additions and 38 deletions

View File

@ -483,44 +483,6 @@ psql -Uicctestedb -dicctestedb -h192.168.53.123 -f ~/
导出导出部分数据
```
COPY (select * from icc.tcn_stat
where afferent_date between to_date('20220701','yyyymmdd') and to_date('20220714','yyyymmdd') ) TO '/home/edbdata/test.csv' WITH csv;
COPY (
select * from icc.tcn_stat_sales_volume_total
where flight_date between to_date('20220701','yyyymmdd') and to_date('20221231','yyyymmdd')
) TO '/home/edbdata/tcn_stat_sales_volume_total.csv' WITH csv;
COPY tcn_stat_sales_volume_total FROM '/home/edbdata/tcn_stat_sales_volume_total.csv' WITH csv;
```
#### psql 导入导出文件
```
@ -666,3 +628,56 @@ psql -Uicctestedb -dicctestedb -h192.168.53.123 -f ~/
#### 数据导出
```shell
#导出 iccedb库
# -O 不设置表归属,
# -F c 自定义压缩
# -v 显示详情
./pg_dump -Uenterprisedb -diccedb -h192.168.53.118 -O -v -F c -f ~/diccedb_202207_29.data.sql
#导入数据
#-c 指定恢复过程中清空目标数据库中的现有表
#--strict-names 指定严格遵守输入文件中的名称规范
#~/icc_data_20220719_test.sql 指定要恢复的输入文件路径
./pg_restore -Uenterprisedb -dtest2 -h10.23.101.119 -F c -c -v --strict-names ~/icc_data_20220719_test.sql
```
#### COPY 导出导出部分数据
```sh
sudo su - enterprisedb
psql edb
```
##### 导出
```sql
COPY (select * from icc.tcn_stat
where afferent_date between to_date('20220701','yyyymmdd') and to_date('20220714','yyyymmdd') ) TO '/home/edbdata/test.csv' WITH csv;
```
##### 导入
```sql
COPY tcn_stat_sales_volume_total FROM '/home/edbdata/tcn_stat_sales_volume_total.csv' WITH csv;
```