--查看被锁住的表select b.owner,b.object_name,a.session_id,a.locked_modefrom v$locked_object a,dba_objects bwhere b.object_id = a.object_id;----查看被锁住的会话select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session bwhere a.session_id = b.sid order by b.logon_time;--查看被阻塞的会话select * from dba_waiters;--查看引起死锁的会话select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ao.object_name, lo.locked_mode from v$locked_object lo, dba_objects ao, v$session sesswhere ao.object_id = lo.object_id and lo.session_id = sess.sidorder by ao.object_name ;--释放锁或者杀掉ORACLE进程alter system kill session sid,.serial#
--查看表空间大小和使用率select a.tablespace_name, total, free, total-free as used, substr(free/total * 100, 1, 5) as "FREE%", substr((total - free)/total * 100, 1, 5) as "USED%" from (select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a, (select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) bwhere a.tablespace_name = b.tablespace_nameorder by a.tablespace_name;--某张表对应的数据库实例和表空间select owner,table_name,tablespace_name from dba_tables where table_name='BILLS_BREAK';--表空间下所表select table_name from dba_tables where tablespace_name='USERS';--表空间扩容--1.先查询表空间在物理磁盘上存放的位置SELECT tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space FROM dba_data_files where tablespace_name='USERS' ORDER BY tablespace_name ; --2.改变数据文件的大小alter database datafile '/oracle/app/oradata/mytablespace/my_01.dbf' resize 256M;--3.验证select bytes/1024/1024, tablespace_name from dba_data_files where tablespace_name='USERS';