18 Using DBFS
The DBFS File System implementation includes creating and accessing the file system and managing it.
- Enabling Advanced SecureFiles LOB Features for DBFS
Using the@dbfs_create_filesystem.sql
command, you can create a partitioned or non-partitioned file system with the compression and deduplicate options. If you want to specify additional options while creating the file system, use theDBMS_DBFS_SFS.CREATEFILESYSTEM
procedure. - Installing DBFS
DBFS is a part of the Oracle Database installation. - Creating a DBFS File System
You can create a partitioned or non-partitioned DBFS File system. - Accessing DBFS File System
This section describes the various interfaces through which you can access the DBFS File System. - Maintaining DBFS
DBFS administration includes tools that perform diagnostics, manage failover, perform backup, and so on. - Shrinking and Reorganizing DBFS Filesystems
DBFS uses Online File system Reorganization to shrink itself, enabling the release of allocated space back to the containing tablespace. - Dropping a File System
You can drop a file system by runningDBFS_DROP_FILESYSTEM.SQL
.
18.1 Enabling Advanced SecureFiles LOB Features for DBFS
Using the @dbfs_create_filesystem.sql
command, you can create a partitioned or non-partitioned file system with the compression and deduplicate options. If you want to specify additional options while creating the file system, use the DBMS_DBFS_SFS.CREATEFILESYSTEM
procedure.
For information about all the additional options that you can use with the DBMS_DBFS_SFS.CREATEFILESYSTEM
procedure, see CREATEFILESYSTEM Procedure in PL/SQL Packages and Types Reference.
Use the @dbfs_create_filesystem.sql
command to quickly create, register, and mount a file system. When you use the DBMS_DBFS_SFS.CREATEFILESYSTEM
procedure to enable additional options while creating a file system, you must additionally run commands to register and mount the file system that you create.
Let's use the DBMS_DBFS_SFS.CREATEFILESYSTEM
procedure to create a file system with the encryption option.
Before you begin, ensure that you have created a wallet with the encryption key. See Administer Key Management in SQL Language Reference.
To create a file system with the encryption option:
- Run the following command.
Syntax
exec dbms_dbfs_sfs.createFilesystem('store_name',tbl_tbs=>'tablespace_name',do_encrypt=> true | false,encryption=> encryption_type, do_dedup=> true | false,do_compress=>true | false);
For reference information about the command options, see CREATEFILESYSTEM Procedure in PL/SQL Packages and Types Reference.
Example
For example, to create a file system in
Test3
store in thetest_fs1
tablespace with the default encryption, compression, and deduplicate options:exec dbms_dbfs_sfs.createFilesystem('test_fs1', tbl_tbs=>'Test3', do_encrypt=>true, encryption=>dbms_dbfs_sfs.ENCRYPTION_DEFAULT, do_dedup=>true, do_compress=>true);
The file system is created with the option you have specified.
-
Run the following command to register the file system that you have created.
Syntax
dbms_dbfs_content.registerStore(store_name => 'filesystem_name', provider_name => 'posix',provider_package => 'dbms_dbfs_sfs') ;
Example
For example, run the following command to register the
test_fs1
file system.dbms_dbfs_content.registerStore(store_name => 'test_fs1', provider_name => 'posix', provider_package => 'dbms_dbfs_sfs') ;
-
Run the following command to mount the file system that you have created.
Syntax
dbms_dbfs_content.mountStore(store_name => 'filesystem_name', store_mount => 'filesystem_name');
Example
For example, run the following command to mount the
test_fs1
file system.dbms_dbfs_content.mountStore(store_name => 'test_fs1', store_mount => 'test_fs1');
Parent topic: Using DBFS
18.2 Dropping a File System
You can drop a file system by running DBFS_DROP_FILESYSTEM.SQL
.
Caution:
When you drop a file system, it deletes all the files and associated metadata. You won't be able to access the files.When you drop a file system, it deletes all the files and associated metadata. You won't be able to access the files. If you want to access the file system after dropping a DBFS, you can restore the file system from a database backup or file system backup.
Depending on the backup policy in your organization, you may have a database backup or file system backup. To restore from a database backup, you'll have to restore the entire database and then use the restored file system. To restore the file system from a file system backup, create a new DBFS and restore the file system from the file system backup.
Parent topic: Using DBFS