Trabalhar com diretórios no AWS RDS

select * from dba_directories;
select * from all_directories;
begin
rdsadmin.rdsadmin_util.create_directory(p_directory_name => 'DIRECTORY');
end;
/
grant read,write,execute on directory DIRETORIO to USUARIO;
REVOKE read,write on directory DIRETORIO FROM USUARIO;
CREATE DIRECTORY DIRECTORY AS '/rdsdbdata/userdirs/03';
select * from table
(rdsadmin.rds_file_util.listdir(p_directory => 'DIRECTORY'));
select filename from table(rdsadmin.rds_file_util.listdir(p_directory => 'DIRECTORY')) where (filename like '%.TXT' OR filename like '%.txt');
select * from table(rdsadmin.rds_file_util.read_text_file(p_directory => 'DIRECTORY', p_filename => 'FILE.txt'));
--Como DBA
select * from dba_tab_privs where type = 'DIRECTORY';

--Como usuário normal:

select * from user_tab_privs where type = 'DIRECTORY';
BEGIN
UTL_FILE.FREMOVE(p_directory_name => 'DIRECTORY', 'FILE');
END;
/
BEGIN
for i in (select filename from
table(RDSADMIN.RDS_FILE_UTIL.LISTDIR('MY_DIR')) where type='file')
loop
UTL_FILE.FREMOVE ('DIRECTORY', i.filename);
end loop;
END;
/
drop directory DIRECTORY;

--

--

--

Apaixonado por Tecnologia e Inovação, adepto da cultura DevOps, arquiteto AWS.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What the heck is Time and Space Complexity

Welcome, Protobuf!

Everything you would like to understand about Lightning Flow

Hands-On Django part-2(create app in Django project)

Pinot @ Factual

Your static site on Cloudflare Workers Site

Lesson -3: Inter-Process Communication

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gabriel Michi

Gabriel Michi

Apaixonado por Tecnologia e Inovação, adepto da cultura DevOps, arquiteto AWS.

More from Medium

Set up SSIS job run as proxy (without sysadmin)

AWS Lambda Use Cases

Invoice Processing Workflow

Cost to develop on-demand IoT App