APPLIES TO:
Oracle Database 12c Standard Edition 2 and Enterprise Edition: 12.1.0.2.0, 12.2.0.1.0
Oracle Database Linux Server 7.2, 7.3
ISSUE 1: Missing libfuse.so
When running
$ dbfs_client dbfs_user@pdb1 /mnt/dbfs
Got error:
Fail to load library libfuse.so.
A dynamic linking error occurred: (libfuse.so: cannot open shared object file: No such file or director
SOLUTION
# cd /usr/lib64
# ln -s libfuse.so.2 libfuse.so
# ldconfig
# ldconfig -p | grep fuse
REFERENCES
- Debugging problems when mounting a DBFS filesystem
http://www.hhutzler.de/blog/debugging-prolbems-when-mounting-a-dbfs/
ISSUE 2: 401 Unauthorized
401 Unauthorized is faced when running https://username:password@machine:port/dbfs
SOLUTION
Change the authentication to Basic execute
SET SERVEROUTPUT ON
DECLARE
l_configxml XMLTYPE;
l_value VARCHAR2(6) := ‘basic’; — (basic/digest)
BEGIN
l_configxml := DBMS_XDB.cfg_get();
IF l_configxml.existsNode(‘/xdbconfig/sysconfig/protocolconfig/httpconfig/authentication/allow-mechanism’) = 0 THEN
— Element should not be missing
dbms_output.put_line (‘ allow-mechanism element is missing ‘);
ELSE
— Update existing element.
SELECT updateXML
(
DBMS_XDB.cfg_get(),
‘/xdbconfig/sysconfig/protocolconfig/httpconfig/authentication/allow-mechanism/text()’,
l_value,
‘xmlns=”http://xmlns.oracle.com/xdb/xdbconfig.xsd”‘
)
INTO l_configxml
FROM dual;
DBMS_OUTPUT.put_line(‘Element updated.’);
END IF;
DBMS_XDB.cfg_update(l_configxml);
DBMS_XDB.cfg_refresh;
END;
/
COMMIT;
REFERENCES
- 12c XDB: 401 Unauthorized (Doc ID 1603713.1)
- Oracle Database File System (DBFS) Enhancements in Oracle Database 12c Release 1 (12.1)
https://oracle-base.com/articles/12c/dbfs-enhancements-12cr1
ISSUE 3: get_dbfs_link/set_dbfs_link API
It looks like the APIs are not accurate in:
- http://docs.oracle.com/database/122/ARPLS/DBMS_LOB.htm#ARPLS66633
- http://docs.oracle.com/database/122/ARPLS/DBMS_LOB.htm#ARPLS66742
SOLUTION
/*
CREATE TABLE TEST_FILE
(
FILE_LOB BLOB,
FILE_NAME VARCHAR2(100 CHAR),
FILE_MIMETYPE VARCHAR2(100 CHAR)
)
*/
— update blob with dbfs link
DECLARE
blob1 BLOB;
BEGIN
UPDATE test_file
SET file_lob = EMPTY_BLOB ()
WHERE file_name = ‘y’;
SELECT file_lob
INTO blob1
FROM test_file
WHERE file_name = ‘y’
FOR UPDATE;
DBMS_LOB.set_DBFS_LINK (blob1, ‘/staging_area/test.jpg’);
COMMIT;
END;
— get dbfs link
— one row only, getting error when returning more rows
SELECT t.*, DBMS_LOB.GET_DBFS_LINK (t.file_lob)
FROM test_file t
WHERE ROWNUM = 1;