--查看oracle表空間相關:
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
--查看oracle表字段,註釋,大小相關:
select tab.TABLE_NAME, --表名
tab.COLUMN_NAME, --字段名
tab.DATA_TYPE, --字段類型
tab.DATA_LENGTH, --字段長度
col.comments, --字段註釋
comm.comments --表註釋
from all_tab_columns tab,
all_col_comments col,
user_tab_comments comm
where
tab.TABLE_NAME = col.table_name
and tab.COLUMN_NAME = col.column_name
and tab.TABLE_NAME = comm.table_name
and tab.TABLE_NAME = '表名(大寫)'
order by tab.TABLE_NAME, tab.COLUMN_ID
|
--查看oracle用戶鎖表相關:
select
distinct sid,
v$session.username 用戶名,
last_call_et 持續時間,
status 狀態,
LOCKWAIT 等待鎖,
machine 用戶電腦名,
logon_time 開始登入時間,
sql_text
from v$session, v$process, v$sqlarea,dba_ddl_locks
where paddr = addr
and sql_hash_value = hash_value
and v$session.username is not null
and status='ACTIVE'
and dba_ddl_locks.type='Body'
and dba_ddl_locks.session_id = v$session.SID
and dba_ddl_locks.owner='實例名'
order by last_call_et desc