?Exadata??????DBFS
- by Liu Maclean(???)
?Exadata???DBFS ???????
1. ??fuse RPM
[root@dm01db01 ~]# yum install fuse
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package fuse.x86_64 0:2.7.4-8.0.1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
fuse x86_64 2.7.4-8.0.1.el5 el5_latest 85 k
Transaction Summary
========================================================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 85 k
Is this ok [y/N]: y
Downloading Packages:
fuse-2.7.4-8.0.1.el5.x86_64.rpm | 85 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : fuse 1/1
Installed:
fuse.x86_64 0:2.7.4-8.0.1.el5
[root@dm01db01 ~]# yum install fuse-libs
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package fuse-libs.i386 0:2.7.4-8.0.1.el5 set to be updated
---> Package fuse-libs.x86_64 0:2.7.4-8.0.1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
fuse-libs i386 2.7.4-8.0.1.el5 el5_latest 71 k
fuse-libs x86_64 2.7.4-8.0.1.el5 el5_latest 70 k
Transaction Summary
========================================================================================================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Total download size: 141 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): fuse-libs-2.7.4-8.0.1.el5.x86_64.rpm | 70 kB 00:00
(2/2): fuse-libs-2.7.4-8.0.1.el5.i386.rpm | 71 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 71 kB/s | 141 kB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : fuse-libs 1/2
Installing : fuse-libs 2/2
Installed:
fuse-libs.i386 0:2.7.4-8.0.1.el5 fuse-libs.x86_64 0:2.7.4-8.0.1.el5
Complete!
[root@dm01db01 ~]# yum install fuse-devel
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package fuse-devel.i386 0:2.7.4-8.0.1.el5 set to be updated
---> Package fuse-devel.x86_64 0:2.7.4-8.0.1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
fuse-devel i386 2.7.4-8.0.1.el5 el5_latest 28 k
fuse-devel x86_64 2.7.4-8.0.1.el5 el5_latest 28 k
Transaction Summary
========================================================================================================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Total download size: 57 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): fuse-devel-2.7.4-8.0.1.el5.x86_64.rpm | 28 kB 00:00
(2/2): fuse-devel-2.7.4-8.0.1.el5.i386.rpm | 28 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 21 kB/s | 57 kB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : fuse-devel 1/2
Installing : fuse-devel 2/2
Installed:
fuse-devel.i386 0:2.7.4-8.0.1.el5 fuse-devel.x86_64 0:2.7.4-8.0.1.el5
Complete!
2. ?? DBFS??? ??????
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> @prvtfspi.plb
Package body created.
No errors.
Package body created.
No errors.
?????dbms_dbfs_sfs package
SQL> create tablespace dbfstbs datafile size 20g;
Tablespace created.
SQL> create user maclean_dbfs identified by oracle;
User created.
SQL> grant dba to maclean_dbfs;
Grant succeeded.
@@!!!
SQL> grant dbfs_role to maclean_dbfs;
Grant succeeded.
3. ??DBFS
SQL> conn maclean_dbfs/oracle
Connected.
SQL> @?/rdbms/admin/dbfs_create_filesystem.sql dbfstbs mac_dbfs
No errors.
--------
CREATE STORE:
begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS_MAC_DBFS', tbl_name =>
'T_MAC_DBFS', tbl_tbs => 'dbfstbs', lob_tbs => 'dbfstbs', 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=> 'FS_MAC_DBFS', provider_name
=> 'sample1', provider_package => 'dbms_dbfs_sfs'); end;
--------
MOUNT STORE:
begin dbms_dbfs_content.mountStore(store_name=>'FS_MAC_DBFS',
store_mount=>'mac_dbfs'); end;
--------
CHMOD STORE:
declare m integer; begin m := dbms_fuse.fs_chmod('/mac_dbfs', 16895); end;
No errors.
4. ??mount point
[root@dm01db01 ~]# mkdir /dbfs
[root@dm01db01 ~]# chown oracle:oinstall /dbfs
5. ??library path ?OS
# echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr_local_lib.conf
6. ??????
export ORACLE_HOME=/s01/orabase/product/11.2.0/dbhome_1
[root@dm01db01 ~]# ln -s $ORACLE_HOME/lib/libclntsh.so.11.1 /usr/local/lib/libclntsh.so.11.1
[root@dm01db01 ~]# ln -s $ORACLE_HOME/lib/libnnz11.so /usr/local/lib/libnnz11.so
[root@dm01db01 ~]# ln -s /lib64/libfuse.so.2 /usr/local/lib/libfuse.so.2
7. ??ldconfig
[root@dm01db01 ~]# ldconfig
[root@dm01db01 ~]#
8. ??fusermount???????
[root@dm01db01 ~]# chmod +x /usr/bin/fusermount
[root@dm01db01 ~]# ls -l /usr/bin/fusermount
lrwxrwxrwx 1 root root 15 Sep 7 03:06 /usr/bin/fusermount -> /bin/fusermount
[root@dm01db01 ~]# ls -l /bin/fusermount
-rwsr-x--x 1 root fuse 27072 Oct 17 2011 /bin/fusermount
9. ???????OS
dbfs_client maclean_dbfs@dm01db01:1521/orcl /dbfs
10.
????nohup + &?????mount DBFS,????????????
[oracle@dm01db01 ~]$ echo "oracle" >> dbfs_pw
[oracle@dm01db01 ~]$ nohup dbfs_client maclean_dbfs@dm01db01:1521/orcl /dbfs < dbfs_pw &
[oracle@dm01db01 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
30G 15G 14G 53% /
/dev/sda1 502M 30M 447M 7% /boot
/dev/mapper/VGExaDb-LVDbOra1
99G 20G 75G 21% /u01
tmpfs 81G 0 81G 0% /dev/shm
dbfs-maclean_dbfs@orcl:/
20G 120K 20G 1% /dbfs
[oracle@dm01db01 ~]$ mount
/dev/mapper/VGExaDb-LVDbSys1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw,nodev)
/dev/mapper/VGExaDb-LVDbOra1 on /u01 type ext3 (rw,nodev)
tmpfs on /dev/shm type tmpfs (rw,size=82052m)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
dbfs-maclean_dbfs@orcl:/ on /dbfs type fuse (rw,nosuid,nodev,max_read=1048576,default_permissions,user=oracle)
[oracle@dm01db01 ~]$ ls -l /dbfs/
total 0
drwxrwxrwx 3 root root 0 Sep 14 05:11 mac_dbfs
[oracle@nas ~]$ dbfs_client
--------MOUNT mode:
usage: dbfs_client <db_user>@<db_server> [options] <mountpoint>
db_user: Name of Database user that owns DBFS content repository filesystem(s)
db_server: A valid connect string for Oracle database server
(for example, hrdb_host:1521/hrservice)
mountpoint: Path to mount Database File System(s)
All the file systems owned by the database user will be seen at the mountpoint.
DBFS options:
-o direct_io Bypass the Linux page cache. Gives much better performance for large files.
Programs in the file system cannot be executed with this option.
This option is recommended when DBFS is used as an ETL staging area.
-o wallet Run dbfs_client in background.
Wallet must be configured to get credentials.
-o failover dbfs_client fails over to surviving database instance with no data loss.
Some performance cost on writes, especially for small files.
-o allow_root Allows root access to the filesystem.
This option requires setting 'user_allow_other' parameter in '/etc/fuse.conf'.
-o allow_other Allows other users access to the file system.
This option requires setting 'user_allow_other' parameter in '/etc/fuse.conf'.
-o rw Mount the filesystem read-write. [Default]
-o ro Mount the filesystem read-only. Files cannot be modified.
-o trace_file=STR Tracing <filename> | 'syslog'
-o trace_level=N Trace Level: 1->DEBUG, 2->INFO, 3->WARNING, 4->ERROR, 5->CRITICAL [Default: 4]
-h help
-V version
--------COMMAND mode:
Usage: dbfs_client <db_user>@<db_server> --command command [switches] [arguments]
command: Command to be executed, e.g., ls, cp, mkdir, rm
switches: Switches are described below for each command.
arguments: File names or directory names
NOTE: All database pathnames must be absolute and preceded by dbfs:/
Commands
ls
dbfs_client <db_user>@<db_server> --command ls [switches] target
Switches:
-a Show all files including those starting with '.'
-l Use a long listing format. In addition to the name of each file
print the file type, permissions, size, user and group information
-R List subdirectories recursively
cp
dbfs_client <db_user>@<db_server> --command cp [switches] source destination
Switches:
-r, -R Copy a directory and its contents recursively into the destination directory
rm
dbfs_client <db_user>@<db_server> --command rm [switches] target
Switches:
-r, -R Removes a directory and its contents recursively
mkdir
dbfs_client <db_user>@<db_server> --command mkdir directory_name
Examples
dbfs_client ETLUser@DBConnectString --command ls -l -a dbfs:/staging_area/directory1
dbfs_client ETLUser@DBConnectString --command cp -R /tmp/1-Jan-2009-dump dbfs:/staging_area
dbfs_client ETLUser@DBConnectString --command rm dbfs:/staging_area/hello.txt
dbfs_client ETLUser@DBConnectString --command mkdir dbfs:/staging_area/directory2
[oracle@dm01db01 ~]$ ls -lh /tmp/largefile
-rw-r--r-- 1 oracle oinstall 2.0G Sep 14 08:50 /tmp/largefile
[oracle@dm01db01 ~]$ time dbfs_client maclean_dbfs@dm01db01:1521/orcl --command cp /tmp/largefile dbfs:/mac_dbfs
Password:
/tmp/largefile -> dbfs:/mac_dbfs/largefile
real 0m11.802s
user 0m0.580s
sys 0m2.375s
?Exadata?????2G?????? DBFS???11s => 200MB/s