1、表空间是否自动增长其实就是其包含的数据文件是否能够自动增长。
你可以通过如下方式查看数据文件是否自动增长:
select file_name,autoextensible from dba_data_files;
看字段autoextensible的值,yes则表示该数据文件为自动增长。
--------------------------------------------------------------------------------------------------------
2、SELECT a.tablespace_name "表空间名",total/1024/1024 "表空间大小(mbytes)",free /1024 /1024 "表空间剩余大小(mbytes)",(total-free)/1024/1024 "表空间使用大小(mbytes)",ROUND((total-free)/total,4)*100 "使用率%" FROM (SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE GROUP BY tablespace_name) a,(SELECT tablespace_name,SUM(bytes) total FROM DBA_DATA_FILES GROUP BY tablespace_name) b WHERE a.tablespace_name=b.tablespace_name;
--------------------------------------------------------------------------------------------------------
2、查看是否有锁表的sql
复制代码 代码如下:
select 'blocker('||lb.sid||':'||sb.username||')-sql:'|| qb.sql_text blockers,
'waiter ('||lw.sid||':'||sw.username||')-sql:'|| qw.sql_text waiters
from v$lock lb,
v$lock lw,
v$session sb,
v$session sw,
v$sql qb,
v$sql qw
where lb.sid=sb.sid
and lw.sid=sw.sid
and sb.prev_sql_addr=qb.address
and sw.sql_address=qw.address
and lb.id1=lw.id1
and sw.lockwait is not null
and sb.lockwait is null
and lb.block=1 ;
--------------------------------------------------------------------------------------------------------
3、查看被锁的表
复制代码 代码如下:
select p.spid,a.serial#,c.object_name,b.session_id,b.oracle_username,b.os_user_name
from v$process p,v$session a, v$locked_object b,all_objects c
where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id ;
--------------------------------------------------------------------------------------------------------
4、查看那个用户那个进程造成死锁,锁的级别
复制代码 代码如下:
select b.owner,b.object_name,l.session_id,l.locked_mode fromv$locked_object l, dba_objects
--------------------------------------------------------------------------------------------------------
5、5、查看是哪个session引起的
复制代码 代码如下:
select b.username,b.sid,b.serial#,logon_time
from v$locked_object a,v$session b
where a.session_id = b.sid order by b.logon_time;
---------------------------------------------------------------------------------------------------------
6、杀掉进程
复制代码 代码如下:
alter system kill session 'sid,serial#';
----------------------------------------------------------------------------------------------------------
7、过V$SESSION视图,可以查询Oracle所有Oracle用户会话信息:
select sid,logon_time,username,machine from v$session;
-----------------------------------------------------------------------------------------------------------
8、查看表空间下各表大小
select s.segment_name 表名, bytes / 1024 / 1024 / 1024 "表大小(G)"
from dba_segments s
where s.tablespace_name = 'SYSTEM'
order by bytes desc