在exadata环境下配置dbfs文件系统

在exadata环境下配置dbfs文件系统1.ORACLE的一体机环境下,通常原厂初始化完成后,都会有一个典型的dbfs磁盘组被创建,可用来建立oracle所支持的文件系统来用。  ORACLE的文件系统需要一个独立的数据库来作为后台支撑,在此库内创建一个表空间,此空间的容量就是后续文...显示全部
在exadata环境下配置dbfs文件系统

1.ORACLE的一体机环境下,通常原厂初始化完成后,都会有一个典型的dbfs磁盘组被创建,可用来建立oracle所支持的文件系统来用。
  ORACLE的文件系统需要一个独立的数据库来作为后台支撑,在此库内创建一个表空间,此空间的容量就是后续文件系统可使用的容量。
  创建系统时涉及到2个方法:使用钱包或者不使用钱包,使用钱包由于复杂且有潜在影响,所以下文只针对非钱包方式进行描述。

  另外假设平台是Linux平台

2.创建单独的数据库
  由于Dbfs文件系统是依托于某个表空间的,所以需要先为此目的单独创建一个数据库,数据库的要求如下:

  2.1. Invoke?DBCA
  2.2. Choose Real Application Clusters database.
  2.3. Choose Create a Database?
  2.4. Choose the General Purpose or Transaction Processing template (include datafiles)
  2.5. Choose Admin-Managed and select all nodes
  2.6. Name your database (e.g. dbfs)
  2.7. Optionally configure Enterprise Manager and automatic maintenance tasks as per site requirements
  2.8. Choose Automatic Storage Management and Oracle-Managed Files
  2.9. Choose the desired Disk Group. In general, DBFS_DG is adequate for DBFS purposes
  2.10. De-select Flash Recovery Area
  2.11. Do not select Enable Archiving. Archivelog mode is not necessary for this use case.
  2.12. In the Memory Tab:
  2.12.1 Choose Custom and then Automatic Shared Memory Management
  2.12.2 Enter 1536 (and choose M Bytes for units) in the SGA box and enter 6656 and choose M Bytes for units) in the PGA Size box
  2.13. In the Character Sets tab choose AL32UTF8 as the Database Character Set
  2.14. Open the All Initialization Parameters dialogue. Select "Show Advanced arameters". Scroll down to parallel_max_servers and enter "2" under the Value column
  2.15. If diskgroup DBFS_DG's compatible.rdbms attribute is set to 11.2.0.2.0 then
        in DBCA set compatible=11.2.0.2.0 in All Initialization Parameters screen. If this isn't set properly, you will get "ORA-15204: database version 11.2.0.0.0 is
        incompatible with diskgroup DBFS_DG" while creating the database.
  2.16. Click on the Finish button

3.配置过程如下:(假设是四分之一配的一体机,存在两个db server:dm01test01,dm02test02)
3.1 将oracle加入fuse 组
    (root)# dcli -g ~/dbs_group -l root usermod -a -G fuse oracle
    more dbfs_group:
    dm01test01
    dm01test02  
   
    创建/etc/fuse.conf 文件并授权
    (root)# dcli -g ~/dbs_group -l root "echo user_allow_other > /etc/fuse.conf"
    (root)# dcli -g ~/dbs_group -l root chmod 644 /etc/fuse.conf   
3.2  创建文件系统的挂载点(比如dbfsmnt)
   (root)# dcli -g ~/dbs_group -l root chown oracle:dba /dbfsmnt
  
3.3集群重启

(root)# dcli -g ~/dbs_group -l root /u01/app/11.2.0.3/grid/bin/crsctl stop crs
(root)# dcli -g ~/dbs_group -l root /u01/app/11.2.0.3/grid/bin/crsctl start crs

3.4在第2步骤创建的书库内创建用户及表空间
表空间要求如下:
    Tablespaces for DBFS can be either SMALLFILE or BIGFILE. Optimally, the  administrator will determine the size of the staging area needed for the Data
     Warehouse activities and will create the tablespace with the required size as opposed to relying on autoextend.
    When creating a tablespace for DBFS, include the following options:
    NOLOGGING ONLINE PERMANENT EXTENT MANAGEMENT LOCAL AUTOALLOCATE  SEGMENT SPACE MANAGEMENT AUTO
   
   
SQL> create bigfile tablespace dbfsts datafile '+DBFS_DG' size 32g autoextend on next 8g maxsize 300g NOLOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE  SEGMENT SPACE MANAGEMENT AUTO ;
SQL> create user dbfs_user identified by test default tablespace dbfsts quota unlimited on dbfsts;
SQL> grant create session, create table, create view, create procedure, dbfs_role to dbfs_user;

3.5使用上述创建的用户,执行脚本保存dbfs的对象
(oracle)$ sqlplus dbfs_user/dbfs_passwd
SQL> start dbfs_create_filesystem dbfsts FS1

dbfsts:是用于文件系统的表空间名称
FS1:文件系统挂载点下面的第一子目录,所有后续可用的文件系统都需要在此子目录下创建更内层的子目录,比如/dbfsmnt/FS1/test

3.6.下载mount-dbfs.sh 文件并进行转换处理,比如文件放到/tmp下

For Linux, run this:
(root)# dos2unix /tmp/mount-dbfs.sh

3.7 编辑/tmp/mount-dbfs.sh 文件
DBNAME
MOUNT_POINT
DBFS_USER
ORACLE_HOME (should be the RDBMS ORACLE_HOME directory)
LOGGER_FACILITY (used by syslog to log the messages/output from this script)
MOUNT_OPTIONS
DBFS_PASSWD (used only if WALLET=false)
DBFS_PWDFILE_BASE (used only if WALET=false)
WALLET (must be true or false)
TNS_ADMIN (used only if WALLET=true)
DBFS_LOCAL_TNSALIAS

如上所示,由于示例未采用wallet,所以部分和wallet相关的属性不用设置
改后的文件内容如下:
more mount-dbfs.sh
#!/bin/bash

### This script. is from Note 1054431.1, ensure you have the latest version
### Note 1054431.1 provides information about the setup required to use this script

### updated 26-JUL-2012

###########################################
### Everyone must set these values
###########################################
### Database name for the DBFS repository as used in "srvctl status database -d $DBNAME"
DBNAME=test

### Mount point where DBFS should be mounted
MOUNT_POINT=/dbfsmnt

### Username of the DBFS repository owner in database $DBNAME
DBFS_USER=dbfs_user

### RDBMS ORACLE_HOME directory path
ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1

### Syslog facility name (default user)
### Changed default from local3 to user for Solaris default support on 17-FEB-2012
### This will allow us to log messages to the syslog
###  (/var/log/messages on Linux, /var/adm/messages on Solaris)
LOGGER_FACILITY=user

### mount options for dbfs_client; these are used for both wallet and non-wallet mounting
MOUNT_OPTIONS=allow_other,direct_io
### if tracing is required, maybe consider parameter like the example below
### following example is commented out, only uncomment if directed by Oracle Support
### fix_control=32 added per bug 13340960 to allow async statfs response
#MOUNT_OPTIONS=allow_other,direct_io,fix_control=32,trace_level=1,trace_file=/tmp/dbfs_client_trace.$$.log,trace_size=100

### PERL_ALARM_TIMEOUT is number of seconds to wait for response from status command.
### After this, if no respnose, the script. will run clean.
### NOTE: If this is longer than the clusterware check interval, bad things may happen.
###       Adjust the CHECK_INTERVAL to ensure it is at least 2x as long as PERL_ALARM_TIMEOUT.
###       Example:
###       $ crsctl status res dbfs_mount -p|grep ^CHECK     
###       CHECK_INTERVAL=30
###       $ crsctl modify res dbfs_mount -attr "CHECK_INTERVAL=32"
###       $ crsctl status res dbfs_mount -p|grep ^CHECK
###       CHECK_INTERVAL=32
PERL_ALARM_TIMEOUT=14

###########################################
### If using password-based authentication, set these
###########################################
### This is the plain text password for the DBFS_USER user
DBFS_PASSWD=test

### The file used to temporarily store the DBFS_PASSWD so dbfs_client can read it
### This file is removed immediately after it is read by dbfs_client
### The actual filename used will have the PID appended to the name for uniqueness
### This variable should be a full pathname including a directory and the first part of a filename.
DBFS_PWDFILE_BASE=/tmp/.dbfs-passwd.txt

###########################################
### If using wallet-based authentication, modify these
###########################################
### WALLET should be true if using a wallet, otherwise, false
WALLET=false

### TNS_ADMIN is the directory containing tnsnames.ora and sqlnet.ora used by DBFS
TNS_ADMIN=/export/home/oracle/dbfs/tnsadmin

### TNS alias used for mounting with wallets
DBFS_LOCAL_TNSALIAS=fsdb.local

###########################################
### No editing is required below this point
###########################################
### determine platform
UNAME_S=`uname -s`
if   [ $UNAME_S = 'Linux' ]; then LINUX=1; SOLARIS=0;
elif [ $UNAME_S = 'SunOS' ]; then LINUX=0; SOLARIS=1;
fi

GREP=/bin/grep
AWK=/bin/awk
ECHO=/bin/echo
LOGGER="/bin/logger -t DBFS_${MOUNT_POINT}"
RMF='/bin/rm -f'
TOUCH=/bin/touch
CHMOD=/bin/chmod
PS=/bin/ps
SLEEP=/bin/sleep
KILL=/bin/kill
BASENAME=/bin/basename
STAT=/usr/bin/stat
ID=/usr/bin/id
WC=/usr/bin/wc
SRVCTL=$ORACLE_HOME/bin/srvctl
DBFS_CLIENT=$ORACLE_HOME/bin/dbfs_client
HN=/bin/hostname
PERL=/usr/bin/perl
MOUNT=/bin/mount
### ensure messages are displayed in English for pattern matching
LANG=en_US.UTF-8
NLS_LANG=American_America.US7ASCII

if [ -z "$STATUS_TIMEOUT" ]; then STATUS_TIMEOUT=0; fi

if [ $LINUX -eq 1 ]; then
  MOUNT=/bin/mount
  XARGS='/usr/bin/xargs -r'
  FUSERMOUNT=/bin/fusermount
  LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64
elif [ $SOLARIS -eq 1 ]; then
  MOUNT=/sbin/mount
  XARGS=/usr/bin/xargs
  UMOUNT=/usr/sbin/umount
  LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:/usr/lib:/lib
fi

DBFS_PWDFILE=$DBFS_PWDFILE_BASE.$$

export ORACLE_HOME LD_LIBRARY_PATH TNS_ADMIN
export STAT MOUNT_POINT PERL_ALARM_TIMEOUT SOLARIS LINUX
export PATH=$ORACLE_HOME/bin:$PATH
export STATUS_TIMEOUT
export LANG NLS_LANG

logit () {
  ### type: info, error, debug
  type=$1
  msg=$2
  if [ "$type" = "info" ]; then
    $ECHO $msg
    $LOGGER -p ${LOGGER_FACILITY}.info "$msg"
  elif [ "$type" = "error" ]; then
    $ECHO $msg
    $LOGGER -p ${LOGGER_FACILITY}.error "$msg"
  elif [ "$type" = "debug" ]; then
    $ECHO $msg
    $LOGGER -p ${LOGGER_FACILITY}.debug "$msg"
  fi
}

### must not be root
if [ `$ID -u` -eq 0 ]; then
  logit error "Run this as the Oracle software owner, not root"
  exit 1
fi

### determine how we were called, derive location
SCRIPTPATH=$0
SCRIPTNAME=`$BASENAME $SCRIPTPATH`

echo $SCRIPTPATH | grep ^/ > /dev/null 2>&1
if [ $? -ne 0 ]; then
  MYDIR=`pwd`
  SCRIPTPATH=${MYDIR}/${SCRIPTPATH}
fi

### must cd to a directory where the oracle owner can get CWD
cd /tmp

case "$1" in
'start')
  logit info "$SCRIPTNAME mounting DBFS at $MOUNT_POINT from database $DBNAME"

  ### check to see if it is already mounted
  $SCRIPTPATH status > /dev/null 2>&1
  if [ $? -eq 0 ]; then
    logit error "$MOUNT_POINT already mounted, use $SCRIPTNAME stop before attempting to start"
    $SCRIPTPATH status
    exit 1
  fi

  ### set the ORACLE_SID dynamically based on OCR info, if it is running
  export ORACLE_SID=$($SRVCTL status instance -d $DBNAME -n `$HN` |
                      $GREP 'is running' | $AWK '{print $2}' )
  logit info "ORACLE_SID is $ORACLE_SID"

  ### if there's no SID defined locally or it isn't running, stop
  if [ -z "$ORACLE_SID" -a "$WALLET" = 'false' ]; then
    logit error "No running ORACLE_SID available on this host, exiting"
    exit 2
  fi

  ### if using password-based startup, use this
  if [ "$WALLET" = 'false' -a -n "$DBFS_PASSWD" ]; then
    $RMF $DBFS_PWDFILE
    if [ -f $DBFS_PWDFILE ]; then
      logit error "please remove $DBFS_PWDFILE and try again"
      exit 1
    fi

    $TOUCH $DBFS_PWDFILE
    $CHMOD 600 $DBFS_PWDFILE
    $ECHO $DBFS_PASSWD > $DBFS_PWDFILE

    logit info "spawning dbfs_client command using SID $ORACLE_SID"

    (nohup $DBFS_CLIENT ${DBFS_USER}@ -o $MOUNT_OPTIONS
          $MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) &

    $RMF $DBFS_PWDFILE

  elif [ "$WALLET" = true ]; then
    logit info "doing mount $MOUNT_POINT using SID $ORACLE_SID with wallet now"
    (nohup $DBFS_CLIENT /@${DBFS_LOCAL_TNSALIAS} -o $MOUNT_OPTIONS,wallet
          $MOUNT_POINT | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) &
  fi收起
参与5

查看其它 3 个回答cool6269的回答

cool6269cool6269软件架构设计师fff
看的头晕眼花,还没有搞清楚这个dbfs到底是干什么用的,晕啊
IT咨询服务 · 2015-05-11
浏览2959

回答者

cool6269
软件架构设计师fff
擅长领域: 服务器Power服务器双活

回答状态

  • 发布时间:2015-05-11
  • 关注会员:1 人
  • 回答浏览:2959
  • X社区推广