postgre 匯出單錶和匯入

2021-09-08 20:27:39 字數 641 閱讀 9518

pg除了可以通過dump的方式匯入和匯出。如果只是匯出資料,可以直接使用copy

copy user to '/tmp/data/test.csv' with csv;

copy user(name,password) to '/tmp/data/test.csv' with csv;

copy (select * from user) to '/tmp/data/test.csv' with csv;

copy (select name,age from user) to '/tmp/data/test.csv' with csv header;

注意,遠端連線也只會匯出檔案的資料庫所在的目錄。

語法

copy 

to [ [ with ] ( option [, ...] ) ]

copy user_1 from '/tmp/data/test.csv' with csv;
語法

copy table_name [ ( column_name [, ...] ) ]

from

[ [ with ] ( option [, ...] ) ]

Xtrabackup單錶匯出和匯入

1 單錶備份 root centos7 backup innobackupex include hellodb innodb.students data mysql backup 200308 15 42 17 innobackupex starting the backup operation i...

oracle匯入匯出資料和匯出表結構

匯出乙個使用者下的所有表資料 常用的命令 exp user password instance file file.dmp rows y log log name 其中username password為匯出使用者的使用者名稱和密碼 instance為匯出的例項名 匯出乙個使用者下的表結構為sql檔...

oracle匯入匯出資料和匯出表結構

匯出乙個使用者下的所有表資料 常用的命令 exp user password instance file file.dmp rows y log log name 其中username password為匯出使用者的使用者名稱和密碼 instance為匯出的例項名 匯出乙個使用者下的表結構為sql檔...