目录对象

--创建目录对象命令

SQL> create directory test_dir as '/rman_backup/directory_objects/'
SQL> create directory dmp_dir as 'D:/app/MaryHu/oradata/backup/';
SQL> Grant  CREATE ANY DIRECTORY  TO TEST;

Grant succeeded.

SQL>
View Code

--删除目录对象命令

SQL> drop directory test_dir;
View Code

--撤销用户创建目录的权限

SQL> revoke create any directory from user_name;
View Code

--授权创建目录对象的权限

SQL> grant create any directory to user_name;
View Code

--将一个目录对象的读写权限授权给另外一个用户 

GRANT READ,WRITE ON DIRECTORY dmp_dir TO scott;
View Code

--查看目录对象信息

SQL> desc dba_directories;
SQL> select * from dba_directories;

OWNER      DIRECTORY_NAME                 DIRECTORY_PATH
---------- ------------------------------ ----------------------------------------------------------------------------------------------------
SYS        SUBDIR                         /u01/app/oracle/product/11.2.0/db_1/demo/schema/order_entry//2002/Sep
SYS        SS_OE_XMLDIR                   /u01/app/oracle/product/11.2.0/db_1/demo/schema/order_entry/
SYS        LOG_FILE_DIR                   /u01/app/oracle/product/11.2.0/db_1/demo/schema/log/
SYS        MEDIA_DIR                      /u01/app/oracle/product/11.2.0/db_1/demo/schema/product_media/
SYS        XMLDIR                         /u01/app/oracle/product/11.2.0/db_1/rdbms/xml
SYS        DATA_FILE_DIR                  /u01/app/oracle/product/11.2.0/db_1/demo/schema/sales_history/
SYS        DATA_PUMP_DIR                  /u01/app/oracle/product/11.2.0/db_1/rdbms/log/
SYS        ORACLE_OCM_CONFIG_DIR          /u01/app/oracle/product/11.2.0/db_1/ccr/state

8 rows selected.
View Code

注意:目录对象的查看权限,只有超级用户才拥有;普通用户是无法查看到的.

--修改目录对象信息

SQL> col directory_path for a60
SQL> r
  1* select * from dba_directories

OWNER                                                        DIRECTORY_NAME                                       DIRECTORY_PATH
------------------------------------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
SYS                                                          CQBANK_DATA                                          E:\WorkStation\BackupCenter\DataPump
SYS                                                          SUBDIR                                               E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\ord
                                                                                                                  er_entry\/2002/Sep

SYS                                                          SS_OE_XMLDIR                                         E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\ord
                                                                                                                  er_entry\

SYS                                                          LOG_FILE_DIR                                         E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\log
                                                                                                                  \

SYS                                                          DATA_FILE_DIR                                        E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\sal

OWNER                                                        DIRECTORY_NAME                                       DIRECTORY_PATH
------------------------------------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
                                                                                                                  es_history\

SYS                                                          XMLDIR                                               c:\ade\aime_dadvfh0169\oracle/rdbms/xml
SYS                                                          MEDIA_DIR                                            E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\pro
                                                                                                                  duct_media\

SYS                                                          DATA_PUMP_DIR                                        E:\app\Administrator/admin/cqbank/dpdump/
SYS                                                          ORACLE_OCM_CONFIG_DIR                                E:\app\Administrator\product\11.2.0\dbhome_1/ccr/state

已选择9行。

SQL> create or replace directory CQBANK_DATA as 'F:\WorkStation\BackupCenter\DataPump';

目录已创建。

SQL> select * from dba_directories;

OWNER                                                        DIRECTORY_NAME                                       DIRECTORY_PATH
------------------------------------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
SYS                                                          CQBANK_DATA                                          F:\WorkStation\BackupCenter\DataPump
SYS                                                          SUBDIR                                               E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\ord
                                                                                                                  er_entry\/2002/Sep

SYS                                                          SS_OE_XMLDIR                                         E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\ord
                                                                                                                  er_entry\

SYS                                                          LOG_FILE_DIR                                         E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\log
                                                                                                                  \

SYS                                                          DATA_FILE_DIR                                        E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\sal

OWNER                                                        DIRECTORY_NAME                                       DIRECTORY_PATH
------------------------------------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
                                                                                                                  es_history\

SYS                                                          XMLDIR                                               c:\ade\aime_dadvfh0169\oracle/rdbms/xml
SYS                                                          MEDIA_DIR                                            E:\app\Administrator\product\11.2.0\dbhome_1\demo\schema\pro
                                                                                                                  duct_media\

SYS                                                          DATA_PUMP_DIR                                        E:\app\Administrator/admin/cqbank/dpdump/
SYS                                                          ORACLE_OCM_CONFIG_DIR                                E:\app\Administrator\product\11.2.0\dbhome_1/ccr/state

已选择9行。

SQL>
View Code

 

 

 

 

 

 

 

posted @ 2013-07-09 16:46  ArcerZhang  阅读(422)  评论(0编辑  收藏  举报