oracle 查詢資料表空間使用方式與查詢有哪些資料庫執行個體在運行

來源:互聯網
上載者:User

查詢資料表空間使用方式

  

select a.tablespace_name "資料表空間名稱",

  100-round((nvl(b.bytes_free,0)/a.bytes_alloc)*100,2) "佔用率(%)",

  round(a.bytes_alloc/1024/1024,2) "容量(M)",

  round(nvl(b.bytes_free,0)/1024/1024,2) "空閑(M)",

  round((a.bytes_alloc-nvl(b.bytes_free,0))/1024/1024,2) "使用(M)",

  Largest "最大擴充段(M)",

  to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') "採樣時間"

  from  (select f.tablespace_name,

  sum(f.bytes) bytes_alloc,

  sum(decode(f.autoextensible,'YES',f.maxbytes,'NO',f.bytes)) maxbytes

  from dba_data_files f

  group by tablespace_name) a,

  (select  f.tablespace_name,

  sum(f.bytes) bytes_free

  from dba_free_space f

  group by tablespace_name) b,

  (select round(max(ff.length)*16/1024,2) Largest,

  ts.name tablespace_name

  from sys.fet$ ff, sys.file$ tf,sys.ts$ ts

  where ts.ts#=ff.ts# and ff.file#=tf.relfile# and ts.ts#=tf.ts#

  group by ts.name, tf.blocks) c

  where a.tablespace_name = b.tablespace_name and a.tablespace_name = c.tablespace_name

  

25. 查詢資料表空間的片段程度

  

select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name

  having count(tablespace_name)>10;

  alter tablespace name coalesce;

  alter table name deallocate unused;

  create or replace view ts_blocks_v as

  select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space

  union all

  select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;

  select * from ts_blocks_v;

  select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space

  group by tablespace_name;

  

26。查詢有哪些資料庫教程執行個體在運行

  

select inst_name from v$active_instances;

  ===========================================================

  ######### 建立資料庫----look $ORACLE_HOME/rdbms/admin/buildall.sql #############

  create database db01

  maxlogfiles 10

  maxdatafiles 1024

  maxinstances 2

  logfile

  GROUP 1 ('/u01/oradata/db01/log_01_db01.rdo') SIZE 15M,

  GROUP 2 ('/u01/oradata/db01/log_02_db01.rdo') SIZE 15M,

  GROUP 3 ('/u01/oradata/db01/log_03_db01.rdo') SIZE 15M,

  datafile 'u01/oradata/db01/system_01_db01.dbf') SIZE 100M,

  undo tablespace UNDO

  datafile '/u01/oradata/db01/undo_01_db01.dbf' SIZE 40M

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.