이 게시물오라클 BLOB -
내가 우편에서 특정 파일을 추출하는 몇 가지 PL/SQL 코드를 작성하고 마지막에 PL/SQL 코드 블록을 참조하시기 바랍니다 파일에 테이블 스페이스를 효율적으로 쓰기를 취소합니다. 나는 http://technology.amis.nl/wp-content/uploads/2010/06/as_zip7.txt에있는 "as_zip"패키지를 사용하여 zip (AS_ZIP.GET_FILE_LIST
)에있는 파일 이름을 얻고 BLOB
(AS_ZIP.GET_FILE
)으로 특정 파일을 추출한 다음 UTL_FILE
을 사용하여 파일에 기록합니다.
첫 번째 질문
지금까지 내가 모니터링에서 본 것 같이 UNDO TABLESPACE
이 과정에서 기록 얻을하지 않는 것하지만 난 '경우이 ... 사실이라고 나는 다른 사람들과 함께 확인하고 싶어 파일로 쓰여지는 BLOB
으로 특정 파일의 내용을 추출하면 UNDO TABLESPACE
에 영향을 줍니까? 밖으로 덩어리를 작성의 관점에서 사업이 그들이 그렇게 우리는 항상 모든 가능한 경우에 우리의 테이블 스페이스를 줄일 방법을 모색 할 필요가 청구하고있는 데이터베이스를 사용하는 모든 메가 바이트 ...
두 번째 질문
파일에 더 효율적인 방법이 있습니까? 그럼 어떻게 했나요? 첫 번째 파일 (3.03GB에서 가장 큰 파일)은 파일 시스템에 훌륭하고 빠르게 기록하지만 이후의 각 파일은 느리고 느리게 기록됩니다.
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
편집 1 : 경우 사람이 궁금
SET SERVEROUTPUT ON
declare
zip_files as_zip.file_list;
l_file UTL_FILE.FILE_TYPE;
L_BUFFER RAW (32767);
L_AMOUNT BINARY_INTEGER := 32767;
l_pos INTEGER;
L_BLOB BLOB;
l_blob_len INTEGER;
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
ZIP_FILES := AS_ZIP.GET_FILE_LIST('MY_DIR', 'MY_FILE.zip');
for i in zip_files.first() .. zip_files.last
LOOP
FOR EXT_TABLE_REC IN (SELECT LOCATION FROM USER_EXTERNAL_LOCATIONS) LOOP
-- Check if there's a match between what's in the zip file and what the external table name is
IF (INSTR(TRIM(LOWER(ZIP_FILES(I))),TRIM(LOWER(EXT_TABLE_REC.LOCATION || '__'))) > 0) THEN
DBMS_OUTPUT.PUT_LINE('Match found on ' || ZIP_FILES(I) || ', ' || EXT_TABLE_REC.LOCATION || ' - processing...');
L_BLOB := AS_ZIP.GET_FILE('MY_DIR', 'MY_FILE.zip', zip_files(i));
-- Open the destination file. Note the third parameter "wb"
l_file := UTL_FILE.FOPEN ('MY_DIR', EXT_TABLE_REC.LOCATION, 'wb');
l_blob_len := DBMS_LOB.getlength (l_blob);
-- Read chunks of the BLOB and write them to the file until complete.
l_pos := 1;
WHILE l_pos < l_blob_len
LOOP
DBMS_LOB.READ (l_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw(l_file, l_buffer, FALSE);
l_pos := l_pos + l_amount;
END LOOP;
-- Close the file.
UTL_FILE.FCLOSE (L_FILE);
end if;
end loop;
end loop;
END;
/
내가 로그인 할 때 여기에 데이터베이스 정보를 돌아 오는거야 .... 내가 자원을 해제 또는 다르게하거나 할당해야합니까
오라클 사이트에서 찾은 정보를 기반으로 EXCEPTION WHEN OTHERS
블록을 추출했습니다. 이제 프로세스가 중단 된 것처럼 보이므로 문제가 발생한 위치가 확실하지 않은 것 같습니다 ...
이 정보가 바탕으로하는 "공식"문서를 가르쳐 주시겠습니까? 나는 그것에 대해 조금 더 읽고 싶다 ... 고마워. –
여기에 있습니다. http://docs.oracle.com/cd/E11882_01/appdev.112/e18294/adlob_tables.htm#ADLOB45279 – steve