Tag: PDB Clone

  • Remote PDB Hot Clone over a Database Link in 26ai: Home Lab Run, Including ORA-65294

    Alhamdulillah. After reading a clear write-up on remote PDB cloning between two OCI Base Database Service systems (linked at the end), I wanted to try the same method in my home lab. The lab has no OCI, no TDE and no ASM, so a few steps change, and one error came up that the original article did not hit. Hostnames, IP addresses and passwords are masked.

    Lab environment

    ItemSourceTarget
    Hostlabhost26 (Oracle Linux 9)labhost19 (Oracle Linux 8)
    CDBCDB26CDB19 (upgraded from 19c with AutoUpgrade)
    Release26ai 23.26.126ai 23.26.1
    PDBPDB26 (1.64 GB, with APEX 26.2)new PDB26_CLONE
    Storagefile system, no OMFfile system, no OMF
    TDEnot configurednot configured

    CDB26 is also a Data Guard primary in this lab. That is the reason I cloned from it rather than into it: a new PDB on the primary would also have to be handled on the standby.

    Step 1: Pre-checks on both CDBs

    For a hot clone, where the source PDB stays open read/write, both CDBs need ARCHIVELOG and local undo. The release must match, and the character sets must be compatible.

    COL name FORMAT A10
    COL log_mode FORMAT A12
    COL version_full FORMAT A15
    COL charset FORMAT A12
    COL local_undo FORMAT A10
    SELECT d.name, d.log_mode, i.version_full,
           NVL((SELECT value FROM nls_database_parameters WHERE parameter='NLS_CHARACTERSET'),'-') charset,
           NVL((SELECT property_value FROM database_properties WHERE property_name='LOCAL_UNDO_ENABLED'),'-') local_undo
    FROM v$database d, v$instance i;
    NAME       LOG_MODE     VERSION_FULL    CHARSET      LOCAL_UNDO
    ---------- ------------ --------------- ------------ ----------
    CDB26      ARCHIVELOG   23.26.1.0.0     AL32UTF8     TRUE
    
    NAME       LOG_MODE     VERSION_FULL    CHARSET      LOCAL_UNDO
    ---------- ------------ --------------- ------------ ----------
    CDB19      ARCHIVELOG   23.26.1.0.0     AL32UTF8     TRUE

    My first version of this query read local_undo_enabled from v$parameter and got nothing back. Local undo is a database property, so database_properties is the right place to look.

    Step 2: Common user on the source

    In CDB$ROOT of CDB26:

    CREATE USER c##clone_admin IDENTIFIED BY "<password>" CONTAINER=ALL;
    GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##clone_admin CONTAINER=ALL;

    The privilege has to be effective inside the source PDB, not just in the root. Checking from inside PDB26:

    ALTER SESSION SET CONTAINER = PDB26;
    SELECT grantee, privilege, common FROM dba_sys_privs WHERE grantee='C##CLONE_ADMIN';
    
    GRANTEE              PRIVILEGE                      COMMON
    -------------------- ------------------------------ ------
    C##CLONE_ADMIN       CREATE PLUGGABLE DATABASE      YES
    C##CLONE_ADMIN       CREATE SESSION                 YES

    Step 3: TNS alias and database link on the target

    On the target host, after backing up tnsnames.ora:

    SOURCE_CDB26 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = <source-ip>)(PORT = 1521))
        (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = CDB26)))

    My first tnsping failed with TNS-12541. The source listener was not running after an unexpected restart of that VM, so I started it and ran ALTER SYSTEM REGISTER. After that, tnsping and a test login as the clone user both worked. Then, in CDB$ROOT of CDB19:

    CREATE PUBLIC DATABASE LINK clone_pdb_dblink
      CONNECT TO c##clone_admin IDENTIFIED BY "<password>"
      USING 'SOURCE_CDB26';
    ALTER SESSION SET global_names = FALSE;
    SELECT * FROM dual@clone_pdb_dblink;
    
    D
    -
    X

    I then tried to list the source datafiles through the link and got ORA-00942 on V_$DATAFILE. That is expected: the clone user only has CREATE SESSION and CREATE PLUGGABLE DATABASE, and the clone does not need more. I read the paths on the source directly instead.

    Step 4: File placement without OMF

    On Base Database Service the files are OMF-managed, and the original article rightly warns against FILE_NAME_CONVERT there (ORA-01276). My lab uses plain file system paths with no db_create_file_dest, so FILE_NAME_CONVERT is the way to place the new files:

    Source: /u01/oradata/CDB26/PDB26/
    Target: /u01/app/oracle/oradata/CDB19/PDB26_CLONE/

    The PDB was 1.64 GB and the target file system had 21 GB free, so space was not a concern.

    Step 5: First attempt, ORA-65294

    CREATE PLUGGABLE DATABASE PDB26_CLONE FROM PDB26@clone_pdb_dblink
      FILE_NAME_CONVERT = ('/u01/oradata/CDB26/PDB26/', '/u01/app/oracle/oradata/CDB19/PDB26_CLONE/');
    
    ORA-65294: PDB's compatible parameter value (23.6.0.0.0) is higher than CDB's
    compatible parameter value (19.0.0.0.0).

    CDB19 had been upgraded to 26ai a few days earlier, but its COMPATIBLE was still 19.0.0. That is normal right after an upgrade, because it keeps the option to downgrade open. A PDB cannot be plugged into a CDB with a lower COMPATIBLE, so the clone stopped before creating anything.

    Raising COMPATIBLE cannot be undone. In this lab the guaranteed restore point from the upgrade had already been dropped, so I took a VirtualBox snapshot of the target VM and raised it:

    ALTER SYSTEM SET compatible='23.6.0' SCOPE=SPFILE;
    SHUTDOWN IMMEDIATE
    STARTUP
    SHOW PARAMETER compatible
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    compatible                           string      23.6.0

    The other way round would also have worked, cloning the 19.0.0-compatible PDB19 into CDB26, since a lower COMPATIBLE plugs into a higher one. I did not want to add a PDB to the Data Guard primary for this test.

    Step 6: The clone

    ALTER SESSION SET global_names = FALSE;
    SET TIMING ON
    CREATE PLUGGABLE DATABASE PDB26_CLONE FROM PDB26@clone_pdb_dblink
      FILE_NAME_CONVERT = ('/u01/oradata/CDB26/PDB26/', '/u01/app/oracle/oradata/CDB19/PDB26_CLONE/');
    
    Pluggable database created.
    
    Elapsed: 00:01:03.27

    Just over a minute for 1.64 GB, with PDB26 open read/write on the source the whole time. No KEYSTORE IDENTIFIED BY clause was needed because there is no TDE in this lab.

    ALTER PLUGGABLE DATABASE PDB26_CLONE OPEN READ WRITE;
    ALTER PLUGGABLE DATABASE PDB26_CLONE SAVE STATE;
    SHOW PDBS
    
        CON_ID CON_NAME                       OPEN MODE  RESTRICTED
    ---------- ------------------------------ ---------- ----------
             2 PDB$SEED                       READ ONLY  NO
             3 PDB19                          READ WRITE NO
             4 PDB26_CLONE                    READ WRITE NO

    Step 7: Plug-in violations and verification

    pdb_plug_in_violations showed four warnings, no errors:

    • pga_aggregate_target mismatch: the PDB carried a value from CDB26 that differs from CDB19.
    • Sync failures for CTXSYS (ORA-40370, ORA-28010) and SYSRAC (ORA-28222). On open, CDB19 replays its common-user history, which includes steps from its own 19c to 26ai upgrade that do not apply to these Oracle-maintained users in a PDB created on 26ai.

    RESTRICTED stayed NO, and DBMS_PDB.CLEAR_PLUGIN_VIOLATIONS left them as PENDING, so for a lab I noted them and moved on. Then the data check inside the clone:

    CREATED_AT         NOTE
    ------------------ ---------------
    20-NOV-26 16:48:53 from primary
    20-NOV-26 18:33:34 pre-failover
    20-NOV-26 18:42:31 post-fail
    
    COMP_ID    VERSION      STATUS
    ---------- ------------ ----------
    APEX       26.2.0       VALID

    The test rows from my earlier Data Guard lab and the APEX component came across intact.

    Lab vs OCI Base Database Service

    ItemOCI Base Database ServiceThis lab
    StorageASM with OMF, no FILE_NAME_CONVERTFile system, FILE_NAME_CONVERT used
    TDEOn by default, KEYSTORE IDENTIFIED BY neededNot configured, clause not used
    Release19c in the article26ai 23.26.1
    Extra issue–ORA-65294 from COMPATIBLE 19.0.0 on an upgraded CDB

    Lessons learned

    • Check COMPATIBLE on both CDBs, not only the release. An upgraded CDB can run 26ai software and still be on 19.0.0.
    • Raising COMPATIBLE is permanent. Take a backup or snapshot first.
    • Local undo is in database_properties, not v$parameter.
    • Keep the link user to the minimum privileges. An ORA-00942 on dictionary views through the link is not a problem for the clone.
    • Without OMF, use FILE_NAME_CONVERT. With OMF, leave it out.
    • Read pdb_plug_in_violations after the first open and separate warnings from errors.

    ما شاء الله, the clone is now open in the second CDB with its data and APEX intact, and the database link is in place for future refreshes.

    Reference

    This lab was inspired by Remote PDB Cloning Between Two OCI Base Database Service DB Systems Using a Database Link by Justice Asante (October 2026). It covers the OCI side in detail, including TDE wallet handling and OMF.