DBFS是oracle Exadata提供的一种的集群文件系统,他是通过创建一个表空间,并将该表空间通过一系列操作,挂载成为文件系统,为Exadata各个节点提供文件系统服务。
   DBFS一般都是在客户初次部署的时候,由oracle远程工程师通过固定的脚本,自动化部署全部的操作系统数据库的同时,将其建立。
   这里说到的就是,在之前客户没有规划DBFS文件系统,但是后期打算手动添加的方法。
  我的OS oracle linux

1.创建fuse用户组,并将oracle添加到这个组内。(注:dcli -g ~/dbs_group -l表示后面的命令式在~/dbs_group中列出的全部服务器上执行)

  1. (root)# dcli -g ~/dbs_group -l root usermod -a -G fuse oracle

2.创建/etc/fuse.conf file并添加 user_allow_other. 赋予相应的权限到这个文件.

  1. (root)# dcli -g ~/dbs_group -l root "echo user_allow_other > /etc/fuse.conf"
  2. (root)# dcli -g ~/dbs_group -l root chmod 644 /etc/fuse.conf

3.在所有的服务器上创建一个空的目录,用来作为DBFS文件系统的挂载点。

  1. (root)# dcli -g ~/dbs_group -l root mkdir /dbfs_direct

更改目录的属组,确保oracle可以正常访问与修改.

  1. (root)# dcli -g ~/dbs_group -l root chown oracle:dba /dbfs_direct

4.To pick up the additional group (fuse) membership for the oracle user on Linux or the workaround above on Solaris, Clusterware must be restarted. For example, to restart Clusterware on all nodes at the same time (non-rolling), you can use the following commands as root:

  1. (root)# dcli -g ~/dbs_group -l root /u01/app/11.2.0/grid/bin/crsctl stop crs
  2. (root)# dcli -g ~/dbs_group -l root /u01/app/11.2.0/grid/bin/crsctl start crs
  3. Note that the "crsctl stop cluster -all" syntax may not be used as it leaves ohasd running and Solaris database hosts require it to be restarted for the workaround to take effect.

5.创建一个数据库表空间,作为DBFS文件系统的存储空间. 如何创建表空间,请参考 Note 1191144.1
创建一个表空间(表空间名dbfsts)为将来存储文件使用,可以根据你的需求创建:大小,是否扩展和bigfile or small file等,完全随意

  1. SQL> sqlplus / as sysdba
  2. 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 ;

6.创建用户,该用户是后续管理DBFS使用的

  1. SQL> create user dbfs_user identified by dbfs_passwd default tablespace dbfsts quota unlimited on dbfsts;
  2. SQL> grant create session, create table, create view, create procedure, dbfs_role to dbfs_user;

7.通过调用 dbfs_create_filesystem.sql 脚本,创建文件系统

  1. (oracle)$ cd $ORACLE_HOME/rdbms/admin
  2. (oracle)$ sqlplus dbfs_user/dbfs_passwd
  3. SQL> start dbfs_create_filesystem dbfsts FS1
  4. This script takes two arguments:
  5. dbfsts: tablespace for the DBFS database objects    (注:该参数输入之前创建的表空间名)
  6. FS1: filesystem name, this can be any string and will appear as a directory under the mount point (注:这个是在后续挂载完成之后,出现在挂件点下的文件夹名称)
  7. ---脚本分析---
  8. 查看 dbfs_create_filesystem 脚本
  9. $ cd $ORACLE_HOME
  10. $ ls dbfs*
  11. dbfs_create_filesystem_advanced.sql  dbfs_create_filesystem.sql  dbfs_drop_filesystem.sql
  12. $more  dbfs_create_filesystem.sql
  13. =================
  14. define ts_name      = &1
  15. define fs_name      = &2
  16. @@dbfs_create_filesystem_advanced.sql &ts_name &fs_name nocompress nodeduplicate noencrypt non-partition
  17. undefine ts_name
  18. undefine fs_name
  19. ===================
  20. $ more  dbfs_create_filesystem_advanced.sql
  21. 这个脚本主要是赋值,通过一个procedure来执行dbms_dbfs_sfs.createFilesystem包,创建一个文件系统
  22. dbms_dbfs_sfs 的用法及定义,请参看如下链接
  23. http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_dbfs_sfs.htm#ARPLS72180
  24. The DBMS_DBFS_SFS package provides an interface to operate a SecureFile-based store (SFS) for the content interface described in the DBMS_DBFS_CONTENT package.
  25. 可以通过如下命令去确认是否已经安装这个package
  26. SQL>select OBJECT_NAME from all_objects t where object_type like 'PACKAGE%' and object_name like 'DBMS_DBFS_SFS%';
  27. OBJECT_NAME
  28. ------------------------------
  29. DBMS_DBFS_SFS
  30. DBMS_DBFS_SFS
  31. DBMS_DBFS_SFS_ADMIN
  32. DBMS_DBFS_SFS_ADMIN
  33. ---脚本分析---

---至此,已经完成DBFS文件系统的安装,下面是对DBFS的挂载和管理---

有两种方式来挂载之前创建的表空间为DBFS
第一种方法是通过安装rpm包,使用dbfs_client命令来实现DBFS的挂载,但是不能使用wallet的功能(注意这里的wallet不是数据库中的wallet,它只是保存 dbfs_user/dbfs_passwd 的一个加密文件)
第二种方法是使用 Oracle Wallet来存储密码和使用mount命令

8. The second option is to use the Oracle Wallet to store the password and make use of the mount command. The wallet directory ($HOME/dbfs/wallet in the example here) may be any oracle-writable directory (creating a new, empty directory is recommended). All commands in this section should be run by the oracle user unless otherwise noted.)

  1. On Linux DB nodes, set the library path on all nodes using the commands that follow (substitute proper RDBMS ORACLE_HOMEs):
  2. (root)# dcli -g dbs_group -l root mkdir -p /usr/local/lib
  3. (root)# dcli -g dbs_group -l root ln -s /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so /usr/local/lib/libnnz11.so
  4. (root)# dcli -g dbs_group -l root ln -s /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1 /usr/local/lib/libclntsh.so.11.1
  5. (root)# dcli -g dbs_group -l root ln -s /lib64/libfuse.so.2 /usr/local/lib/libfuse.so.2
  6. (root)# dcli -g dbs_group -l root 'echo /usr/local/lib >> /etc/ld.so.conf.d/usr_local_lib.conf'
  7. (root)# dcli -g dbs_group -l root ldconfig

9. Create a new TNS_ADMIN directory ($HOME/dbfs/tnsadmin) for exclusive use by the DBFS mount script.

  1. (oracle)$ dcli -g dbs_group -l oracle mkdir -p $HOME/dbfs/tnsadmin
  2. Create the $HOME/dbfs/tnsadmin/tnsnames.ora file with the following contents on the first node. This example presumes that the name of the DBFS repository database is fsdb and the instance on the first node is named fsdb1. If your RDBMS ORACLE_HOME is not /u01/app/oracle/product/11.2.0/dbhome_1, then change the PROGRAM and ENVS settings accordingly).
  3. fsdb.local =
  4. (DESCRIPTION =
  5. (ADDRESS =
  6. (PROTOCOL=BEQ)
  7. (PROGRAM=/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle)                                       <<<<<<注意修改这个路径
  8. (ARGV0=oraclefsdb1)
  9. (ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')
  10. (ENVS='ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1,ORACLE_SID=fsdb1') <<<<<<注意修改实例名
  11. )
  12. (CONNECT_DATA=(SID=fsdb1))                                                                                                             <<<<<<注意修改实例名
  13. )
  14. On other nodes, create similar entries (all using the name "fsdb.local") and change all occurrences of fsdb1 to the appropriate instance name to match the instance name running on the node where that tnsnames.ora file resides. The tnsnames.ora file on each node will be slightly different so that each tnsnames.ora file references the instance running locally on that node.

10. On each node, create the $HOME/dbfs/tnsadmin/sqlnet.ora file with the same contents on each node after making the proper substitution for <HOMEDIR_PATH_HERE>:

  1. WALLET_LOCATION =
  2. (SOURCE=(METHOD=FILE)
  3. (METHOD_DATA=(DIRECTORY=<HOMEDIR_PATH_HERE>/dbfs/wallet))   <<<<<< 注意,这里要使用全路径,不能使用变量
  4. )
  5. SQLNET.WALLET_OVERRIDE = TRUE
  6. Ensure you substitute the correct path for the DIRECTORY attribute. You may not use variables in this path - it must be a literal full path.
  7. Copy the file to all nodes using dcli:
  8. (oracle)$ dcli -g ~/dbs_group -l oracle -d $HOME/dbfs/tnsadmin -f $HOME/dbfs/tnsadmin/sqlnet.ora

11. Create a wallet directory on one database server as the oracle user. For example:

  1. (oracle)$ mkdir -p $HOME/dbfs/wallet
  2. Create an empty auto-login wallet:
  3. (oracle)$ mkstore -wrl $HOME/dbfs/wallet -create
  4. Add the necessary credentials to the wallet. The credentials can be specific for the connect string used as shown here:
  5. (oracle)$ mkstore -wrl $HOME/dbfs/wallet -createCredential fsdb.local dbfs_user dbfs_passwd
  6. Copy the wallet files to all database nodes.
  7. (oracle)$ dcli -g ~/dbs_group -l oracle mkdir -p $HOME/dbfs/wallet
  8. (oracle)$ dcli -g ~/dbs_group -l oracle -d $HOME/dbfs/wallet -f $HOME/dbfs/wallet/ewallet.p12
  9. (oracle)$ dcli -g ~/dbs_group -l oracle -d $HOME/dbfs/wallet -f $HOME/dbfs/wallet/cwallet.sso

12. Ensure that the TNS entry specified above (fsdb.local in the example) is defined and working properly (checking with "TNS_ADMIN=/home/oracle/dbfs/tnsadmin tnsping fsdb.local" is a good test).

  1. (oracle)$ dcli -g ~/dbs_group -l oracle "export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1; TNS_ADMIN=$HOME/dbfs/tnsadmin /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnsping fsdb.local | grep OK"
  2. dm01db01: OK (20 msec)
  3. dm01db02: OK (30 msec)

下载脚本 mount-dbfs.sh 到一个DB节点上的临时位置   (如 /tmp/mount-dbfs.sh). 运行 dos2unix防止文件格式不兼容。

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

mount-dbfs.sh 脚本是后续挂载DBFS文件系统的时候都要调用的,其中涉及一下参数,需要根据实际环境进行设置

  1. 主要是以下参数需要设置
  2. DBNAME
  3. MOUNT_POINT
  4. DBFS_USER
  5. ORACLE_HOME (should be the RDBMS ORACLE_HOME directory)
  6. LOGGER_FACILITY (used by syslog to log the messages/output from this script)
  7. MOUNT_OPTIONS
  8. DBFS_PASSWD (used only if WALLET=false)                                    <<<<<如果 WALLET=true,这个设置与否都无所谓,当调用的时候会去查看wallert文件
  9. DBFS_PWDFILE_BASE (used only if WALET=false)
  10. WALLET (must be true or false)                                                           <<<<<如果 WALLET=true,会使用 DBFS_PASSWD 去连接并挂载DBFS
  11. TNS_ADMIN (used only if WALLET=true)
  12. DBFS_LOCAL_TNSALIAS

13. 修改后将文件拷贝到每个服务器的适当目录下,这里就使用GI_HOME/crs/script,并使用root设置相应的权限

  1. (root)# dcli -g ~/dbs_group -l root -d /u01/app/11.2.0/grid/crs/script -f /tmp/mount-dbfs.sh
  2. (root)# dcli -g ~/dbs_group -l root chown oracle:dba /u01/app/11.2.0/grid/crs/script/mount-dbfs.sh
  3. (root)# dcli -g ~/dbs_group -l root chmod 750 /u01/app/11.2.0/grid/crs/script/mount-dbfs.sh

14. 通过以下脚本,来实现将DBFS作为一种资源注册到CRS,以使用CRS来管理DBFS。使用数据库的owner(既oracle)来执行以下脚本,根据实际情况适当修改ORACLE_HOME(其为grid home) 和DBNAME(数据库名),还可以注册多个DBFS文件系统到CRS,不过这里就不讲了,有机会再更新。

  1. ---注:这个脚本只要在一个节点执行就可以了
  2. ##### start script add-dbfs-resource.sh
  3. #!/bin/bash
  4. ACTION_SCRIPT=/u01/app/11.2.0/grid/crs/script/mount-dbfs.sh
  5. RESNAME=dbfs_mount
  6. DBNAME=fsdb
  7. DBNAMEL=`echo $DBNAME | tr A-Z a-z`
  8. ORACLE_HOME=/u01/app/11.2.0/grid
  9. PATH=$ORACLE_HOME/bin:$PATH
  10. export PATH ORACLE_HOME
  11. crsctl add resource $RESNAME \
  12. -type local_resource \
  13. -attr "ACTION_SCRIPT=$ACTION_SCRIPT, \
  14. CHECK_INTERVAL=30,RESTART_ATTEMPTS=10, \
  15. START_DEPENDENCIES='hard(ora.$DBNAMEL.db)pullup(ora.$DBNAMEL.db)',\
  16. STOP_DEPENDENCIES='hard(ora.$DBNAMEL.db)',\
  17. SCRIPT_TIMEOUT=300"
  18. ##### end script add-dbfs-resource.sh
  19. Then run this as the Grid Infrastructure owner (typically oracle) on one database server only:
  20. (oracle)$ sh ./add-dbfs-resource.sh

15.通过Oracle Clusterware来管理 DBFS挂载与卸载

资源注册成功后,可以通过crsctl  stat res dbfs_mount  来查看到 dbfs_mount 资源,其所有的节点状态是 OFFLINE:

  1. (oracle)$ <GI_HOME>/bin/crsctl stat res dbfs_mount -t
  2. --------------------------------------------------------------------------------
  3. NAME           TARGET  STATE        SERVER                   STATE_DETAILS
  4. --------------------------------------------------------------------------------
  5. Local Resources
  6. --------------------------------------------------------------------------------
  7. dbfs_mount
  8. OFFLINE OFFLINE      dscbac05
  9. OFFLINE OFFLINE      dscbac06

17.执行crsctl start resource dbfs_mount,将会挂载DBFS到全部的节点:

  1. (oracle)$ <GI_HOME>/bin/crsctl start resource dbfs_mount
  2. CRS-2672: Attempting to start 'dbfs_mount' on 'dscbac05'
  3. CRS-2672: Attempting to start 'dbfs_mount' on 'dscbac06'
  4. CRS-2676: Start of 'dbfs_mount' on 'dscbac06' succeeded
  5. CRS-2676: Start of 'dbfs_mount' on 'dscbac05' succeeded
  6. (oracle)$ <GI_HOME>/bin/crsctl stat res dbfs_mount -t
  7. --------------------------------------------------------------------------------
  8. NAME           TARGET  STATE        SERVER                   STATE_DETAILS
  9. --------------------------------------------------------------------------------
  10. Local Resources
  11. --------------------------------------------------------------------------------
  12. dbfs_mount
  13. ONLINE  ONLINE       dscbac05
  14. ONLINE  ONLINE       dscbac06

18.挂载成功后,你可以通过df -h查看到DBFS文件系统的信息 Also, the default startup for this resource is "restore" which means that if it is online before Clusterware is stopped, it will attempt to come online after Clusterware is restarted. For example:

  1. (oracle)$ df -h /dbfs_direct
  2. Filesystem            Size  Used   Avail Use% Mounted on
  3. dbfs                      1.5M   40K  1.4M   3% /dbfs_direct
  4. To unmount DBFS on all nodes, run this as the oracle user:
  5. (oracle)$ <GI_HOME>/bin/crsctl stop res dbfs_mount

19.DBFS配置过程中,遇到一段插曲
通过crsctl显示状态是online,但是文件系统不能被访问,当访问的时候,会遇到df: `/dbfs_direct': Input/output error错误,后来应用patch 13340960,问题解决。

  1. [oracle@dm03db01 tmp]$ /u01/app/11.2.0.3/grid/bin/crsctl stat res dbfs_mount -t
  2. --------------------------------------------------------------------------------
  3. NAME           TARGET  STATE        SERVER                   STATE_DETAILS
  4. --------------------------------------------------------------------------------
  5. Local Resources
  6. --------------------------------------------------------------------------------
  7. dbfs_mount
  8. ONLINE  ONLINE       dm03db01
  9. ONLINE  ONLINE       dm03db02
  10. ONLINE  ONLINE       dm03db03
  11. ONLINE  ONLINE       dm03db04
  12. [oracle@dm03db01 tmp]$ /u01/app/11.2.0.3/grid/crs/script/mount-dbfs.sh status
  13. Checking status now
  14. Check -- ONLINE
  15. [oracle@dm03db01 tmp]$ cd /dbfs_direct
  16. -bash: cd: /dbfs_direct: Input/output error
  17. [oracle@dm03db01 tmp]$ df -h /dbfs_direct
  18. df: `/dbfs_direct': Input/output error

详情请参考oracle官方文档:
Configuring DBFS on Oracle Database Machine (Doc ID 1054431.1)
Accessing Dbfs Using Oracle Wallet Fails With Input/output error (Doc ID 1358194.1)

How to create DBFS file system相关推荐

  1. remote couldn‘t create file: Read-only file system (remount failed)解决方法

    解决android /system目录中无法写入文件的问题 具体报错信息是 remote couldn't create file: Read-only file system Skipping /s ...

  2. failed to copy ‘xxx‘ to ‘system/bin/xxx‘: remote couldn‘t create file: Read-only file system

    1. 错误描述 adb: error: failed to copy 'mdm-rmc-agent' to 'system/bin/mdm-rmc-agent': remote couldn't cr ...

  3. adb传输文件报错couldn‘t create file:Read-only file system

    使用adb push命令传输文件,报错couldn't create file:Read-only file system 解决方法: 输入adb disable-verity adb reboot ...

  4. C# Create Access File

      1         /// <summary>   2         /// ADOX objects   3         /// 创建Access数据   4          ...

  5. 转:经典论文翻译导读之《Google File System》

    首页 所有文章 资讯 Web 架构 基础技术 书籍 教程 Java小组 工具资源 - 导航条 -首页所有文章资讯Web架构基础技术书籍教程Java小组工具资源 经典论文翻译导读之<Google ...

  6. GFS - The Google File System

    The Google File System http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.125.789&rep=rep1 ...

  7. Could not find a file system implementation for scheme ‘hdfs‘.

    /home/appleyuchi/Java/jdk1.8.0_131/bin/java -javaagent:/home/appleyuchi/下載/software/idea-IU-183.5912 ...

  8. Google File System设计方面的问题汇总

    1.Google File System概述 google file system是一个分布式文件系统,针对的是数据密集型应用,提供容错功能,运行在低廉的服务器上,同时给大量的用户提供高性能服务.尽管 ...

  9. 边做边学:《 Inter Planetary File System》简介

    by Niharika Singh 由Niharika Singh 边做边学:< Inter Planetary File System>简介 (Learn by doing: a nic ...

最新文章

  1. 使用Nomad构建弹性基础架构:计划和自我修复
  2. E百科 | 基于MEC的边缘AI服务
  3. windows2003+iis6.0+php(fastcgi)5.3+wincache+memcached
  4. Django基本概念、安装、配置到实现框架,Xmind学习笔记
  5. oracle fnd file.log,OracleEBSWIP模块DebugLog收集方法
  6. BZOJ1123 [POI2008]BLO
  7. 洛谷P2770 航空路线问题(费用流)
  8. xpath批量下载简历模板
  9. origin 8.0 win 7 破解版安装及使用教程
  10. 基于MATLAB的单相电压型逆变电路,基于MatlabSimulink_的电压型单相全桥逆变电路.doc...
  11. Linux:邮箱客户端
  12. 红孩儿编辑器的开发规范
  13. 计算机安全监察word,全国计算机统考押题计算机安全
  14. KF与无迹卡尔曼滤波详解
  15. 基于流文件和SMIL同步制作的有声绘本
  16. 第 3-7 课:延伸——Flutter Android Studio 开发环境的搭建
  17. php用户登录论坛系统,discuz论坛 用户登录 后台程序代码
  18. 取代公司债电话交易员?高盛新算法可自动提供债券价格
  19. web安全渗透测试的大纲
  20. 随笔:幽灵一样的基类

热门文章

  1. 洛谷P5273 【模板】多项式幂函数 (加强版)
  2. FastDFS图片服务器
  3. Swarm 如何存储数据?- 每天5分钟玩转 Docker 容器技术(103)
  4. 记真实自己,炫精彩人生---《爱记》app使用体验
  5. 2015 年最受 Linux 爱好者欢迎的软硬件大盘点
  6. PHP分页类(较完美)
  7. SQL server 实例教程
  8. .NET Core竟然无法在Mac下进行build
  9. ubuntu 12.04/11.10 PPA 安装 Nvidia 295.59
  10. Window 7上架设SSRS 2005时遇到的几点小麻烦