This is an old revision of the document!


DBFS or database file system is another twerk of oracle. Basically it is similiar to the NFS in a sense that it can be mounted and dismounted, but also, it can be registered in a GRID infrastructure. That will allow it to failvoer in case of failure of one of the instances, so let's see how it is done.

To create DBFS we need couple things:

  1. Edit FUSE config (that is the config file for the FUSE package needed for the DBFS.
  2. Create folder (owned under oracle user and dba group)
  3. Create a tablespace which will be registered with the DBFS (that tablespace won't reside on the DBFS, but it is needed for configuration)
  4. Create user with the necessary permission
  5. Create the DBFS env on the database

So let's get started:

First, we have to edit the configuration for FUSE:

Edit FUSE config

[root@ol6-121-rac2 ~]# vi /etc/fuse.conf 
user_allow_other
!wq

Then we have to create the directory:

Create directory

[root@ol6-121-rac1 ~]# mkdir -p /oracle/dbfs_direct
[root@ol6-121-rac1 ~]# chown oracle:dba /oracle/dbfs_direct
[root@ol6-121-rac1 ~]# ls –ld /oracle/dbfs_direct
drwxr-xr-x 2 oracle dba 4096 Nov  3 02:26 /oracle/dbfs_direct/
[root@ol6-121-rac1 ~]#

After that, we have to create the Tablespace, user and the environment:

Configure DBFS on the database

[oracle@ol6-121-rac1 ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Tue Nov 3 02:30:01 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Enter user-name: / as sysdba

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> create bigfile tablespace dbfs_ts datafile '+DATA' size 1024M autoextend on next 100M maxsize 3G NOLOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;

Tablespace created.

SQL> create user dbfs_user identified by oracle default tablespace dbfs_ts quota unlimited on dbfs_ts;

User created.

SQL> grant create session, create table, create view, create procedure, dbfs_role to dbfs_user;

Grant succeeded.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
[oracle@ol6-121-rac1 ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/rdbms/admin/

[oracle@ol6-121-rac1 admin]$ sqlplus dbfs_user/oracle
SQL*Plus: Release 12.1.0.2.0 Production on Tue Nov 3 02:41:53 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> start dbfs_create_filesystem dbfs_ts FS1
No errors.
--------
CREATE STORE:
begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS1', tbl_name => 'FS1',
tbl_tbs => 'dbfs_ts', lob_tbs => 'dbfs_ts', do_partition => false, partition_key
=> 1, do_compress => false, compression => '', do_dedup => false, do_encrypt =>
false); end;
--------
REGISTER STORE:
begin dbms_dbfs_content.registerStore(store_name=> 'FS1', provider_name =>
'sample1', provider_package => 'dbms_dbfs_sfs'); end;
--------
MOUNT STORE:
begin dbms_dbfs_content.mountStore(store_name=>'FS1', store_mount=>'FS1'); end;
--------
CHMOD STORE:
declare m integer; begin m := dbms_fuse.fs_chmod('/FS1', 16895); end;
No errors.
SQL> 
  • oracle_dbfs.1604415050.txt.gz
  • Last modified: 2020/11/03 14:50
  • by andonovj