您好,登錄后才能下訂單哦!
查看表空間相關信息
SELECT TABLESPACE_NAME, BLOCK_SIZE, --db_block_size大小 INITIAL_EXTENT FROM DBA_TABLESPACES
2. 表空間對應文件名稱及大小
SELECT TABLESPACE_NAME, FILE_ID, FILE_NAME, ROUND(BYTES / (1024 * 1024), 0) TOTAL_SPACE FROM DBA_DATA_FILES ORDER BY TABLESPACE_NAME;
3. 查看表空間大小,使用情況
SELECT UPPER(F.TABLESPACE_NAME) AS TABLESPACE_NAME, --表空間名稱 D.TOTAL_BYTES AS TOTAL_BYTES, --表空間大小M F.FREE_BYTES AS FREE_BYTES, --空閑大小M D.TOTAL_BYTES - F.FREE_BYTES AS USEAGE_BYTES, --使用大小M TO_CHAR(ROUND((D.TOTAL_BYTES - F.FREE_BYTES) / D.TOTAL_BYTES * 100, 2), '990.99') AS USEAGE_PERCENT, --使用占比 F.MAX_BYTES AS BLOCK_MAX_BYTES --最大BLOCK塊 FROM (SELECT TABLESPACE_NAME, ROUND(SUM(BYTES) / (1024 * 1024), 2) FREE_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) TOTAL_BYTES FROM SYS.DBA_DATA_FILES DD GROUP BY DD.TABLESPACE_NAME) D WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME ORDER BY 4 DESC;
4.查看數據庫版本相關信息
SELECT PRODUCT,VERSION,STATUS FROM PRODUCT_COMPONENT_VERSION;
5.查看表大小
analyze table tablename compute statistics; SELECT NUM_ROWS * AVG_ROW_LEN FROM USER_TABLES WHERE TABLE_NAME = 'tablename';
6.查看正在執行的SQL
SELECT b.sid oracleID, b.username, b.machine, b.PROGRAM, b.serial#, spid , STATUS, paddr, sql_text, c.CPU_TIME FROM v$process a, v$session b, v$sqlarea c WHERE a.addr = b.paddr AND b.sql_hash_value = c.hash_value;
7.查看當前表被鎖對象
SELECT SESS.SID, SESS.SERIAL#, LO.ORACLE_USERNAME, LO.OS_USER_NAME, AO.OBJECT_NAME, LO.LOCKED_MODE, SESS.MACHINE, SESS.TERMINAL, SESS.LOGON_TIME FROM V$LOCKED_OBJECT LO, DBA_OBJECTS AO, V$SESSION SESS WHERE AO.OBJECT_ID = LO.OBJECT_ID AND LO.SESSION_ID = SESS.SID; ALTER SYSTEM KILL SESSION 'SID,SERIAL#'; --殺掉鎖表進程
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。