oracle數據庫表空間擴容方法


 

1. 先查詢表空間在物理磁盤上存放的位置,注意使用sysdba的賬號登陸。

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個文件,腳本如下。

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

--增加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中執行,完成后查詢結果如下:

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM