dbfs_common.ksh


############################################################
# DBFS Functions
# Use the following functions to install and maintain dbfs
############################################################

############################################################
# dbfs_init           - Initialize variables or other functions
# dbfs_pre_inst       - Check for OS params
# dbfs_inst_fuse      - Install FUSE libraries
# dbfs_cfg_fuse       - Config FUSE libraries
# dbfs_chk_db_usr     -
# dbfs_cr_tblspc      - Create DBFS tablespace
# dbfs_drp_tblspc     - Drop DBFS tablespace
# dbfs_cr_usr         - Create DBFS user
# dbfs_drp_usr        - Drop DBFS user
# dbfs_cr_objs        - Create DBFS objects
# dbfs_cr_mnt_pnt     - Create the DBFS mountpoint
# dbfs_test_access    - Test access to the DBFS directories
# dbfs_inst_qa        - QA the install
# dbfs_sho            - Stub only needs code
# dbfs_status         - Stub only needs code
############################################################

dbfs_init()
{

echo "dbfs_init........"
echo "This is the var init process....."
echo "Put any variables here needed for the process..."

}


dbfs_pre_inst()
{

echo
echo "dbfs_pre_inst........"
echo "Checking for uname -a for dbfs pre check....."
echo
echo
uname -a
echo
echo
echo "Checking for cat release....."
echo
echo
cat /etc/*-release

}

dbfs_inst_fuse()
############################################################
# Install the FUSE libraries
############################################################
{

############################################################
# not sure how this will get done via bank environment
############################################################
yum install fuse fuse-libs kernel-devel

}

dbfs_cfg_fuse()
############################################################
# this is done as root
# Config the FUSE sub-system
############################################################
{

ls -IL /usr/bin/fusermount

/sbin/modprobe fuse

chmod 666 /dev/fuse

echo "/sbin/modprobe fuse ">> /etc/rc.modules

grep fuse /etc/group

usermod -a -G fuse oracle

grep fuse /etc/group

id oracle

}


dbfs_chk_db_usr()
############################################################
# this is done as oracle
############################################################
{

show user

select name, created, from v\$database;

}


dbfs_cr_tblspc()
{


create bigfile tablespace dbfs_ts
datafile 'XXXXXXX'
size 1024M
autoextend on next 100M maxsize 3G nologging extent management
local autoallocate segment space management auto;

}


dbfs_drp_tblspc()
{

echo "TBD..."

}



dbfs_cr_usr()
{

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

grant create_session, create table, creaet view, create procedure, dbfs_role to dbfs_user;

grant resource to dbfs_user;

}


dbfs_drp_usr()
{

echo "TBD..."

}



dbfs_cr_objs()
{

show user

rdbms/admin/dbfs_create_filesystem.sql dbfs_ts FS1


create store
begin dbms dbfs sfs.createFilesystem(store name => 'FS1', tbl name => 'FS1',
tbl tbs =>'dbfs ts', lob tbs => 'dbfs ts', do partition => false

register store


mount store



chmod store



}


dbfs_cr_mnt_pnt()
######################################
# create mount point
# run as root
######################################
{

flsystm=/u06dbfs

su -

echo
echo "create dirs"
echo

mkdir $flsystm

chown oracle:dba $flsystm

ls -ld $flsystm

}


dbfs_test_access()
{

df -k

sqlplus dbfs_user/dbfs_user@DBFSDB << EOF

show user

exit


EOF

id
dbfs_client dbfs_user/dbfs_user@DBFSDB /u06dbfs


}