oracle增加表空間的四種方法

2022-07-30 04:57:08 字數 1603 閱讀 7792

1. 檢視所有表空間大小

select tablespace_name,sum(bytes)/1024/1024 from dba_data_files   

group by tablespace_name;   

2. 未使用的表空間大小 

select tablespace_name,sum(bytes)/1024/1024 from dba_free_space   

group by tablespace_name;   

3. 所以使用空間可以這樣計算

select a.tablespace_name,total,free,total-free used from   

( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files   

group by tablespace_name) a,   

( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space   

group by tablespace_name) b  

where a.tablespace_name=b.tablespace_name;   

4. 下面這條語句檢視所有segment的大小。

select segment_name,sum(bytes)/1024/1024 from user_extents group by segment_name   

5. 還有在命令**況下如何將結果放到乙個檔案裡。

sql> spool out.txt   

sql> select * from v$database;   

sql> spool off  

6.如何檢視oracle臨時表空間當前使用了多少空間的大小? 

不是佔用量,是當前正在使用的臨時表空間大小

select se.username,  

se.sid,  

su.extents,  

su.blocks * to_number(rtrim(p.value)) as space,  

tablespace,  

segtype,  

sql_text  

from v$sort_usage su, v$parameter p, v$session se, v$sql s  

where p.name = 'db_block_size'  

and su.session_addr = se.saddr  

and s.hash_value = su.sqlhash  

and s.address = su.sqladdr  

order by se.username, se.sid;  

查詢所有的表空間

select tablespace_name from dba_tablespaces  

檢視表空間中分布的使用者資訊

select tablespace_name, owner,sum(bytes) from dba_segments  

group by tablespace_name, owner   

ORACLE增加表空間

執行以下 sql語句查詢存放表空間的資料檔案的路徑 2 用system manager登入pl sql developer 新建乙個command視窗 執行如下sql語句 注意 執行上面命令是增加tx data dbf檔案,請用 不存在sql結果 裡的數字代替,一般為sql中查詢中的最大數字加1。例...

oracle表空間增加問題

表空間在初始建立的時候最好設定成自動擴充套件的,如果沒有設定成擴充套件的,則有四種方法可以增加表空間的大小,其中增加資料檔案是經常用的一種。四種方法如下 meathod1 給表空間增加資料檔案 meathod2 新增資料檔案,並且允許資料檔案自動增長 autoextend on next 5m ma...

oracle增加表空間大小

1.查詢具體表空間的使用情況 select b.file name 物理檔名,b.tablespace name 表空間,b.bytes 1024 1024 大小m,b.bytes sum nvl a.bytes,0 1024 1024 已使用m,substr b.bytes sum nvl a.b...