Oracle資料庫滿了修改的過程20171123

來源:互聯網
上載者:User

查看錶空間的使用方式

SELECT Upper(F.TABLESPACE_NAME)         "資料表空間名",       D.TOT_GROOTTE_MB                 "資料表空間大小(M)",       D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空間(M)",       To_char(Round(( D.TOT_GROOTTE_MB - F.TOTAL_BYTES ) / D.TOT_GROOTTE_MB * 100, 2), '990.99')       || '%'                           "使用比",       F.TOTAL_BYTES                    "空閑空間(M)",       F.MAX_BYTES                      "最大塊(M)"FROM   (SELECT TABLESPACE_NAME,               Round(Sum(BYTES) / ( 1024 * 1024 ), 2) TOTAL_BYTES,               Round(Max(BYTES) / ( 1024 * 1024 ), 2) MAX_BYTES        FROM   SYS.DBA_FREE_SPACE        GROUP  BY TABLESPACE_NAME) F,       (SELECT DD.TABLESPACE_NAME,               Round(Sum(DD.BYTES) / ( 1024 * 1024 ), 2) TOT_GROOTTE_MB        FROM   SYS.DBA_DATA_FILES DD        GROUP  BY DD.TABLESPACE_NAME) DWHERE  D.TABLESPACE_NAME = F.TABLESPACE_NAMEORDER  BY 1

查看各個資料表空間的資料檔案

select t1.name, t2.name,Round(t2.BYTES / ( 1024 * 1024 ), 2) "大小(M)"  from v$tablespace t1, v$datafile t2 where t1.ts# = t2.ts# order by 1,3

查看SYSAUX資料表空間使用方式

SELECT *  FROM (SELECT   BYTES, segment_name, segment_type, owner            FROM dba_segments           WHERE tablespace_name = 'SYSAUX'        ORDER BY BYTES DESC) WHERE ROWNUM < 10 ```執行以下語句 修改表資料檔案大小

SQL> select dbms_stats.get_stats_history_retention from dual;

GET_STATS_HISTORY_RETENTION---------------------------                         31 ```SQL> exec dbms_stats.alter_stats_history_retention(15); ```PL/SQL procedure successfully completed ```SQL> select min(snap_id),max(snap_id) from dba_hist_snapshot; ```MIN(SNAP_ID) MAX(SNAP_ID)------------ ------------       35044        35248 ```SQL> exec dbms_workload_repository.drop_snapshot_range(low_snap_id =>35044,high_snap_id => 35044+24); ```PL/SQL procedure successfully completed修改表資料檔案大小 ```SQL> ALTER DATABASE DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\XUEJIAYUE\SYSAUX01.DBF' RESIZE 2048M;

Database altered

SQL> ALTER DATABASE DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\XUEJIAYUE\XUEJIAYUE01.DBF' RESIZE 2048M; 

SQL>

Database altered

ALTER DATABASE DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\XUEJIAYUE\UNDOTBS01.DBF' RESIZE 2048M;

看看效率比較低的語句(http://blog.csdn.net/ocean1010/article/details/5947580)

SELECT EXECUTIONS , DISK_READS, BUFFER_GETS, ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio, ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run, SQL_TEXT FROM V$SQLAREA WHERE EXECUTIONS>0 AND BUFFER_GETS > 0 AND (BUFFER_GETS-DISK_READS)/BUFFER_GETS < 0.8 ORDER BY 4 DESC;

然後
最佳化相關的表格

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.