16.2 Creating a DBFS File System
A DBFS File system can be partitioned or non-partitioned.
16.2.1 Privileges Required to Create a DBFS File System
Database users must certain privileges to create a file system.
Following is the minimum set of privileges required for a database user to create a file system:
GRANT CONNECTCREATE SESSIONRESOURCE,CREATE TABLECREATE PROCEDUREDBFS_ROLE
16.2.2 Creating a Non-Partitioned File System
You can create a file system by running DBFS_CREATE_FILESYSTEM.SQL while logged in as a user with DBFS administrator privileges.
You can create a file system according to the following steps:
For example, to create a file system called staging_area in an
existing ASSM tablespace dbfs_tbspc:
$ sqlplus dbfs_user/db_server @$ORACLE_HOME/rdbms/admin/dbfs_create_filesystem.sql dbfs_tbspc staging_area
16.2.3 Creating a Partitioned File System
Files in DBFS are hash partitioned. Partitioning creates multiple physical segments in the database, and files are distributed randomly in these partitions.
You can create a partitioned file system by running DBFS_CREATE_FILESYSTEM_ADVANCED.SQL while logged in as a user with DBFS administrator privileges.
While creating a partitioned file system, you can specify any one of the following values as the hash key.
partitionandpartition-by-itemname: uses the item name as the partition key. The item name is the last component in the path name. Use this option to partition files based on the last component in the file path. For example, if/directory1/subdirectory2/filename.txtis the entire path, thenfilename.txtis the last component in the path andfilename.txtis used as the partition key. If you use thepartitionoption, then the file system is partitioned using the item name as the partition key.partition-by-guid: uses the globally unique identifier (GUID) assigned to the file by DBFS as the partition key. DBFS assigns a GUID to each file. Use this option to partition the files based on the internally-generated GUID.partition-by-path: uses the entire path of the file as the partition key. For example, if the file is/directory1/subdirectory2/filename.txt, then the entire/directory1/subdirectory2/filename.txtis considered as the partition key.