How to create Database File System DBFS

Creating a File System
Create a tablespace to hold the file system.

CONN / AS SYSDBA

CREATE TABLESPACE dbfs
  DATAFILE ‘/u01/app/oracle/oradata/DB11G/dbfs01.dbf’
  SIZE 1M AUTOEXTEND ON NEXT 1M;
Create a user, grant DBFS_ROLE to the user and make sure it has a quota on the tablespace. Trying to create a file system from the SYS user fails, so it must be done via another user.

CONN / AS SYSDBA

CREATE USER user1 IDENTIFIED BY user1
  DEFAULT TABLESPACE dbfs QUOTA UNLIMITED ON dbfs;

GRANT CREATE SESSION, RESOURCE, CREATE TABLE, CREATE VIEW, CREATE PROCEDURE, DBFS_ROLE TO user1;
Create the file system in tablespace by running the “dbfs_create_filesystem.sql” script as the test user. The script accepts two parameters identifying the tablespace and file system name.

cd $ORACLE_HOME/rdbms/admin
sqlplus user1/user1

SQL> @dbfs_create_filesystem.sql dbfs staging_area
The script created a partitioned file system. Although Oracle consider this the best option from a performance and scalability perspective, it can have two drawbacks:

FUSE Installation**********************
In order to mount the DBFS we need to install the “Filesystem in Userspace” (FUSE) software. If you are not planning to mount the DBFS or you are running on an Non-Linux platform, this section is unnecessary. The FUSE software can be installed manually, from the OEL media or via Oracle’s public yum server. If possible, use the Yum installation.

Yum FUSE Installation
Configure the server to point to Oracle’s public yum repository. The instructions for this are available at “http://public-yum.oracle.com”.

Next, install the kernel development package and the FUSE software. The kernel development package may already be present, in which case you will see a “Nothing to do” message.

# yum install kernel-devel fuse fuse-libs

Mounting a File System**********************
The dbfs_client tool is used to mount file systems on Linux servers. The usage is displayed if you call it without any parameters.

[oracle@source.doyensys.com admin]$
First we need to create a mount point with the necessary privileges as the “root” user.

# mkdir /mnt/dbfs
# chown oracle:oinstall /mnt/dbfs
Add a new library path and create symbolic links to the necessary libraries in the directory pointed to by the new library path. Depending on your installation the “libfuse.so.2” library may be in an alternative location.

# 12cR2

# echo “/usr/local/lib” >> /etc/ld.so.conf.d/usr_local_lib.conf
# export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
# ln -s $ORACLE_HOME/lib/libclntsh.so.12.1 /usr/local/lib/libclntsh.so.12.1
# ln -s $ORACLE_HOME/lib/libnnz12.so /usr/local/lib/libnnz12.so
# ln -s /lib64/libfuse.so.2 /usr/local/lib/libfuse.so.2
# ln -s /lib64/libfuse.so.2 /usr/local/lib/libfuse.so
# ldconfig
Edit the “/etc/fuse.conf” file, un-commenting the “user_allow_other” option. The contents should look like this.

# mount_max = 1000
user_allow_other
Loosen the permissions on the fusermount command.

# chmod +x /usr/bin/fusermount
Edit the file “/etc/abrt/abrt-action-save-package-data.conf” setting the following parameter.

ProcessUnpackaged = yes
Reboot the server.

# reboot
Make sure the “/usr/local/lib” directory is referenced in the LD_LIBRARY_PATH environment variable. You may want to add something like this to the profile for the “oracle” user, or any environment setup scripts.

$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib

*************************************************************

The file system we’ve just created is mounted  following commands from the “oracle” OS user.

$ # Connection prompts for password and holds session.
$ dbfs_client user1@DB11G /mnt/dbfs

  • March 19, 2018 | 16 views
  • Comments