[26ai] Oracle Temporary Tablespace Groups
![[26ai] Oracle Temporary Tablespace Groups](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1768949026630%2Fa51b9914-ad81-4b3a-9eeb-18ec55618b42.jpeg&w=3840&q=75)
If you prefer to read in Spanish Spanish version.
Today, we’re going to talk about Temporary Tablespace Groups.
Even though It’s not a feature in 26ai, we’re going to set it up.
First of all, this type of tablespace allows users , when performing operations that need a large amount of temporary space, such as sorting, Oracle can distribute the workload across multiple temporary tablespaces, thereby avoiding saturation when relying on a single temporary tablespace.
In this lab, we will use the following:
- Source: 26ai on VM DB System in Oracle Cloud (test).
So, let's get down to business!
Step 1: Create the PDB TEST on Source and check which temporary tablespace is assigned by default:
SQL> SHOW PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 TEST READ WRITE NO
SQL> Select Property_Name, Property_Value
From database_properties
Where property_name = 'DEFAULT_TEMP_TABLESPACE';
PROPERTY_NAME PROPERTY_VALUE
-------------------------------------------------- ----------------------------------------------------------------------------------------------------
DEFAULT_TEMP_TABLESPACE TEMP
Step 2: Let’s define a new temporary tablespace group with several temporary tablespaces. Oracle doesn’t provide a statement in order to create a tablespace group, we need to speficy it when creating the tablespace.
SQL>
CREATE TEMPORARY TABLESPACE GRP_TMP_TAB_1 TEMPFILE SIZE 50M TABLESPACE GROUP GRP_TMP;
Tablespace created.
SQL>
CREATE TEMPORARY TABLESPACE GRP_TMP_TAB_2 TEMPFILE SIZE 50M TABLESPACE GROUP GRP_TMP;
Tablespace created.
We can chech the new temporary tablespace group in DBA_TABLESPACE_GROUPS:
SQL> Select * From DBA_TABLESPACE_GROUPS ;
GROUP_NAME TABLESPACE_NAME
------------------------------ ------------------------------
GRP_TMP GRP_TMP_TAB_1
GRP_TMP GRP_TMP_TAB_2
In case we already have a temporary tablespace, or if we have created a new one without assigning it to a group, we can move it as follows:
SQL> CREATE TEMPORARY TABLESPACE GRP_TMP_TAB_3 TEMPFILE SIZE 50M ;
Tablespace created.
SQL> ALTER TABLESPACE GRP_TMP_TAB_3 TABLESPACE GROUP GRP_TMP;
Tablespace altered.
SQL> Select * From DBA_TABLESPACE_GROUPS ;
GROUP_NAME TABLESPACE_NAME
------------------------------ ------------------------------
GRP_TMP GRP_TMP_TAB_1
GRP_TMP GRP_TMP_TAB_2
GRP_TMP GRP_TMP_TAB_3
Step 3: Lastly, Let’s set our temporary tablespace group GRP_TMP as the default temporary tablespace.
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE GRP_TMP;
Database altered.
SQL>
Select Property_Name, Property_Value
From database_properties where property_name = 'DEFAULT_TEMP_TABLESPACE';
PROPERTY_NAME PROPERTY_VALUE
-------------------------------------------------- ----------------------------------------------------------------------------------------------------
DEFAULT_TEMP_TABLESPACE GRP_TMP
When a temporary tablespace group is set as the default temporary tablespace, none of the temporary tablespace within the group can be dropped. If you need to drop one of them, you must first assign another temporary tablespace as the default..
Looking forward to seeing you in the next article :)
![[26ai] Hybrid Read-Only Mode PDB](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F65605419d28f19cc44df7ef1%2F23e8f92e-f89b-4746-930e-98156e3a1ec4.png&w=3840&q=75)
![[26ai] ALERT_LOG_MAX_SIZE](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F65605419d28f19cc44df7ef1%2Fdad5c53e-425c-4e82-9bbb-e0ccec6e9a4e.jpg&w=3840&q=75)
![[26ai] ConnStr Tool](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F65605419d28f19cc44df7ef1%2F8316641c-ac22-45c3-a59d-4a8a7dfd9de5.png&w=3840&q=75)
![[26ai] Install Oracle AI Database 26ai on Linux 9](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F65605419d28f19cc44df7ef1%2F243000b4-ccef-4cab-97db-f9b47328159f.png&w=3840&q=75)
![[OCI] Mount a Bucket as a FS](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F65605419d28f19cc44df7ef1%2F4dc1fa32-8048-442d-a214-b279e7730939.png&w=3840&q=75)