Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2800623
  • 博文数量: 389
  • 博客积分: 4177
  • 博客等级: 上校
  • 技术积分: 4773
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-16 23:29
文章分类

全部博文(389)

分类: Oracle

2014-02-23 11:27:10

                                             在ORACLE 12C上实现DBFS

      DBFS的好处有很多,具体可以参考网上相关的资料。在DB内部,文件是以lob方式存在。文件存放
在DBFS,可以通过oracle的DG的特性进行保护之类的功能.

安装fuse和kernel-devel的包

[root@o12c Server]# rpm -Uvh fuse-2.7.4-8.el5.x86_64.rpm
warning: fuse-2.7.4-8.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:fuse                   ########################################### [100%]

[root@o12c Server]# rpm -Uvh fuse-libs-2.7.4-8.el5.x86_64.rpm
warning: fuse-libs-2.7.4-8.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:fuse-libs              ########################################### [100%]

[root@o12c Server]# rpm -Uvh  kernel-devel-2.6.18-194.el5.x86_64.rpm
warning: kernel-devel-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]

配置

[root@o12c Server]# echo user_allow_other >/etc/fuse.conf
[root@o12c Server]# chmod 644 /etc/fuse.conf

[root@o12c ~]# cd  /etc/ld.so.conf.d/
[root@o12c ld.so.conf.d]# echo "/usr/local/lib"> usr_local_lib.conf

新建挂载点和和修改用户
[root@o12c Server]# mkdir -p /data/fs

[root@o12c Server]# chown -R oracle:oinstall /data

[root@o12c fs]# usermod -G fuse oracle
[root@o12c fs]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),104(fuse


创建用户,并授予相关权限.最好是能单独新建一个表空间.

SQL> create user c##frank identified by frank default tablespace users;

User created.

SQL> grant connect,resource,create view,create procedure,dbfs_role to c##frank;

Grant succeeded.

SQL> grant unlimited tablespace to c##frank;

Grant succeeded.

SQL> conn c##frank/frank;
Connected.

SQL> @?/rdbms/admin/dbfs_create_filesystem.sql users FS1
No errors.
--------
CREATE STORE:
begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS1', tbl_name => 'FS1',
tbl_tbs => 'users', lob_tbs => 'users', do_partition => false, partition_key =>
1, do_compress => false, compression => '', do_dedup => false, do_encrypt =>
false); end;
--------
REGISTER STORE:
begin dbms_dbfs_content.registerStore(store_name=> 'FS1', provider_name =>
'sample1', provider_package => 'dbms_dbfs_sfs'); end;
--------
MOUNT STORE:
begin dbms_dbfs_content.mountStore(store_name=>'FS1', store_mount=>'FS1'); end;
--------
CHMOD STORE:
declare m integer; begin m := dbms_fuse.fs_chmod('/FS1', 16895); end;
No errors.
SQL>


为相关的lib建立软链接


[root@o12c ld.so.conf.d]# cd /usr/local/lib
[root@o12c lib]# ln  -s /u01/app/oracle/product/12.1.0/db_1/lib/libclntsh.so.11.1
[root@o12c lib]# ln  -s /u01/app/oracle/product/12.1.0/db_1/lib/libnnz12.so

[root@o12c lib]# locate libfuse.so
/lib64/libfuse.so.2
/lib64/libfuse.so.2.7.4
[root@o12c lib]# cd /usr/local/lib
[root@o12c lib]# ln -s /lib64/libfuse.so.2 libfuse.so

[root@o12c lib]# ldconfig


建立密码文件,并进行挂载
[root@o12c ~]# echo pwd.txt
pwd.txt

[root@o12c ~]# $ORACLE_HOME/bin/dbfs_client -o direct_id /data/fs


可以看到FS1以已经可以通过OS的命令进行访问了.
[root@o12c fs]# cd FS1
[root@o12c FS1]# ls -a
.  ..  .sfs
[root@o12c FS1]# pwd
/data/fs/FS1

 

 

 

 

阅读(3492) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~