17.1 Setting Up a SecureFiles Store

This section shows how to set up a SecureFiles Store.

17.1.1 About Managing Permissions

You must be a non-SYS database user for all operational access to the Content API and stores.

Do not use SYS or SYSTEM users or SYSDBA or SYSOPER system privileges. For better security and separation of duty, only allow specific trusted users to access DBFS Content API.

You must grant each user the DBFS_ROLE role. Otherwise, the user is not authorized to use the DBFS Content API. A user with suitable administrative privileges (or SYSDBA) can grant the role to additional users as needed.

The CREATEFILESYSTEM procedure auto-commits before and after its execution (like a DDL). The method CREATESTORE is a wrapper around CREATEFILESYSTEM.

See Also:

Oracle Database PL/SQL Packages and Types Reference for DBMS_DBFS_SFS syntax details

To create a SecureFiles File System Store:

  1. Create a Store:
    connect sfs_demo/<password>
          store_name => 'FS1',
          tbl_name => 'T1',
          tbl_tbs => null,
          use_bf => false 


    • store_name is a case-sensitive, user-unique name.

    • tbl_name is a valid table name, created in the current schema.

    • tbl_tbs is a valid assm tablespace name for SecureFile Store used for the store table and its dependent segments, such as indexes, LOBs, or nested tables. The default is NULL and specifies a tablespace of the current schema.

    • use_bf specifies that BasicFiles LOBs should be used, if true, and if false it should be ASSM tablespace.


    The CREATEFILESYSTEM procedure auto-commits before and after its execution (like a DDL). The method CREATESTORE is a wrapper around CREATEFILESYSTEM.
  2. Register the Store.
    CONNECT sfs_demo
    Enter password:password
          store_name    => 'FS1',
          provider_name => 'secure_file_store',
          provider_package => 'dbms_dbfs_sfs'


    • store_name is SecureFiles Store FS1, which uses table SFS_DEMO.T1.

    • provider_name is ignored.

    • provider_package is DBMS_DBFS_SFS, for SecureFiles Store reference provider.

    This operation associates the SecureFiles Store FS1 with the DBMS_DBFS_SFS provider.

  3. Mount the store.
    CONNECT sfs_demo
    Enter password: password
          store_name    => 'FS1',
          store_mount   => 'mnt1'


    • store_name is the name of the store we want to mount. In this case the SFS store is FS1, which is already created and uses table SFS_DEMO.T1.
    • store_mount is the mount point.

  4. [Optional] To see the results of the preceding steps, you can use the following statements.
    • To verify SecureFiles Store tables and file systems:

    • To verify ContentAPI Stores and mounts:

    • To verify SecureFiles Store features:

      var fs1f NUMBER;
      select * from table(DBMS_DBFS_CONTENT.DECODEFEATURES(:fs1f)); 
    • To verify resource and property views:


17.1.2 Creating or Setting Permissions

You must grant the DBFS_ROLE role to any user that needs to use the DBFS content API.

  1. Create or determine DBFS Content API target users.

    This example uses this user and password: sfs_demo/password

    At minimum, this database user must have the CREATE SESSION, CREATE RESOURCE, and CREATE VIEW privileges.

  2. Grant the DBFS_ROLE role to the user.
    CONNECT / as sysdba
    GRANT dbfs_role TO sfs_demo;

This sets up the DBFS Content API for any database user who has the DBFS_ROLE role.

17.1.3 Accessing SecureFiles Store

You should never directly access tables that hold data for a SecureFiles Store file systems.

This is the correct way to access the file systems.

  • For procedural operations: Use the DBFS Content API (DBMS_DBFS_CONTENT methods).

  • For SQL operations: Use the resource and property views (DBFS_CONTENT and DBFS_CONTENT_PROPERTIES).

17.1.4 Reinitializing SecureFiles Store File Systems

You can truncate and re-initialize tables associated with an SecureFiles Store.

  • Use the procedure INITFS().

    The procedure executes like a DDL, auto-committing before and after its execution.

The following example uses file system FS1 and table SFS_DEMO.T1, which is associated with the SecureFiles Store store_name.

CONNECT sfs_demo;
Enter password: password
EXEC DBMS_DBFS_SFS.INITFS(store_name => 'FS1');

17.1.5 Comparison of SecureFiles LOBs to BasicFiles LOBs

SecureFiles LOBs are only available in Oracle Database 11g Release 1 and higher. They are not available in earlier releases.

You must use BasicFiles LOB storage for LOB storage in tablespaces that are not managed with Automatic Segment Space Management (ASSM).

Compatibility must be at least to use SecureFiles LOBs.

Additionally, you need to specify the following in DBMS_DBFS_SFS.CREATEFILESYSTEM:

  • To use SecureFiles LOBs (the default), specify use_bf => false.

  • To use BasicFiles LOBs, specify use_bf => true.