conn /as sysdba;
create or replace directory ext as 'c:\external\'
grant read on ext to hr;
grant wrtie on ext to hr;
conn hr/hr
-- 예제 : oracle_datapump
drop table ext_employees;
create table ext_employees
organization external (
type oracle_datapump
default directory ext
location('emp.ext')
)
as
select * from employees;
-- 예제 : oracle_loader
CREATE TABLE admin_ext_employees
(employee_id NUMBER(4),
first_name VARCHAR2(20),
last_name VARCHAR2(25),
job_id VARCHAR2(10),
manager_id NUMBER(4),
hire_date DATE,
salary NUMBER(8,2),
commission_pct NUMBER(2,2),
department_id NUMBER(4),
email VARCHAR2(25)
)
ORGANIZATION EXTERNAL
(
TYPE ORACLE_LOADER
DEFAULT DIRECTORY admin_dat_dir
ACCESS PARAMETERS
(
records delimited by newline
badfile 'empxt%a_%p.bad'
logfile 'empxt%a_%p.log'
fields terminated by ','
missing field values are null
( employee_id, first_name, last_name, job_id, manager_id,
hire_date char date_format date mask "dd-mon-yyyy",
salary, commission_pct, department_id, email
)
)
LOCATION ('empxt1.dat', 'empxt2.dat')
)
PARALLEL
REJECT LIMIT UNLIMITED;
Changing the target file
SELECT * FROM ext_tab;
ALTER TABLE ext_tab LOCATION ('demo1.dat');
SELECT * FROM ext_tab;
ALTER TABLE ext_tab LOCATION ('demo1.dat', 'demo2.dat');
SELECT * FROM ext_tab;
ALTER TABLE ext_tab LOCATION ('demo2.dat');
참조 : http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2448