Oracel扩展表空间

--表空间查看
SELECT tbs,                                    
    sum(totalM) as total,                                    
    sum(usedM) as UserdM,                                    
    sum(remainedM) as remainedM,                                    
    sum(usedM)/sum(totalM)*100 as UserdPercent,                            
    sum(remainedM)/sum(totalM)*100 as remainedPercent                            
    FROM(                                            
     SELECT b.file_id ID,                                    
     b.tablespace_name tbs,                                    
     b.file_name name,                                    
     b.bytes/1024/1024 totalM,                                    
     (b.bytes-sum(nvl(a.bytes,0)))/1024/1024 usedM,                        
     sum(nvl(a.bytes,0)/1024/1024) remainedM,                            
     sum(nvl(a.bytes,0)/(b.bytes)*100),                                
     (100 - (sum(nvl(a.bytes,0))/(b.bytes)*100))                            
     FROM dba_free_space a,dba_data_files b                            
     WHERE a.file_id = b.file_id                                
     GROUP BY b.tablespace_name,b.file_name,b.file_id,b.bytes                    
     ORDER BY b.tablespace_name                                
    )                                            
    GROUP BY tbs

   
--查看表空间文件位置
SELECT ddf.file_name FROM Dba_Data_Files ddf where ddf.tablespace_name = 'BLOBS'
 
 --增大表空间
ALTER TABLESPACE BLOBS ADD DATAFILE '/opt/ptc/Windchill_9.1/ocu/oradata/wind/windblobs02.dbf' SIZE 2g AUTOEXTEND ON NEXT 500M MAXSIZE 32g;
原文地址:https://www.cnblogs.com/qidian10/p/3396065.html