Oracle設定預設的資料表空間

來源:互聯網
上載者:User

Oracle設定預設的資料表空間

在Oracle中,使用者的預設永久性資料表空間為system,預設暫存資料表空間為temp。如果所有的使用者都使用預設的暫存資料表空間,無疑會增加system與temp資料表空間的競爭性。

Oracle允許使用自訂的資料表空間作為預設的永久性資料表空間,使用自訂暫存資料表空間作為預設暫存資料表空間。

設定預設的資料表空間的文法如下。

alter database default [temporary] tablespace tablespace_name
如果使用temporary關鍵字,則表示設定預設暫存資料表空間;如果不適用該關鍵字,則表示設定預設永久性資料表空間。

查詢預設的資料表空間
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
如上面的查詢結果所示,系統預設的暫存資料表空間為temp,預設的新使用者的資料表空間為users。

SQL> create tablespace testpsace
  2  datafile 'e:\oracledata\testspace.dbf'
  3  size 10m;

資料表空間已建立。

SQL> alter database default tablespace testspace;

資料庫已更改。

SQL> alter database default temporary tablespace mytemp;

資料庫已更改。

重新查詢如下所示
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
此時,系統預設的資料表空間被修改了。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.