Set the default tablespace in Oracle
In Oracle, the user's default permanent tablespace is system, and the default temporary tablespace is temp. If all users use the default temporary tablespace, the system and temp tablespaces will undoubtedly be more competitive.
Oracle allows the use of custom tablespace as the default permanent tablespace, and the use of custom temporary tablespace as the default temporary tablespace.
The syntax for setting the default tablespace is as follows.
Alter database default [temporary] tablespace tablespace_name
If the temporary keyword is used, the default temporary tablespace is set. If this keyword is not applicable, the default permanent tablespace is set.
Query the default tablespace
Select property_name, property_value from database_properties where property_name in ('default _ PERMANENT_TABLESPACE ', 'default _ TEMP_TABLESPACE ');
PROPERTY_NAME PROPERTY_VALUE
----------------------------------------
DEFAULT_TEMP_TABLESP TEMP
DEFAULT_PERMANENT_TA USERS
As shown in the preceding query results, the default temporary tablespace is temp and the default tablespace is users.
SQL> create tablespace testpsace
2 datafile 'e: \ oracledata \ testspace. dbf'
3 size 10 m;
The tablespace has been created.
SQL> alter database default tablespace testspace;
The database has been changed.
SQL> alter database default temporary tablespace mytemp;
The database has been changed.
Query again as follows:
SQL> select property_name, property_value from database_properties where property_name in ('default _ PERMANENT_TABLESPACE ', 'de
FAULT_TEMP_TABLESPACE ');
PROPERTY_NAME PROPERTY_VALUE
----------------------------------------
DEFAULT_TEMP_TABLESPACE MYTEMP
DEFAULT_PERMANENT_TABLESPACE TESTSPACE
The default tablespace is modified.