背景介绍
为了方便用户从Oracle数据库迁移到LightDB上,从LightDB24.1版本开始,支持create/drop directory命令。
使用约束:
- 该命令只在Oracle兼容模式下生效
- 不能为LTDATA目录或者子目录建立directory对象
使用示例
- 创建directory对象
lightdb@oracle_test=# create directory adir as '/home/lightdb';
create_directory
------------------
t
(1 row)
lightdb@oracle_test=# select * from utl_file.utl_file_dir;
dir | dirname
---------------+---------
/home/lightdb | ADIR
(1 row)
lightdb@oracle_test=#
- create or replace创建对象
lightdb@oracle_test=# create directory adir as '/home/lightdb';
ERROR: directory ADIR is exist
lightdb@oracle_test=# create or replace directory adir as '/home/lightdb';
create_directory
------------------
t
(1 row)
lightdb@oracle_test=# select * from utl_file.utl_file_dir;
dir | dirname
---------------+---------
/home/lightdb | ADIR
(1 row)
lightdb@oracle_test=#
- drop对象
lightdb@oracle_test=# drop directory adir;
drop_directory
----------------
t
(1 row)
lightdb@oracle_test=# select * from utl_file.utl_file_dir;
dir | dirname
-----+---------
(0 rows)
lightdb@oracle_test=#