oracle 19c在创建PDB过程中如果使用了带PATH_PREFIX的参数,意味着在创建DIRECTORY目录时需要指定相对路径,而不能指定其它绝对路径。
今天遇到了报错,路径及权限无误,却依然报错。
create or replace directory expdp as '/tmp';
create or replace directory expdp as '/tmp'
* ERROR at line 1:
ORA-65254: invalid path specified for the directory
经排查,在创建Pdb的时候,使用了PATH_PREFIX
CREATE PLUGGABLE DATABASE 库名 ADMIN USER meid1 IDENTIFIED BY "密码"
STORAGE (MAXSIZE UNLIMITED)
DEFAULT TABLESPACE orcl
DATAFILE '/opt/oracle/oradata/ORCLCDB/orcl/db19cpdb01.dbf' SIZE 100M AUTOEXTEND ON
PATH_PREFIX = '/opt/oracle/oradata/ORCLCDB/orcl/'
FILE_NAME_CONVERT = ('/opt/oracle/oradata/ORCLCDB/pdbseed', '/opt/oracle/oradata/ORCLCDB/orcl');
因为在创建PDB的语句中指定了PATH_PREFIX子句,所以PATH_PREFIX指定的路径将作为前缀添加到该PDB的所有本地目录对象中,只能指定基于PATH_PREFIX的相对路径。
正确的操作方式如下:
mkdir -p /opt/oracle/oradata/ORCLCDB/orcl/expdp
sqlplus / as sysdba
SQL> alter session set container=pdb;
SQL> create directory expdp as 'expdp';
SQL> grant read,write on directory expdp to expdp;