ORA-65169: error encountered while attempting to copy file

3.7k Views Asked by At

Hi im trying to create clone_link between two ora19 databases due to cloning PDB databases

both DBs have created user like:

CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL;
GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;

i want to copy PDB from DB2 to DB1 so i closed wanted PDB on DB2 and opened for reading:

alter pluggable database testpdb close;
alter pluggable database testpdb open read only;

from DB1 have created clone_link and tried to copy PDB (tns testpdb connection is set to DB2)

--db link to database we want to copy
create database link clone_link
    connect to C##remote_clone_user identified by remote_clone_user using 'testpdb';

-- clone from DB2 to DB1  
create pluggable database testpdb from testpdb@clone_link
    file_name_convert = ('/u01/app/oracle/oradata/', '/testpdb/');

but im getting error :

Error starting at line : 14 in command -
create pluggable database testpdb from testpdb@clone_link
    file_name_convert = ('/u01/app/oracle/oradata/', '/testpdb/')
Error report -
ORA-65169: error encountered while attempting to copy file /u01/app/oracle/oradata/testpdb/testpdb_index.dbf 
ORA-19504: failed to create file "/testpdb/testpdb/testpdb_index.dbf"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 13: Permission denied
Additional information: 3
65169. 00000 -  "error encountered while attempting to copy file %s "
*Cause:    An error was encountered while attempting to copy the file
           while creating a pluggable database.
*Action:   Check additional error messages for the cause of the failure to
           copy the file, and resolve the issue accordingly.

in alert log i see only :

Undo Create of Pluggable Database TESTPDB with pdb id - 7.
**************************************************************
ORA-65169 signalled during: create pluggable database testpdb from testpdb@clone_link
    file_name_convert = ('/u01/app/oracle/oradata/', '/testpdb/')...

i am not sure what permissions need to be set

2

There are 2 best solutions below

0
On

Steps needed to alleviate this issue: This is a permissions issue and you need the /oradata/ directory to have permissions. Follow the steps below or better yet, create a script from the procedure below to resolve the issue:

[oracle@oracle ~]$ ls -l  /u01/app/oracle/product/19.0.0/db_1/mydbfiles/ORCLDB/pdbseed

-rw-r-----. 1 oracle oinstall 104865792 Nov  3 07:29 undotbs01.dbf

So I updated the permissions on the file. It needs to have group write permissions:

[oracle@oracle ~]$ chmod -R 777 /u01/app/oracle/product/19.0.0/db_1/mydbfiles/ORCLDB/pdbseed

[oracle@oracle ~]$ ls -l
/u01/app/oracle/product/19.0.0/db_1/mydbfiles/ORCLDB/pdbseed

-rwxrwxrwx. 1 oracle oinstall 104865792 Nov  3 07:29 undotbs01.dbf

Then it will work:

SQL> CREATE PLUGGABLE DATABASE pdb2 ADMIN USER admin2 IDENTIFIED BY Shane123 ROLES = (dba)
  2  FILE_NAME_CONVERT = ('/u01/app/oracle/product/19.0.0/db_1/mydbfiles/ORCLDB/pdbseed' , '/u01/app/oracle/product/19.0.0/db_1/mydbfiles/ORCLDB/pdb2');

Pluggable database created.

After creating, you can switch the permissions back to before. Although, this is a workaround, if you add it to a script, it works like magic!

0
On

Its working for me in CDB

alter system set "_exadata_feature_on" =true scope=spfile;
shutdown immediate;
startup;