Skip to content

datapatch fails when running against an Oracle Container Database because of missing temp files in PDBs

When going to 19.15. a customer hit this error when running datapatch:

Unsupported named object type for bind parameter at /u01/app/oracle/product/19.0.0.0/dbhome1915/sqlpatch/sqlpatch.pm line 5849, line 4452.

After anlyzing the issue it turned out to be related to what has been documented in My Oracle Support Note
Datapatch Failed with Error:”ORA-25153: Temporary Tablespace is Empty” (Doc ID 2285159.1)

In our case we had 3 pluggable DBs, which had a temporary tablespace TEMP without temp-files. I.e. this issue may happen not only for PDB PDB$SEED as mentioned in the Note, but also for any other PDB as well.
To check if you are affected you may run the following statements when connected to the root container:

SQL> alter session set "_exclude_seed_cdb_view"=FALSE;

Session altered.

REMARK: It’s important to set the parameter “_exclude_seed_cdb_view”=FALSE here, because otherwise the view cdb_temp_files would hide PDB$SEED.

SQL> column file_name format a32
SQL> select pd.con_id, name, file_name
  2  from v$pdbs pd left outer join cdb_temp_files tem on tem.con_id=pd.con_id
  3  where file_name is null;

    CON_ID NAME       FILE_NAME
---------- ---------- ------------------------------
         8 CRMV12
        10 CRMV122
        11 APP128

If everything would be correct above query would not return rows.

Questions about your own setup? A dbi services consultant can look at your case.

Talk to an expert (opens in a new tab)

So let’s check the default temporary tablespace for our PDBs:

SQL> connect / as sysdba
SQL> select con_id, property_value 
  2  from cdb_properties
  3  where property_name='DEFAULT_TEMP_TABLESPACE'
  4  and con_id in (8,10,11);

    CON_ID PROPERTY_VALUE
---------- ---------------
         8 TEMP
        10 TEMP
        11 TEMP

To fix the missing temp files just add them. E.g. for PDB CRMV12:

SQL> alter session set container=CRMV12;

Session altered.

SQL> select name from v$tempfile;

no rows selected

SQL> alter tablespace temp add tempfile;

Tablespace altered.

REMARK: As I’m using ASM with Oracle Managed Files (OMF), I do not need to provide a file-name.

SQL> select name from v$tempfile;

NAME
---------------------------------------------------------------------------------------
+DATA/CRM12X_011/D6A585D8BD6226BCE05387775C0AC88B/TEMPFILE/temp.1622.1111235741

Finally just double check that everything is correct then:

SQL> connect / as sysdba
SQL> alter session set "_exclude_seed_cdb_view"=FALSE;

Session altered.

SQL> select pd.con_id, name, file_name
  2  from v$pdbs pd left outer join cdb_temp_files tem on tem.con_id=pd.con_id
  3  where file_name is null;

no rows selected

Afterwards datapatch will (hopefully 😉 ) run through.

Summary: In Data Guard environments the Standby-DB may not have temporary files in PDBs, because with Active Data Guard (ADG) no temporary files are created on Standby when creating a PDB on Primary (with ADG other files will be copied when creating a PDB from another PDB in the CDB, but not the temporary files). If you do a switchover and then run datapatch then datapatch may fail on the new primary because of the missing temp-files. Just add the temp-files as mentioned in this Blog to fix the issue. There’s usually no need to specify a size for the temp-file as that information will be taken from the definition of the temporary tablespace (TEMP in the case above). If you have more than 1 temp-file then add files accordingly.

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Clemens Bleile

Clemens Bleile

Clemens Bleile has more than 30 years of IT experience, including 13 years in Oracle Support and 15 years in Oracle Consulting. He specializes in Oracle Database performance tuning and highly available, cost-efficient database architecture design. He holds Oracle Certified Professional (11g, 12c) and Oracle Certified Expert for Performance Management and Tuning credentials. Prior to dbi services, he managed the EMEA Database Performance team at Oracle Global Customer Support Services. Clemens holds a Master's degree in Business Information Systems from the Fachhochschule Furtwangen, Germany.View Author posts

68 posts since February 2016

Most read in Oracle

The Oracle posts our readers open most: the all-time favourites, and what is trending right now.

2 thoughts on “datapatch fails when running against an Oracle Container Database because of missing temp files in PDBs”

  1. Hi Sourav,

    no, I’m just talking about a single temporary tablespace, which may need more than 1 file. I.e. if the temp tablespace is a smallfile tablespace then you may need more than 1 temp-file to satisfy the applications need of temporary space. With 8K blocksize a single file in a smallfile tablespace can be 32GB. I.e. if your need is to have 60GB of temporary space then you need 2 files. If that is the case then just add them as necessary. Best would be to check the DB on how many temp files it should have. E.g.

    set lines 200 pages 999 long 500000 longchunksize 200
    select dbms_metadata.get_ddl(‘TABLESPACE’,’TEMP’) from dual;

    DBMS_METADATA.GET_DDL(‘TABLESPACE’,’TEMP’)
    —————————————————————–
    CREATE TEMPORARY TABLESPACE “TEMP” TEMPFILE
    SIZE 2147483648
    AUTOEXTEND ON NEXT 1073741824 MAXSIZE 31744M,
    SIZE 2147483648
    AUTOEXTEND ON NEXT 1073741824 MAXSIZE 31744M
    EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1048576

    Then add the 2 temp-files accordingly:

    alter tablespace temp add tempfile ‘+DATA’ size 2G autoextend on next 1G maxsize 31G;
    alter tablespace temp add tempfile ‘+DATA’ size 2G autoextend on next 1G maxsize 31G;

    REMARKS:
    – See also MOS Note “Data Guard Physical Standby – Managing temporary tablespace tempfiles (Doc ID 1514588.1)”
    – In Oracle Database 23ai the TEMP file(s) gets created automatically when the standby PDB gets open if the standby uses Oracle Managed Files and the standby_file_management parameter is set to AUTO on standby.

    Regards
    Clemens

  2. Hi Celemns,
    Thanks for the blogs. It was helpful !
    In this line – “If you have more than 1 temp-file then add files accordingly.” Did you meant more than one temptable space ?

    Thank you
    Sourav

Leave a Comment

Your email address will not be published. Required fields are marked *