cd /oracle
touch get_uptime.sh
#!/bin/ksh
/usr/bin/uptime

chmod 777 /oracle/get_uptime.sh

create or replace directory exec_dir as ‘/oracle’;
create or replace directory load_dir  as ‘/oracle’;

drop table uptime;
CREATE TABLE uptime
(
data varchar2(255)
)
ORGANIZATION external
( TYPE oracle_loader
DEFAULT DIRECTORY load_dir
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
preprocessor exec_dir:’get_uptime.sh’
FIELDS TERMINATED BY “|” LDRTRIM
)
location (‘get_uptime.sh’)
)
/