18.3 Creating a DBFS File System

You can create a partitioned or non-partitioned DBFS File system.

For both partitioned and non-partitioned DBFS, you can specify one or more of the following storage properties to specify how your files are stored in DBFS: compression and deduplication.

For example, you can configure DBFS as a compressed file system with partitioning. At the time of creating a DBFS file system, you must specify the set of features that you want to enable for the file system.

After creating a DBFS, you can track the usage of the DBFS. If you want to change the storage properties of the DBFS, you can reorganize the DBFS. You can update the metadata of the DBFS by changing the values for parameters, such as deduplicate, compress, and partition. For example, you may have created a DBFS to store all the files in the compressed format. If you want to change this property, you can reorganize the DBFS.

18.3.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 CONNECT
  • CREATE SESSION
  • RESOURCE, CREATE TABLE
  • CREATE PROCEDURE
  • DBFS_ROLE

18.3.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.

Before you begin, ensure that you create the file system in an ASSM tablespace to support a SecureFile store.

To create a non-partitioned file system:

  1. Log in to the database instance as a user with DBFS administrator privileges.
    $ sqlplus dbfs_user/@db_server
    
  2. Enter the following command to create the file system.

    Syntax

    @$ORACLE_HOME/rdbms/admin/dbfs_create_filesystem.sql tablespace_name
         file_system_name 
      [compress-high | compress-medium | compress-low | nocompress] 
      [deduplicate | nodeduplicate]
      non-partition

    Example

    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 nocompress nodeduplicate non-partition

18.3.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.SQL while logged in as a user with DBFS administrator privileges.

The tablespace in which you create the file system should be an ASSM tablespace to support Securefile store. Before you begin, ensure that you create the file system in an ASSM tablespace to support SecureFile store.

  1. Log in to the database instance:
    $ sqlplus dbfs_user/@db_server
    
  2. Enter one of the following commands to create the file system based on your requirement.

    Syntax

    @$ORACLE_HOME/rdbms/admin/dbfs_create_filesystem_advanced.sql tablespace_name
           file_system_name [compress-high | compress-medium | compress-low | nocompress] 
      [deduplicate | nodeduplicate]
      [partition | partition-by-itemname | partition-by-guid | partition-by-path]
    

    Examples

    • For example, to create a partitioned file system called staging_area in an existing ASSM tablespace dbfs_tbspc:

      $ sqlplus dbfs_user/@db_server  
             @$ORACLE_HOME/rdbms/admin/dbfs_create_filesystem_advanced.sql dbfs_tbspc
             staging_area nocompress nodeduplicate partition
      
    • For example, to create a partitioned file system called staging_area in an existing ASSM tablespace dbfs_tbspc with the storage properties compress and deduplicate.
      $ sqlplus dbfs_user/@db_server  
             @$ORACLE_HOME/rdbms/admin/dbfs_create_filesystem_advanced.sql dbfs_tbspc
             staging_area compress-medium deduplicate partition