Drop Directory in Autonomous Database

Use the database DROP DIRECTORY command to drop a directory object.

For example, the following command drops the database directory object staging:

DROP DIRECTORY staging;

The DROP DIRECTORY command does not delete files in the directory. If you want to delete the directory and the files in the directory, first use the procedure DBMS_CLOUD.DELETE_FILE to delete the files. See DELETE_FILE Procedure for more information.

To drop a directory, you must have the DROP ANY DIRECTORY system privilege. The ADMIN user is granted the DROP ANY DIRECTORY system privilege. The ADMIN user can grant DROP ANY DIRECTORY system privilege to other users.

See DROP DIRECTORY for more information.

Note

  • You are not allowed to drop the predefined directories: data_pump_dir or sql_tcb_dir

  • If you just want to drop the directory and you do not remove the files in the directory, after you drop the directory you can view all the files in the file system, including any files that were in the directory you dropped, as follows:

    CREATE OR REPLACE DIRECTORY ROOT_DIR AS '';

    Then list the contents of ROOT_DIR with the following command:

    SELECT * FROM DBMS_CLOUD.list_files('ROOT_DIR');

    To run DBMS_CLOUD.LIST_FILES with a user other than ADMIN you need to grant read privileges on the directory to that user. See LIST_FILES Function for more information.

  • The DROP DIRECTORY command does not remove the underlying file system directory. Autonomous Database manages the underlying file system directory; users do not remove the file system directory.