更新
This commit is contained in:
@ -1,8 +1,24 @@
|
||||
```shell
|
||||
-A method:设置认证方式,比如method的值可以是peer、ident、md5、trust等值
|
||||
--auth-host=method:这个选项用来设置远程主机连接的认证方法
|
||||
--auth-local=method:这个选项用来设置本地主机连接的认证方法
|
||||
-E encoding:设置服务器端的编码方式
|
||||
-U user :设置服务器的超级用户
|
||||
--pwfile=filename:设置超级用户的密码文件,从filename文件中的第一行读取,一般用于设置比较复杂的密码,或者用于自动化处理。
|
||||
-W :后面不带任何数值,表示在初始化时手动输入密码。
|
||||
-D/--pgdata:这个用来设置存放PostgreSQL数据库文件和配置文件所在目录。
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```shell
|
||||
#改密码
|
||||
\password
|
||||
```
|
||||
|
||||
|
||||
|
||||
```sh
|
||||
PGSETUP_INITDB_OPTIONS="-E UTF-8 -D 数据路径" /usr/edb/as12/bin/edb-as-12-setup initdb
|
||||
|
@ -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;
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user