OraMatt: YABAOracle

Yet Another Blog About Oracle

, , , , ,

Setup DBFS and mount DBFS

For those who don’t know what DBFS (DataBase FileSystem) is, here’s a little snippet:

The Oracle Database File System (DBFS) enables the database to be used as a POSIX-compatible file system on Linux. This feature includes a PL/SQL package on the database server that enables the DBFS server functionality and a Linux client for DBFS (dbfs_client). The dbfs_client client is a utility that enables mounting of a DBFS file system as a mount point on Linux. It provides the mapping from file system operations to database operations. The dbfs_client client runs completely in user space and interacts with the kernel through the FUSE library infrastructure.

DBFS Hierarchical Store provides an easy and application-transparent way to archive SecureFiles data that is stored in DBFS file systems to secondary storage tiers such as tape and storage clouds, using DBFS Links. It also allows archived data to be dearchived and brought back into the database on demand.

DBFS makes it easy for files to be accessed by database applications, and for file-based tools to access files stored in the database. With DBFS, all important file data can be seamlessly stored in an Oracle database, providing the benefits of security, backup, performance, and scalability that are standard with the Oracle Database.

SecureFiles is a high performance solution for storing files or unstructured data in Oracle Database. Customers often need to store these files for long periods of time for business or compliance reasons. Consequently, customers are looking to transfer files to cheaper forms of storage in an application-transparent manner to reduce manageability and administration overhead. DBFS Hierarchical Store provides a seamless, automatic, and transparent way to archive cold file data to inexpensive storage.

Got all that..? Good…let’s set it up…

Set up DBFS … I assume you’re using ASM

#!/bin/bash
#set up dbfs
#make_dbfs.sh
echo "Create DBFS "
export DBNAME=dbfs
export NODE1=db01
export NODE2=db02
export ORACLE_HOME=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME/bin:
 
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName $DBNAME -sid $DBNAME -sysPassword oracle -systemPassword oracle -emConfiguration NONE -storageType ASM -diskGroupName DATA -nodelist $NODE1,$NODE2 -characterSet WE8IS08859P15 -listeners $DBNAME -memoryPercentage 5 -initParams compatible=11.2.0.2.0 -continueOnNonFatalErrors true
 
 
echo "Set up Tablespace & User for DBFS in new database"
sqlplus "sys/oracle@${NODE1}:1521/dbfs as sysdba"  <<EOF
spool /tmp/dbfs_setup.log
create bigfile tablespace dbfsts datafile '+DATA' size 400g autoextend on next 8g NOLOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO ;
create user dbfs identified by dbfs default tablespace dbfsts quota unlimited on dbfsts;
grant create session, create table, create procedure, dbfs_role to dbfs;
exit;
EOF
 
cd $ORACLE_HOME/rdbms/admin
 
echo "Set up DBFS"
sqlplus "dbfs/dbfs@${NODE1}:1521/dbfs" <<EOF
start dbfs_create_filesystem_advanced dbfsts stage nocompress nodeduplicate noencrypt non-partition
exit;
EOF
 

Now…mount DBFS

#!/bin/bash
# 
# mount_dbfs.sh
#

export DBNAME=dbfs
export DBFS_PATH=/u01/dbfs
export DBFS_PASSWORD=dbfs
export HOST=`hostname`
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
 
mkdir -p $DBFS_PATH
  if [ ! -d $DBFS_PATH ] ; then
    echo "There was an error creating $DBFS_PATH."
    echo "Please check the permissions of the directory tree to ensure"
    echo "that this directory can be created and then re-run this script."
    exit 1
  fi
 
echo $DBFS_PASSWORD > .passwordfile.f
 
#sudo chmod a+rwx /etc/fuse.conf
 
echo "Here's the mount cmd "
echo "dbfs_client dbfs@${HOST}:1521/${DBNAME} $DBFS_PATH"
 
sleep 2
 
# sudo modprobe fuse
 
nohup dbfs_client -o direct_io -o allow_other  dbfs@${HOST}:1521/${DBNAME} /home/oracle/dbfs < .passwordfile.f &
 
echo "Mounted filesystems"
mount | grep dbfs
 
echo "Directory listing"
ls -halt $DBFS_PATH
 


There you go…all done…

That was easy…wasn’t it?

– Matt

Leave a comment

Navigation

About

I’m Matt and I do Oracle things.