FILE_DATASTORE and Security
File and URL datastores enable access to files on the actual database disk. This may be undesirable when security is an issue since any user can browse the file system that is accessible to the Oracle user. Any user attempting to create an index using FILE or URL datastores must have the TEXT DATASTORE ACCESS system privilege granted to the user directly, or the index creation will fail. Granting the user TEXT DATASTORE ACCESS privilege indirectly by granting it to the user’s role does not work and the index creation will still fail. Thus, by default, users are not able to create indexes that use the FILE or URL datastores. Granting TEXT DATASTORE ACCESS to PUBLIC gives any user the privilege to index either an arbitrary file in the file system in the case of FILE datastore and an arbitrary URL in the case of URL datastore and is not recommended.
For example, the following statement grants TEXT DATASTORE ACCESS to the user SCOTT:
grant TEXT DATASTORE ACCESS to SCOTT;
The CREATE INDEX operation will fail when a user that does not have TEXT DATASTORE ACCESS privilege tries to create an index on a FILE or URL datastore. For example:
CREATE INDEX myindex ON mydocument(TEXT) INDEXTYPE IS ctxsys.context
PARAMETERS('DATASTORE ctxsys.file_datastore')
In this case, if the user does not have the TEXT DATASTORE ACCESS privilege granted directly to it, then index creation will fail and returns an error. For users who have the TEXT DATASTORE ACCESS privilege, the index creation will proceed normally.
The user’s privilege is checked any time the datastore is accessed. This includes index creation, index sync, and calls to document services, such as CTX_DOC.HIGHLIGHT.