oracle
사례 : A사이트에 있는 blob, clob컬럼이 있는 테이블을 B사이트로 넘겨야 한다.
성공사례
b사이트에 DB link를 만들고 create table test1 as select * from 테이블;
처리 방법
1.링크를 만든다.CREATE PUBLIC DATABASE LINK linkDB
CONNECT TO aaa IDENTIFIED BY bbb
USING '서버sid';2.옮긴다.
create table demo as
select *
from info@linkDB
3.테이블을 맞게 편집한다.
rename demo to table_use
실패사례
테이블의 컬럼을 파일로 저장해서 그걸 올린다.'69.txt' : 능력껏 원 테이블의 컬럼을 파일로 만들었다.
declare
l_clob clob;
l_bbs_seq number;
l_bfile bfile;
fileExists number;
begin
DBMS_LOB.CREATETEMPORARY(l_clob,true);
dbms_output.put_line('Start');
l_bfile := BFILENAME('EXPDP','69.txt'); -- BFIEL 객체 생성
fileExists := dbms_lob.fileexists(l_bfile);
if fileExists = 1 then
-- dbms_output.put_line('length,bfile,data=>' || l_bfile);select content
into l_clob
from INFO
where bbs_seq = 69
for update nowait;dbms_lob.fileopen(l_bfile,DBMS_LOB.file_readonly); -- LOB를 OPEN 함으로써 LOB를 읽을 수 있다.
dbms_lob.loadfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile));
dbms_output.put_line('l_clob=>' || l_clob);
dbms_lob.fileclose(l_bfile); -- CLOB을 로드하고 BFILE CLOSE
commit; --단위가 크므로 저장한다.
else
dbms_output.put_line('FileNotExists 파일이름');
end if;
dbms_output.put_line('End');
end;실패내역 : 한글,영문이 깨진다
'web 개발 > DB' 카테고리의 다른 글
"ibatis" procedure out cursor 사용 (0) | 2014.08.18 |
---|---|
oracle blob 컬럼에 이미지, 파일 넣기 (2) | 2013.09.16 |
mysql 설치후 처음 로그인 (1) | 2013.06.02 |
select query로 table ddl 가져오기 (0) | 2013.03.11 |
oracle toad blob 파일로 일괄 받기 (3) | 2013.02.27 |