エクスポート/インポート

create directory ORA_DIR as '/home/oracle';
grant all on directory ORA_DIR to public;

expdp test/test directory=ORA_DIR dumpfile=tab1.dmp logfile=tab1.exp.log tables=tab1

drop table tab1 purge;

impdp test/test directory=ORA_DIR dumpfile=tab1.dmp logfile=tab1.imp.log tables=tab1

select * from tab1;

 

vim /etc/my.cnf

secure_file_priv="/tmp"

show variables like 'secure_file_priv';


--エクスポート
select * into outfile '/tmp/exp01.dat'
fields terminated by ',' optionally enclosed by '"'
from tab2;

select * into outfile '/tmp/exp02.dat'
from tab2;

mysqldump --tab=/tmp -u root -p test tab10

 


--インポート
--サーバから実施
load data infile '/tmp/exp01.dat' into table tab2
fields terminated by ',' optionally enclosed by '"'
;

load data infile '/tmp/exp01.dat' ignore into table tab2
fields terminated by ',' optionally enclosed by '"'
;

mysql test < tab10.sql


mysqlimport -u root -p test /tmp/tab10.txt

--クライアントから実施
load data local infile '/tmp/exp02.dat' into table tab2
fields terminated by ',' optionally enclosed by '"'
;

 

create table tab10 (col1 int,col2 varchar(10));
insert into tab10 values(1,'test');
insert into tab10 values(2,'hoge');
select * from tab10;


--エクスポート
COPY tab10 TO '/tmp/tab10.csv' WITH CSV NULL AS '';


--インポート
--サーバから実施
COPY tab10 from '/tmp/tab10.csv' WITH CSV NULL AS '';


--クライアントから実施
\COPY tab10 from '/tmp/tab10.csv' WITH CSV NULL AS '';

 

--エクスポート

bcp test.dbo.tab2 out "E:\dmp\tab2.txt" -T -c -t,


--インポート

bcp test.dbo.tab2 in "E:\dmp\tab2.txt" -T -c -t,


--BULK INSERT
BULK INSERT tab1 from 'c:\import.txt' with ( FIELDTERMINATOR = ',' )