今天在学习data dump的时候遇到了directory参数,但不知道其具体的创建和使用用法。
1. Create directory让我们可以在Oracle数据库中灵活的对文件进行读写操作,极大的提高了Oracle的易用性和可扩展性。
其语法为:
CREATE [OR REPLACE] DIRECTORY directory AS 'pathname';
本案例具体创建如下:
create or replace directory exp_dir as '/tmp';
2.目录创建以后,就可以把读写权限授予特定用户,具体语法如下:
GRANT READ[,WRITE] ON DIRECTORY directory TO username;
例如:
grant read, write on directory exp_dir to eygle;
3.要更改dumpdir目录的路径,则为如下语句:
SQL>create or replace directory dumpdir as '/home/dumpfiles';
4.可以查询dba_directories查看所有directory.
SQL> select * from dba_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
------------------------------ ------------------------------ ------------------------------
SYS UTL_FILE_DIR /opt/oracle/utl_file
SYS BDUMP_DIR /opt/oracle/admin/conner/bdump
SYS EXP_DIR /opt/oracle/utl_file
5. 可以使用drop directory删除这些路径.
SQL> drop directory exp_dir;
Directory dropped
6.SQL> select * from dba_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
------------------------------ ------------------------------ ------------------------------
SYS UTL_FILE_DIR /opt/oracle/utl_file
SYS BDUMP_DIR /opt/oracle/admin/conner/bdump
本文出自 “无双城” 博客,谢绝转载!