查看表空間相關(guān)信息
為企業(yè)提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、網(wǎng)站優(yōu)化、全網(wǎng)營(yíng)銷推廣、競(jìng)價(jià)托管、品牌運(yùn)營(yíng)等營(yíng)銷獲客服務(wù)。創(chuàng)新互聯(lián)公司擁有網(wǎng)絡(luò)營(yíng)銷運(yùn)營(yíng)團(tuán)隊(duì),以豐富的互聯(lián)網(wǎng)營(yíng)銷經(jīng)驗(yàn)助力企業(yè)精準(zhǔn)獲客,真正落地解決中小企業(yè)營(yíng)銷獲客難題,做到“讓獲客更簡(jiǎn)單”。自創(chuàng)立至今,成功用技術(shù)實(shí)力解決了企業(yè)“網(wǎng)站建設(shè)、網(wǎng)絡(luò)品牌塑造、網(wǎng)絡(luò)營(yíng)銷”三大難題,同時(shí)降低了營(yíng)銷成本,提高了有效客戶轉(zhuǎn)化率,獲得了眾多企業(yè)客戶的高度認(rèn)可!
SELECT TABLESPACE_NAME, BLOCK_SIZE, --db_block_size大小 INITIAL_EXTENT FROM DBA_TABLESPACES
2. 表空間對(duì)應(yīng)文件名稱及大小
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.查看數(shù)據(jù)庫(kù)版本相關(guān)信息
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.查看正在執(zhí)行的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.查看當(dāng)前表被鎖對(duì)象
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#'; --殺掉鎖表進(jìn)程