How to convert Multifilesystem to Singleton Mount and Vice Versa in DBFS (Doc ID 1361627.1)

Last updated on OCTOBER 31, 2016

Applies to:

Oracle Server - Enterprise Edition - Version: 11.2.0.2 to 11.2.0.2 - Release: 11.2 to 11.2
Information in this document applies to any platform.

Goal


DBFS has been designed to support :


(a) Per-user filesystems (i.e. each RDBMS user's DBFS namespace and storage is isolated from that of other RDBMS users)

(b) Each user can simultaneously create/use/drop multiple filesystems (where one filesystem's namespace and storage is
isolated from that of other filesystems---for any given RDBMS user).

Point (b) is critical in this context. This means that if RDBMS userA creates filesystems A, B, and C, and wants to
simultaneously access all of them, DBFS _must_ create a distinction between these filesystems using the only means at
its disposal, namely the _filesystem namespace_.

So the RDBMS-side (i.e. ContentAPI) pathnames for the root directory of the various filesystems are identified as
"/A", "/B", "/C", etc. (or something similar where the prefix is derived in an obvious and straight-forward manner from
the name of the underlying filesystem), and the FUSE/dbfs_client mountpoints are similarly identified as "/mnt/dbfs/A",
"/mnt/dbfs/B", "/mnt/dbfs/C" (assuming that the Linux mountpoint prefix is "/mnt/dbfs").
The mountpoint root itself is a "virtual" directory that cannot be used to store anything and attempts to write into this
directory will fail with errors such as "Permission denied" as seen below example.

For Example , if /home/oracle/dbfs is mountpoint then

[oracle@test dbfs]$ pwd
/home/oracle/dbfs
[oracle@test dbfs]$ ls -lth
total 0
drwxrwxrwx 3 root root 0 Sep 24 08:16 stdbfs1
drwxrwxrwx 3 root root 0 Sep 23 13:55 stdbfs
[oracle@test dbfs]$ touch a
touch: cannot touch `a': Permission denied
[oracle@test dbfs]$ cd stdbfs
[oracle@test stdbfs]$ touch a
[oracle@test stdbfs]$ ls -lth
total 1.0K
-rw-r--r-- 1 oracle oinstall 0 Sep 24 12:19 a
-rw-r--r-- 1 root root 103 Sep 18 2008 Hotels.txt
-rw-r--r-- 1 root root 4.3K May 27 2007 test.pdf

This is the "Standard" mode of operation of DBFS that is documented
and implemented in the DBmachine environments, MOS notes, etc.

However, DBFS also allows for a special-case exception to this rule and that is called a "singleton mount".
Singleton mounts are useful when an RDBMS userA may have created multiple DBFS filesystems,
but wants to use one (and no more than one) of these filesystems at any given time.
If this type of use is appropriate, DBFS offers a special way of mounting the filesystem of interest as a
"singleton"---in a singleton mount, the filesystem name is no longer added as a prefix to the pathnames of its contents
and the underlying files and directories are immediately accessible under the root (i.e. under "/").

In a Multi-Filesystem You can have many filesystems under a single Mountpoint.

For Example , if /home/oracle/dbfs is mountpoint then
[oracle@test dbfs]$ pwd
/home/oracle/dbfs
[oracle@test dbfs]$ cd stdbfs
[oracle@test stdbfs]$ ls -lth
total 1.0K
-rw-r--r-- 1 root root 103 Sep 18 2008 Hotels.txt
-rw-r--r-- 1 root root 4.3K May 27 2007 test.pdf
[oracle@test stdbfs]$ cd ..
[oracle@test dbfs]$ cd stdbfs1
[oracle@test stdbfs1]$ ls -lth
total 170K
-rw-r--r-- 1 root root 20K May 2 20:18 Phone_book.xls
-rw-r--r-- 1 root root 2.6M May 9 2008 toyota.wmv


Here Directories stdbfs1 & stdbfs are 2 DBFS filesystems under Single Mountpoint /home/oracle/dbfs


In a Singleton Mount only one Filesystem will be active at a time and its contents can be seen directly under Mountpoint .


For Example , if /home/oracle/dbfs is mountpoint then
 
[oracle@test dbfs]$ pwd
/home/oracle/dbfs
[oracle@test dbfs]$ ls -lth
total 1.0K
-rw-r--r-- 1 root root 103 Sep 18 2008 Hotels.txt
-rw-r--r-- 1 root root 4.3K May 27 2007 test.pdf


Here Filesystem stdbfs is mounted as Singleton.
So only contents of Filesystem stdbfs are placed directly under Mountpoint /home/oracle/dbfs .

Query To identify whether a Filesystem is Singleton :

select nvl(store_mount,'NULL') from table(dbms_dbfs_content.listMounts);

In a Singleton DBFS , value of column store_mount will be NULL or NA value as seen in below example :

09:50:01 SQL> select nvl(store_mount,'NULL') from table(dbms_dbfs_content.listMounts);

NVL(STORE_MOUNT,'NULL')
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
NULL


In a Multi-Filesystem DBFS, value of column store_mount will be any Non-Null Value as seen in below example:

12:42:56 SQL> select store_mount from table(dbms_dbfs_content.listMounts);

STORE_MOUNT
------------------------------
stdbfs1
stdbfs


Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms