--查看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