oracle文件系统挂载点,oracle dbfs文件系统介绍及使用测试
一、DBFS介绍
The Oracle Database File System (DBFS) creates a
standard file system interface on top
of files and directories that are stored indata base
tables. DBFS is similar to NFS in that
it provides a shared network file systemthat looks
like a local file system. Like NFS,
there is a server component and a clientcomponent.
Dbfs在文件和目录之上创建了一个标准的文件系统结构,并且将数据存储在数据库基表里面。DBFS很像NFS,因为它提供了一个与本地文件系统相同的共享的网络文件系统。与NFS一样,由Server与Client组成。
In DBFS, the server is the Oracle Database.Files are
stored as SecureFiles LOBs in a
database table. A set of PL/SQL proceduresimplement
the file system access
primitives such as create, open, read,write, and list
directory. The implementation of
the file system in the database is calledthe DBFS
Content Store. The DBFS Content
Store allows each database user to createone or more
file systems that can be mounted
by clients. Each file system has its owndedicated
tables that hold the file system
content.
在DBFS中,Server为Oracle数据库,文件存储在表的一个SecureFiles LOBs字段里面。一个PLSQL存储过程的集合,提供了访问文件系统的基本操作,比如说create、open、read、write,ls。DBFS目录库允许每个数据库用户创建一个或多个文件系统,并且可以被clients使用。每个文件系统拥有专有的数据表,保证文件系统的内容。
体系结构如下图所示
二、Client端安装fuse
确定fuse版本
uname –a
Linux DB-SERVER-02 2.6.18-164.el5#1 SMP Tue Aug 18
15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
本机kernelversion 2.6.18
Kernel version 2.6.x
x>9都需要使用fuse-2.7.4
下载fuse安装包
下载地址:
或者
检查kernel-devel包
# rpm –q kernel-devel
如果没有安装,挂载安装盘后安装package
安装fuse
$ tar -xzvf fuse-2.7.4.tar.gz
$ cd [fuse_src_dir]
$ ./configure --prefix=/usr
--with-kernel=[yourkernel dir]
$ make
$ sudo su
# make install
# /sbin/depmod
# /sbin/modprobe fuse
# chmod 666 /dev/fuse
# echo "/sbin/modprobe
fuse" >>/etc/rc.modules
示例
查看是否安装了所需安装包
[root@mytest ~]# rpm -q kernel-devel
package kernel-devel is not installed
挂载光盘
[root@mytest dev]# mount /dev/hdc /mnt
mount: block device /dev/hdc iswrite-protected,
mounting read-only安装kernel-devel包
[root@mytest Server]# rpm -ivh
kernel-devel-2.6.18-308.el5.x86_64.rpm
Preparing... ###########################################
[100%]
1:kernel-devel
###########################################[100%]
查看kernelversion
[root@mytest Server]# uname -a
Linux mytest 2.6.18-308.el5#1 SMP Sat Feb 25 12:40:07
EST 2012 x86_64 x86_64 x86_64 GNU/Linux
ftp将fuse2.7.4上传至服务器/root目录下
[root@mytest ~]# pwd
/root
[root@mytest ~]# ls -l fuse-2.7.4.tar.gz
-rw-r--r-- 1 root root 506658 Jun 11 13:54
fuse-2.7.4.tar.gz
解压
[root@mytest ~]# tar -xzvf fuse-2.7.4.tar.gz
[root@mytest ~]# cd fuse-2.7.4
安装
[root@mytest fuse-2.7.4]#./configure
[root@mytest fuse-2.7.4]#make
[root@mytest fuse-2.7.4]#make install
[root@mytest fuse-2.7.4]#/sbin/depmod
[root@mytest fuse-2.7.4]#/sbin/modprobe fuse
[root@mytest fuse-2.7.4]#chmod 666 /dev/fuse
[root@mytest fuse-2.7.4]#echo "/sbin/modprobe
fuse" >> /etc/rc.modules
三、Server端Oracle数据库配置
Server端配置流程
1创建表空间
新建的表空间用来存储dbfs中相关数据。
2创建用户
新建用户用来管理dbfs相关的文件以及源数据
3授权
管理dbfs的用户需要拥有相关权限
4执行dbfs初始化脚本
Dbfs配置脚本路径:
$ORACLE_HOME/rdbms/admin/dbfs_create_filesystem_advanced
注意,需要使用新建的用户执行该脚本。
示例
使用dba用户登录
[oracle@mytest~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0Production on Thu Aug 2
13:40:42 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
开启数据库
SQL>startup
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed
Size
2213896 bytes
Variable
Size
956303352 bytes
Database
Buffers 687865856 bytes
Redo Buffers
7135232 bytes
Database mounted.
Database opened.
创建表空间fsts(这里使用大文件表空间)
SQL>create bigfile tablespace
fsts
2 datafile
'/u01/apps/oracle/oradata/david/fsts01.dbf'
3 size500m ;
Tablespace created.
创建用户dexter
SQL> create user dexter identified byxiaojun
default tablespace fsts quota unlimited on fsts ;
User created.
授权
SQL>grant create session,create table , create
procedure , dbfs_role to dexter ;
Grant succeeded.
SQL> conn dexter/xiaojun
Connected.
执行初始化脚本
SQL>@?/rdbms/admin/dbfs_create_filesystem_advanced
fsts dir1 nocompressnodeduplicate noencrypt non-partition
四、客户端挂载
客户端使用需要用到dbfs_client命令,相关的程序都在Oracle client中,所以客户端必须安装Oracle client。
客户端配置流程
1.使用root用户
2. Add a new library path.
Command:
# echo "/usr/local/lib"
>>/etc/ld.so.conf.d/usr_local_lib.conf
3. Change directory to lib , and
create thefollowing symbolic links to the
libclntsh.so.11.1 and
libnnz11.so libraries.
Command:
# cd /usr/local/lib
# ln -s
$ORACLE_HOME/lib/libclntsh.so.11.1
# ln -s $ORACLE_HOME/lib/libnnz11.so
4. Locate libfuse.so, and create a
symbolic linkthis library.
# locate libfuse.so
determined_path /libfuse.so
Command:
# ln –s determined_path
/libfuse.so
5. Run ldconfig to create the
links and cache for the new symbolic links.
Command:
# ldconfig
6. Create a symbolic link to
dbfs_client in /sbin as mount.dbfs.
Command:
# ln -s
$ORACLE_HOME/bin/dbfs_client/sbin/mount.dbfs
7. Login as admin user. (Oracle
recommends th atyou do not perform the next step
as root user.)
8. Mount the DBFS store.
Command:
% dbfs_client @/dbfsdb
-owallet,rw,user,direct_io /mnt/dbfs
9. [Optional] To test if the previo
us step wassuccessful, list the dbfs directory.
Command:
# ls /mnt/dbfs
后台执行:
nohup dbfs_client
ETLUser@DBConnectString/mnt/dbfs < passwordfile.f &
示例
[oracle@mytest~]$ mkdir /u01/dbfs
[oracle@mytest~]$ ls -l /u01
drwxr-xr-x 2 oracle
oinstall 4096 Aug 2 13:51 dbfs
[root@mytest~]# echo "/usr/local/lib"
>>/etc/ld.so.conf.d/usr_local_lib.conf
[root@mytest~]# cd /usr/local/lib
[root@mytestlib]# ln -s
/u01/apps/oracle/product/11gr2/db_1/lib/libclntsh.so.11.1
[root@mytestlib]# ln -s
/u01/apps/oracle/product/11gr2/db_1/lib/libnnz11.so
[root@mytestlib]# find / -name libfuse.so
/usr/local/lib/libfuse.so
[root@mytestlib]# ln -s /usr/local/lib/libfuse.so
[root@mytestlib]# ldconfig
[root@mytestlib]# ln -s
/u01/apps/oracle/product/11gr2/db_1/bin/dbfs_client/sbin/mount.dbfs
[root@mytestlib]# su - oracle
配置密码文件
使用oracle用户作为dbfs挂载的管理用户
创建密码文件
echo xiaojun > passwd.t
查看客户端的配置
[oracle@mytest~]$ vi
$ORACLE_HOME/network/admin/tnsnames.ora
DAVID =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =mytest)(PORT
= 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = david)
)
)
远程可以登录
[oracle@mytest~]$ sqlplus dexter/xiaojun@david
SQL*Plus: Release 11.2.0.1.0Production on Thu Aug 2
14:17:32 2012
Copyright (c) 1982, 2009, Oracle. All rights
reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release
11.2.0.1.0- 64bit Production
With the Partitioning, OLAP, Data Mining andReal
Application Testing options
SQL>
执行挂载命令
nohup dbfs_client dexter@david /u01/dbfs < passwd.t
&
[1] 11665
[oracle@mytest ~]$ nohup: appending outputto
`nohup.out'
[oracle@mytest ~]$ df -h
Filesystem
Size Used Avail Use% Mounted on
/dev/sda1
30G 15G 14G 53% /
/dev/sda3
3.9G 473M 3.3G 13% /tmp
tmpfs
2.0G 943M 1.1G 48% /dev/shm
/dev/hdc
3.7G 3.7G 0 100% /mnt
dbfs
1.5M 57K 1.4M 4% /u01/dbfs
五、测试
[oracle@mytest ~]$ ll /u01
drwxr-xr-x 3 root
root
0 Aug 2 14:20 dbfs
[oracle@mytest ~]$ ll /u01/dbfs/
total 0
drwxrwxrwx 3 root root 0 Aug 2 14:09 dir1
[oracle@mytest~]$ echo test > /u01/dbfs/dir1/test.t
[oracle@mytest~]$ ll /u01/dbfs/dir1/
total 1
-rw-r--r--1 oracle oinstall 5 Aug 2 14:21 test.t
[oracle@mytest ~]$ cat /u01/dbfs/dir1/test.t
Test
[oracle@mytest~]$ mkdir /u01/dbfs/dir1/sub_dir
[oracle@mytest~]$ echo ffccddssdd >
/u01/dbfs/dir1/sub_dir/test2.t
[oracle@mytest~]$ sqlplus dexter/xiaojun@david
SQL*Plus: Release 11.2.0.1.0Production on Thu Aug 2
14:28:49 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release
11.2.0.1.0- 64bit Production
With the Partitioning, OLAP, Data Mining andReal
Application Testing options
Pathtype=1表示文件2表示目录
1.SQL> select pathname , item , pathtype from t_dir1 ;
2.PATHNAME ITEM PATHTYPE
3.-------------------- ----------------------------
4./test.t test.t 1
5./sub_dir sub_dir 2
6./sub_dir/test2.t test2.t 1
7./ ROOT 2
8./.sfs .sfs 2
9./.sfs/attributes attributes 2
10./.sfs/tools tools 2
11./.sfs/snapshots snapshots 2
12./.sfs/RECYCLE RECYCLE 2
13./.sfs/content content 2
14.
15.10 rows selected.
SQL>
select pathname , item , pathtypefrom
t_dir1 ;
PATHNAMEITEMPATHTYPE
--------------------
----------------------------
/test.ttest.t1
/sub_dirsub_dir2
/sub_dir/test2.ttest2.t1
/ROOT2
/.sfs.sfs2
/.sfs/attributesattributes2
/.sfs/toolstools2
/.sfs/snapshotssnapshots2
/.sfs/RECYCLERECYCLE2
/.sfs/contentcontent2
10 rows
selected.
配置完成
oracle文件系统挂载点,oracle dbfs文件系统介绍及使用测试相关推荐
- oracle文件系统挂载点,Oracle 集群文件系统 (OCFS)
OCFS第1版是原始设备的一个优秀替代品.它不仅更易于管理和维护,而且克服了255个原始设备的限制.但是,它并不是一个通用集群文件系统.它只能用于存储以下类型的文件: Oracle数据文件 联机重做日 ...
- oracle文件系统挂载点,挂载和取消挂载文件系统概述
挂载和取消挂载文件系统概述 需要首先挂载文件系统,然后才能访问该文件系统上的文件.挂载文件系统时,需要将该文件系统附加到目录(挂载点)并使其对系统可用.始终会挂载根目录 (/) 文件系统.可以将其他任 ...
- oracle文件系统挂载点,挂载和取消挂载 Oracle Solaris 文件系统
挂载和取消挂载 Oracle Solaris 文件系统 ZFS 文件系统可自动进行挂载和取消挂载.通过挂载传统 UFS 文件系统可使该文件系统可用,这会将文件系统附加到指定挂载点的系统目录树.始终会挂 ...
- oracle+磁盘挂载格式化,oracle asm disk格式化恢复—格式化为ext4文件系统
昨天中午接到一位朋友紧急求救电话,大概场景如下,asm data磁盘组一共把个asm disk,但是使用4个lun实现的(也就是说每个lun使用fdisk进行分区),该主机上还有一个lun是用来存放备 ...
- Linux创建文件系统的命令及xfs文件系统介绍
- oracle asm和文件系统,Oracle工具之--ASM与文件系统及跨网络传输文件
Oracle工具之--ASM与文件系统及跨网络传输文件 Oracle DBMS_FILE_TRANSFER可以实现文件系统和ASM磁盘组之间实现文件传输及ASM磁盘组之间跨网络的传输. DBMS_FI ...
- Oracle工具之--ASM与文件系统及跨网络传输文件
Oracle工具之--ASM与文件系统及跨网络传输文件 Oracle DBMS_FILE_TRANSFER可以实现文件系统和ASM磁盘组之间实现文件传输及ASM磁盘组之间跨网络的传输. DBMS_ ...
- Oracle单实例下oracle数据库从文件系统迁移到ASM上
第一步:启动ASM实例(+ASM) [oracle@oracle ~]$ export ORACLE_SID=+ASM [oracle@oracle ~]$ sqlplus / as sysdba S ...
- oracle 安装 挂载磁盘组_ora-15077,ASM磁盘组不能挂载
ora-15077,ASM磁盘组不能挂载2009-09-29 18:51 一.现象分析: 1.数据库和实例服务无法启动,如下: [oracle@rac1 ~]$ crs_stat -t Name ...
最新文章
- CSS Modules
- 吊打 ThreadLocal!
- python 开发板 i2s_[Craftor原创] I2S总线接口设计(Verilog)
- asp.net文件上传进度条控件(破解版~没有时间限制) 多项自定义
- 机器人搏击大赛冠军_机器人的江湖 谁主沉浮——2017格斗机器人大赛侧记
- windows多线程同步互斥--总结
- 卸载阿里云服务器的mysql_阿里云服务器购买,双11领阿里云服务器优惠券!
- 【视频】文本挖掘:主题模型(LDA)及R语言实现分析游记数据
- maven依赖包快速下载
- 成语接龙Java代码实现
- 2020年408真题_2020年港澳台联考真题——化学!
- 基础概念:图片的卷积和池化操作
- RRC协议学习—系统信息(SI)
- 大学英语B-必考词汇400个
- 硬盘的读写原理(图文详解)
- R语言读取tsv文件
- 车牌识别之字符切割2
- 实验 9 音频信号采集及处理
- scrapy 爬取指定贴吧
- 储存quill与php,import – 在扩展Quill方面遇到问题