Automatic temp file creation on the standby - Oracle AI Database 26ai
In Oracle Database 19c, when a tempfile is added on the primary database, it is not automatically created on the physical standby database. This is because Oracle does not generate redo for tempfile-related DDL operations (such as creating, adding, resizing, or dropping tempfiles).
Behavior in Oracle Database 19c
For example, when creating a temporary tablespace on the primary database(19c):
— Primary
SQL> create temporary tablespace TEMP1404;
Tablespace created.
SQL> select ts# from v$tablespace where NAME='TEMP1404';
TS#
----------
15
SQL> select name from v$tempfile where ts#=15;
NAME
--------------------------------------------------------------------------------
+DATA/HUME/B3AE49A3735D8867E053088A210A341D/TEMPFILE/temp1404.807.1225812657On the standby database, although the tablespace metadata exists, the tempfile itself is not created:
— Data Guard
SQL> select ts# from v$tablespace where NAME='TEMP1404';
TS#
----------
15
SQL> select name from v$tempfile where ts#=15;
no rows selectedIf we add another tempfile on the primary:
— Primary
SQL> alter tablespace TEMP1404 add tempfile size 100m;
Tablespace altered.
SQL> select name from v$tempfile where ts#=15;
NAME
--------------------------------------------------------------------------------
+DATA/HUME/B3AE49A3735D8867E053088A210A341D/TEMPFILE/temp1404.807.1225812657
+DATA/HUME/B3AE49A3735D8867E053088A210A341D/TEMPFILE/temp1404.808.1225812823Again, on the standby database:
SQL> select name from v$tempfile where ts#=15;
no rows selectedAutomatic Tempfile Creation in Oracle AI Database 26ai
Starting with Oracle AI Database 26ai, tempfile creation is automatically handled on the standby database.
To enable this feature, the following parameters must be configured on the standby:
standby_file_management = AUTOdb_create_file_destmust be defined
— Data Guard
SQL> alter system set standby_file_management=AUTO;
System altered.
SQL> alter system set db_create_file_dest='/oracle/base/oradata';
System altered.Now, when creating a temporary tablespace on the primary:
— Primary
SQL> create temporary tablespace TEMP1404;
Tablespace created.
SQL> select ts# from v$tablespace where NAME='TEMP1404';
TS#
----------
5
SQL> select name from v$tempfile where ts#=5;
NAME
--------------------------------------------------------------------------------
/oracle/base/oradata/DB2/4A3B7527123A1205E0630288200AA7B8/datafile/o1_mf_temp1404_nsx3wdt7_.tmpThe tempfile is automatically created on the standby database:
— Data Guard
SQL> select name from v$tempfile where ts#=5;
NAME
--------------------------------------------------------------------------------
/oracle/base/oradata/DG1/4A3B7527123A1205E0630288200AA7B8/datafile/o1_mf_temp1404_nsx3wbyx_.dbfThis enhancement eliminates the need for manual synchronization of tempfile configurations between primary and standby databases, simplifying Data Guard administration.
Written by Vahid Yousefzadeh
I have been a DBA since 2011 and I work with Oracle technology. Linkdin: linkedin.com/in/vahidusefzadeh telegram channel ID:@oracledb vahidusefzadeh@gmail.com
Comments
Post a Comment