ORA-22928
Tried to allow an user to be able to access a directory, but it failed with ORA-22928.
SQL> grant select on directory data_pump_dir to hr;
grant select on directory data_pump_dir to hr
*
ERROR at line 1:
ORA-22928: invalid privilege on directories
ORA-22928 means that the object privilege you specified is invalid for directory objects, although it could be valid for some schema objects.
In this case, SELECT is a valid object privilege only for TABLE and VIEW objects, not for DIRECTORY object.
Solution
In fact, there're 3 valid object privileges that can apply to DIRECTORY object.
- READ
- WRITE
- EXECUTE
A list for all valid object privileges categorized by database objects can be found in the official documentation.
In this case, we should use READ to make the user have the right to access the directory.
SQL> grant read on directory data_pump_dir to hr;
Grant succeeded.
Problem solved.
To know more about granting privileges correctly and properly, please follow the link and have a look.