[20120926]DBFS测试.txt

[20120926]DBFS测试.txt
    DBFS就是Oracle数据库11gR2中提供的能够在Linux操作系统中将Oracle数据库当成文件系统来使用的功能。在DBFS内部,
文件是以SecureFiles LOBs(对比与以前的BasicFiles LOBs)的形式存储在数据表中。
   
    自己做一些测试:
    在测试过程中参考了链接: http://juliandyke.wordpress.com/2011/11/02/dbfs/
SQL> select  * from v$version ;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

看了一些文档,要安装fuse.http://fuse.sourceforge.net
我的测试机器是Red Hat Enterprise Linux AS release 4 (Nahant Update 3),很老的系统,内核
# cat /proc/version
Linux version 2.6.9-34.ELsmp (bhcompile@hs20-bc1-1.build.redhat.com) (gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)) #1 SMP Fri Feb 24 16:56:28 EST 2006
我选择fuse-2.7.4.tar.gz来安装,
其他我测试没有生成fuse模块,很久没有搞kernel这些东西,暂时先放一下.
编译很简单,三部曲,解压,进入目录:
./configure
make 
make install
# /sbin/modprobe fuse
# chmod 666 /dev/fuse
1.建立DBFS文件系统:
create tablespace dbfs datafile '/u01/app/oracle11g/oradata/test/dbfs01.dbf' size 100m;
$ sqlplus / as sysdba
SQL> grant dbfs_role to scott;
Grant succeeded.
链接: http://juliandyke.wordpress.com/2011/11/02/dbfs/
    To create a file system use the dbms_create_filesystem.sql script. which is located in $ORACLE_HOME/rdbms/admin. This script
calls dbms_create_filesystem_advanced.sql which is located in the same directory. In my version, SQL*Plus was unable to locate
the latter script. unless it was in the current working directory. Therefore I had to change directory to $ORACLE_HOME/rdbms/admin
before executing SQL*Plus. For example:
    建立文件系统使用脚本dbms_create_filesystem.sql,位于$ORACLE_HOME/rdbms/admin.
[oracle@server1]$ cd $ORACLE_HOME/rdbms/admin
[oracle@server1]$ sqlplus scott/xxxx
SQL> @dbfs_create_filesystem.sql DBFS dbfs
链接: http://juliandyke.wordpress.com/2011/11/02/dbfs/
    The dbfs_create_filesystem.sql script. takes two parameters; the tablespace name (DBFS1) and the file system name (dbfs1).
In retrospect I should have assigned different names to the tablespace and file system.
--注意我的表空间dbfs,file system name=>dbfs.定义与他的不同.
2.安装DBFS文件系统:
    Now the new file system exists within the database. However, we cannot access it externally yet. A new utility called 
dbms_client which is shipped in $ORACLE_HOME/bin in Oracle 11.2.0.1 and above.allows the DBFS file system to be mounted 
and managed from the command line. The 11.2.0.1 version of this utility is quite basic and it is easy to imagine customer
feedback will drive improvements in functionality in subsequent releases.
    As the root user create a mount point. In this case the mount point will be called /mnt/dbfs1 and will be owned by the 
oracle user:
[root@server1]# mkdir /mnt/dbfs
[root@server1]# chown oracle:dba /mnt/dbfs
[root@server1]# chmod 775 /mnt/dbfs ==> 这个是我添加,不然mount会错误.
=> fusermount: user has no write access to mountpoint /mnt/dbfs
    In Oracle 11.2.0.1, unlike almost all other tools and utilities in $ORACLE_HOME/bin the dbms_client utility does not have
a wrapper script. On my server invoking dbfs_client failed with the following error:
[oracle@server1]$ cd $ORACLE_HOME/bin
[oracle@server1]$ ./dbfs_client
    ./dbfs_client: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory
--^_^,我的正常,没有这个提示,说明LD_LIBRARY_PATH环境变量配置正确.....
    This version of the dbfs_client utility does not support the bequeath protocol, so on the server it is not possible to 
identify the target instance using the $ORACLE_SID environment variable. It is therefore necessary to ensure that a TNS 
address is specified in $TNS_ADMIN/tnsnames.ora.
TEST=
(DESCRIPTION=
  (ADDRESS=
    (PROTOCOL=TCP)(HOST=vm7)(PORT=1521)
  )
  (CONNECT_DATA=(SERVICE_NAME=TEST))
)
--按照这个建议,需要配置tnsnames.ora.即使在服务端.
安装dbfs的命令如下:
$ cd $ORACLE_HOME/bin
$ ./dbfs_client scott@40 /mnt/dbfs
    A password will be requested. In this case it is the Oracle database password for the US01 user.
    By default dbfs_client will block until the file system is un-mounted.
    In this version it is possible to workaround the blocking of dbfs_client using the nohup command to run the utility in 
the background. For example:
[oracle@server1]$ cd $ORACLE_HOME/bin
[oracle@server1]$ nohup ./dbfs_client scott@40 /mnt/dbfs &
    In another shell session verify that the file system has been mounted using the mount command. For example:
# mount | column -t
/dev/sda3  on  /                         type  ext3         (rw)
none       on  /proc                     type  proc         (rw)
none       on  /sys                      type  sysfs        (rw)
none       on  /dev/pts                  type  devpts       (rw,gid=5,mode=620)
usbfs      on  /proc/bus/usb             type  usbfs        (rw)
/dev/sda2  on  /boot                     type  ext3         (rw)
none       on  /dev/shm                  type  tmpfs        (rw,size=3G)
/dev/sda6  on  /u01                      type  ext3         (rw)
/dev/sdb1  on  /data                     type  ext3         (rw)
none       on  /proc/sys/fs/binfmt_misc  type  binfmt_misc  (rw)
sunrpc     on  /var/lib/nfs/rpc_pipefs   type  rpc_pipefs   (rw)
dbfs       on  /mnt/dbfs                 type  fuse         (rw,nosuid,nodev,max_read=1048576,default_permissions,user=oracle11g)
=>按照文档的提示,执行后挂在后台,知道umount才退出.
    At this point it is possible to navigate into the new file system from the Linux shell using commands such as pwd, cd, 
mkdir, cp, rm etc.
这样可以像操作文件系统那样操作该目录/mnt/dbfs.
我做了一些测试:
$ ls -lR /mnt/
/mnt/:
drwxr-xr-x  3 root   root        0 Sep 26 10:50 dbfs
/mnt/dbfs:
total 0
drwxrwxrwx  3 root root 0 Sep 26 10:32 dbfs
/mnt/dbfs/dbfs:
total 0
--很奇怪,root用户看到的是这样:
# ls -l /mnt
?---------  ? ?      ?           ?            ? dbfs

$ cd /mnt/dbfs/dbfs
$ cp /tmp/fuse-2.7.4/README .
$ cp /etc/passwd .
$ ls -l
total 15
-rw-r--r--  1 oracle11g oinstall  2874 Sep 26 10:50 passwd
-rw-r--r--  1 oracle11g oinstall 11430 Sep 26 10:51 README
--感觉有点慢!不知道是否我的测试机器不行!
3.Unmounting a DBFS filesystem
    To unmount the DBFS file system use the fusemount command. For example:
fusermount -u /mnt/dbfs
$ mount | column -t
/dev/sda3  on  /                         type  ext3         (rw)
none       on  /proc                     type  proc         (rw)
none       on  /sys                      type  sysfs        (rw)
none       on  /dev/pts                  type  devpts       (rw,gid=5,mode=620)
usbfs      on  /proc/bus/usb             type  usbfs        (rw)
/dev/sda2  on  /boot                     type  ext3         (rw)
none       on  /dev/shm                  type  tmpfs        (rw,size=3G)
/dev/sda6  on  /u01                      type  ext3         (rw)
/dev/sdb1  on  /data                     type  ext3         (rw)
none       on  /proc/sys/fs/binfmt_misc  type  binfmt_misc  (rw)
sunrpc     on  /var/lib/nfs/rpc_pipefs   type  rpc_pipefs   (rw)
--只能做大概的了解.

				
时间: 2024-09-20 14:35:41

[20120926]DBFS测试.txt的相关文章

[20170428]延迟块清除测试.txt

[20170428]延迟块清除测试.txt --//做一个延迟块清除测试,前面的测试太乱了,思路非常不清楚. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ------------------------------------------------------------------

[20170623]传输表空间补充测试.txt

[20170623]传输表空间补充测试.txt --//昨天测试了使用dblink+传输表空间,链接如下:http://blog.itpub.net/267265/viewspace-2141115/ --//今天补充测试看看加参数SQLFILE生成的脚本是什么内容. impdp scott/book network_link=l_dbcn1 transport_tablespaces=users transport_datafiles=/home/oracle/backup/sugar01.d

[20151109]提升scn号11g测试.txt

[20151109]提升scn号11g测试.txt --以前的测试都在10g下进行的,在11.2.0.4下重复测试. 1.测试环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ------------------------------------------------------------

[20170214]在线重定义测试.txt

[20170214]在线重定义测试.txt --//以前测试过,重复测试,因为生产系统要做一次相同的操作. --//实际的原理利用物化事务.注例子好像来源于piner的<构建oracle高可用环境>,当时版本是9i,好像没有 --//dbms_redefinition.copy_table_dependents函数. 1.准备工作: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER

[20170221]nocache工具的小测试.txt

[20170221]nocache工具的小测试.txt --nocache 这个小工具可以显示文件在缓存的数量. --其中 cachestats 有一个-v  参数可以以表格形式显示.看看它的标识是否正确. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- -------------------

[20140324]延迟块提交测试.txt

[20140324]延迟块提交测试.txt 做一个延迟块提交测试.主要出现一般是修改许多记录,修改后当前块已经不在buffer,在commit时,如果这时要读取在磁盘的数据块代 价太大,oracle使用一种延迟机制,在下次select时读取它,提交修改信息,这个时候产生redo信息. SCOTT@test> @ver BANNER -------------------------------------------------------------------------------- Or

[20120813]11GR2下flashback data archive的测试.txt

[20120813]11GR2下flashback data archive的测试.txt         oracle 11GR2有一个新特性,就是flashback data archive,就是通过一个表空间记录表的一些变化,查询历史数据.自己知道这个特性,从来也没有测试过.实际上这个就是flashback table的扩展(个人认为)!. 测试如下: 1.测试环境: SQL> select * from v$version ; BANNER -----------------------

[20130522]service以及一些falover的测试.txt

[20130522]service以及一些falover的测试.txt 以前我记得我第一次安装rac的时候,那个时候许多东西不懂,基本按照人家写的文档安装,其中的辛苦只有自己知道.对于service名之类的东西,更加不理解. 直到看一些相关书籍,才慢慢一点点理解oracle服务以及falover的含义. 比如在rac中. $ ./dba_crs.perl HA Resource                                  TYPE        Target      St

[20140425]11GR2 truncate后恢复测试.txt

[20140425]11GR2 truncate后恢复测试.txt --做一个truncate后恢复测试在11GR2下,我的测试环境使用使用dataguard.备用库打开flashback. --可以利用在备用库flashback到truncate前,然后在传输到主库的方式看看. 1.建立测试环境: -- 我的测试环境:primary的tnsnames别名test,standby主机的tnsnames别名testdg.数据库版本:11GR2. -- 备用库打开在read only模式,并且rea