时间:2021-07-01 10:21:17 帮助过:28人阅读
select decode(sign(变量1 - 变量2), -1, 变量1, 变量2) from dual; --取较小值
select segment_name, tablespace_name, bytes B, bytes / 1024 KB, bytes / 1024 / 1024 MB from user_segments where segment_type = ‘TABLE‘;
查询死锁:
SELECT l.session_id sid, s.serial#, l.locked_mode, l.oracle_username, l.os_user_name, s.machine, s.terminal, o.object_name, s.logon_time FROM v$locked_object l, all_objects o, v$session s WHERE l.object_id = o.object_id AND l.session_id = s.sid ORDER BY sid, s.serial#;
解锁:
alter system kill session ‘sid,serial#‘; --结合上面查询死锁结果使用
select a."MACHINE", a."PROGRAM", a."PREV_EXEC_START", a.terminal from v$session a where a.username = ‘HRPDEV‘;
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;
select tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space from dba_data_files order by tablespace_name;
select segment_name, tablespace_name, r.status, (initial_extent / 1024) initialextent, (next_extent / 1024) nextextent, max_extents, v.curext curextent from dba_rollback_segs r, v$rollstat v where r.segment_id = v.usn(+) order by segment_name;
select name from v$controlfile;
select member from v$logfile;
select sum(bytes) / (1024 * 1024) as free_space, tablespace_name from dba_free_space group by tablespace_name; select a.tablespace_name, a.bytes total, b.bytes used, c.bytes free, (b.bytes * 100) / a.bytes "% USED ", (c.bytes * 100) / a.bytes "% FREE " from sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free c where a.tablespace_name = b.tablespace_name and a.tablespace_name = c.tablespace_name;
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;
Oracle常用命令
标签:div 回滚 变量 size hrp member where control 表空间