天天看點

修改資料庫檔案為自動擴充以達到表空間自動擴充的目的

表空間自動擴充

1)不會出現因為沒有剩餘空間可以利用到資料無法寫入

2)盡量減少人為的維護

3)可以用于重要級别不是很大的資料庫中,如測試資料庫等

2.資料檔案自動擴充的弊端

1)如果任其擴大,在資料量不斷變大的過程中會導緻某個資料檔案異常的大

2)沒有人管理的資料庫是非常危險的

3.查詢目前資料庫中所有資料檔案是否為自動擴充

sec@orcl> select tablespace_name,file_name,autoextensible from dba_data_files where tablespace_name = 'sec_d';

tablespace_name file_name aut

----------------- ----------------------------------------- ---

sec_d /u01/app/oracle/oradata/orcl/sec_d01.dbf no

4.通過修改sec_d的資料檔案為自動擴充達到表空間sec_d為自動擴充的目的

database altered.

5.确認是否已經修改成功

sec_d /u01/app/oracle/oradata/orcl/sec_d01.dbf yes

6.總結修改語句文法

開啟自動擴充功能文法:

alter database datafile '對應的資料檔案路徑資訊' autoextend on;

關閉自動擴充功能文法:

alter database datafile '對應的資料檔案路徑資訊' autoextend off;

-- the end --

sql> select tablespace_name,file_name,autoextensible from dba_data_files where tablespace_name ='users';

tablespace_name file_name autoextensible

------------------------------ -------------------------------------------------------------------------------- --------------

users +data/oracle/users01.dbf yes

users +data/oracle/users02.dbf no

sql> alter database datafile '+data/oracle/users02.dbf' autoextend on;

database altered

users +data/oracle/users02.dbf yes

sql>