标签:free object 操作 awr报告 and 文件 lock active views
oracle基本操作--与视图有关的表
select from user_views
select from dba_views
--涉及到查看表空间和数据文件的几个表
SELECT FROM dba_free_space --查看表空间剩余空间
select from dba_temp_files; --查看临时表空间
select from dba_tablespaces --查看表空间
select from dba_data_files --查看数据文件位置
SELECT * FROM user_source --查看存储过程
--与索引有关的表
select from user_tables
select from all_indexes where table_name = ‘TEST1‘;
select from all_ind_columns where table_name = ‘TEST1‘;
select from user_ind_columns where index_name=‘TIME_IDX1‘;
select * from user_indexes where table_name=‘TEST1‘;
查看oracle中被占用的表,分析AWR报告耗时,分析瓶颈时使用
例如:想删除一张表或者更改表时卡住了,可以用如下语句查看
(1)查看是否有SQL语句在占用这张表
查看谁在占用
select sess.INST_ID, sess.machine,
sess.program, sess.sql_id,
sess.sid, sess.serial#,
sess.PROCESS
lo.oracle_username, lo.os_user_name,
lo.locked_mode,
ao.object_name, ao.object_type,
ao.status,
from gv$locked_object lo, dba_objects ao, gv$session sess
where ao.object_id = lo.object_id
and lo.session_id = sess.sid
and sess.username = ‘SCOTT‘
--杀掉进程 sid,serial#
alter system kill session‘10,11562‘;
(2)查看是否有会话没有结束
SQL> select username,sid,serial#,paddr,status from v$session where username=‘SCOTT‘;
USERNAME SID SERIAL# PADDR STATUS
SCOTT 1 281 000000008E51C510 KILLED
SCOTT 20 362 000000008E491150 INACTIVE
SCOTT 21 175 000000008E48D050 INACTIVE
SCOTT 28 169 000000008E51C510 KILLED
SQL> select PROGRAM from v$process where addr=‘000000008E490110‘;
PROGRAM
oracle@master.example.com
--杀掉进程 sid,serial#
alter system kill session ‘1,281‘;
alter system kill session ‘20,362‘;
alter system kill session ‘21,175‘;
alter system kill session ‘28,169‘;
SQL> drop user scott cascade;
User dropped.
标签:free object 操作 awr报告 and 文件 lock active views
原文地址:https://blog.51cto.com/7794482/2443284