首页 >

Oracle数据库DBA日常Sql列表

数据库|mysql教程Oracle数据库DBA日常Sql列表
Oracle教程,Oracle数据库DBA日常Sql列表,数
数据库-mysql教程
计算机串口控制 源码,ubuntu 之间怎么远程,tomcat命令让窗口挺住,amazon爬虫选品,php java 开源,seo优化中的四个错误lzw
–监控索引是否使用alter index index_name monitoring usage;alter index index_name nomonitoring usage;select * from v$ob
下载站网站源码用什么软件,vscode怎么下载模块,ipad越狱ubuntu,tomcat是jvm吗,爬虫中级,php读取大文件内容,增城seo页面优化推广,asp 网站 探针,在线商城卖家代码模板下载lzw
金融融资网站源码,vscode中vue必备插件,ubuntu 分区 usr,tomcat报连接失败,爬虫天气网站,php 命名空间的作用,seo新手如何快速入门引流,微信群网站模版源码,dedecms 装饰公司模板lzw

–监控索引是否使用

alter index &index_name monitoring usage;

alter index &index_name nomonitoring usage;

select * from v$object_usage where index_name = &index_name;

–求数据文件的I/O分布

select df.name,phyrds,phywrts,phyblkrd,phyblkwrt,singleblkrds,readtim,writetim

from v$filestat fs,v$dbfile df

where fs.file#=df.file# order by df.name;

–求某个隐藏参数的值

col ksppinm format a54

col ksppstvl format a54

select ksppinm, ksppstvl

from x$ksppi pi, x$ksppcv cv

where cv.indx=pi.indx and pi.ksppinm like ‘\_%’ escape ‘\’ and pi.ksppinm like ‘%meer%’;

–求系统中较大的latch

select name,sum(gets),sum(misses),sum(sleeps),sum(wait_time)

from v$latch_children

group by name having sum(gets) > 50 order by 2;

–求归档日志的切换频率(生产系统可能时间会很长)

select start_recid,start_time,end_recid,end_time,minutes from (select test.*, rownum as rn

from (select b.recid start_recid,to_char(b.first_time,’yyyy-mm-dd hh24:mi:ss’) start_time,

a.recid end_recid,to_char(a.first_time,’yyyy-mm-dd hh24:mi:ss’) end_time,round(((a.first_time-b.first_time)*24)*60,2) minutes

from v$log_history a,v$log_history b where a.recid=b.recid+1 and b.first_time > sysdate – 1

order by a.first_time desc) test) y where y.rn < 30

–求回滚段正在处理的事务

select a.name,b.xacts,c.sid,c.serial#,d.sql_text

from v$rollname a,v$rollstat b,v$session c,v$sqltext d,v$transaction e

where a.usn=b.usn and b.usn=e.xidusn and c.taddr=e.addr

and c.sql_address=d.address and c.sql_hashvalue=d.hash_value order by a.name,c.sid,d.piece;

–求出无效的对象

select ‘alter procedure ‘||object_name||’ compile;’

from dba_objects

where status=’INVALID’ and wner=’&’ and object_type in (‘PACKAGE’,’PACKAGE BODY’);

/

select owner,object_name,object_type,status from dba_objects where status=’INVALID’;

–求process/session的状态

select p.pid,p.spid,s.program,s.sid,s.serial#

from v$process p,v$session s where s.paddr=p.addr;

–求当前session的状态

select sn.name,ms.value

from v$mystat ms,v$statname sn

where ms.statistic#=sn.statistic# and ms.value > 0;

–求表的索引信息

select ui.table_name,ui.index_name

from user_indexes ui,user_ind_columns uic

where ui.table_name=uic.table_name and ui.index_name=uic.index_name

and ui.table_name like ‘&table_name%’ and uic.column_name=’&column_name’;

–显示表的外键信息

col search_condition format a54

select table_name,constraint_name

from user_constraints

where constraint_type =’R’ and constraint_name in (select constraint_name from user_cons_columns where column_name=’&1′);

select rpad(child.table_name,25,’ ‘) child_tablename,

rpad(cp.column_name,17,’ ‘) referring_column,rpad(parent.table_name,25,’ ‘) parent_tablename,

rpad(pc.column_name,15,’ ‘) referred_column,rpad(child.constraint_name,25,’ ‘) constraint_name

from user_constraints child,user_constraints parent,

user_cons_columns cp,user_cons_columns pc

where child.constraint_type = ‘R’ and child.r_constraint_name = parent.constraint_name and

child.constraint_name = cp.constraint_name and parent.constraint_name = pc.constraint_name and

cp.position = pc.position and child.table_name =’&table_name’

order by child.owner,child.table_name,child.constraint_name,cp.position;


Oracle数据库DBA日常Sql列表
  • Oracle表空间文件损坏后的排查及解决
  • Oracle表空间文件损坏后的排查及解决 | Oracle表空间文件损坏后的排查及解决 ...

    Oracle数据库DBA日常Sql列表
  • OEM以及Oracle客户端中sys无法以sysdba登录解决案例
  • OEM以及Oracle客户端中sys无法以sysdba登录解决案例 | OEM以及Oracle客户端中sys无法以sysdba登录解决案例 ...

    Oracle数据库DBA日常Sql列表
  • 在Oracle 10g中如何删除归档日志
  • 在Oracle 10g中如何删除归档日志 | 在Oracle 10g中如何删除归档日志 ...