ORACLE擴容方法

先查詢表空間在物理磁盤上存放的位置,注意使用sysdba的帳號登錄。html

複製代碼

SELECT tablespace_name, 
file_id, 
file_name, 
round(bytes / (1024 * 1024), 0) total_space 
FROM dba_data_files 
ORDER BY tablespace_name;

複製代碼

 

2. 須要擴容的表空間是DW_STG_TBS,目前的文件分配序號是DW_STG_TBS20.dbf,數據庫

    因此在接下來的要增長的文件的名稱從21開始,咱們一次行增長20個文件,腳本以下。oracle

    其中設置的每一個文件初始分配空間爲7g, autoextend on爲自動增加大小,oracle單個文件大小最大不超過32g.app

複製代碼

--增長Stage層表空間
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS21.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS22.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS23.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS24.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS25.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS26.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS27.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS28.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS29.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS30.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS31.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS32.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS33.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS34.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS35.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS36.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS37.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS38.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS39.dbf' size 7167M autoextend on ;
alter tablespace DW_STG_TBS
add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS40.dbf' size 7167M autoextend on ;

複製代碼

3. 將以上SQL在PL/SQL中執行,完成後查詢結果以下:spa

4. 使用本博客中另一篇文章[ORACLE數據庫存儲空間使用狀況查詢]中的SQL語句查詢表空間大小htm

相關文章
相關標籤/搜索