查看和监控

来源:互联网 发布:windows snmp配置文件 编辑:程序博客网 时间:2024/06/04 23:30
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

1. 查看本用户下的各种对象的SQL脚本

SQL语句:

表:

  select*fromcat;

  select*fromtab;

  selecttable_namefromuser_tables;

视图:

  selecttextfromuser_viewswhereview_name=upper('&view_name');

索引:

  selectindex_name,table_owner,table_name,tablespace_name,statusfromuser_indexesorderbytable_name;

触发器:

  selecttrigger_name,trigger_type,table_owner,table_name,statusfromuser_triggers;

快照:

  selectowner,name,master,table_name,last_refresh,nextfromuser_snapshotsorderbyowner,next;

同义词:

  select*fromsyn;

序列:

  select*fromseq;

数据库链路:

  select*fromuser_db_links;

约束限制:

  selectTABLE_NAME,CONSTRAINT_NAME,SEARCH_CONDITION,STATUSfromuser_constraints;

本用户读取其他用户对象的权限:

  select*fromuser_tab_privs;

本用户所拥有的系统权限:

  select*fromuser_sys_privs;

用户:

  select*fromall_usersorderbyuser_id;

表空间剩余自由空间情况:

  selecttablespace_name,sum(bytes)总字节数,max(bytes),count(*)fromdba_free_spacegroupbytablespace_name;

数据字典:

  selecttable_namefromdictorderbytable_name;

锁及资源信息:

  select*fromv$lock;不包括DDL锁

数据库字符集:

  selectname,value$fromprops$wherename='NLS_CHARACTERSET';

inin.ora参数:

  selectname,valuefromv$parameterorderbyname;

SQL共享池:

  selectsql_textfromv$sqlarea;

数据库:

  select*fromv$database

控制文件:

  select*fromV$controlfile;

重做日志文件信息:

  select*fromV$logfile;

来自控制文件中的日志文件信息:

  select*fromV$log;

来自控制文件中的数据文件信息:

  select*fromV$datafile;

NLS参数当前值:

  select*fromV$nls_parameters;

ORACLE版本信息:

  select*fromv$version;

描述后台进程:

  select*fromv$bgprocess;

查看版本信息:

  select*fromproduct_component_version;

2. 监控数据库

select'查看数据库的版本'fromdual;

SelectversionFROMProduct_component_versionWhereSUBSTR(PRODUCT,1,6)='';

 

select'查看数据库库对象'fromdual;

selectowner,object_type,status,count(*)count#fromall_objectsgroupbyowner,object_type,status;

 

select'查看数据库的创建日期和归档方式'fromdual;

SelectCreated,Log_Mode,Log_ModeFromV$Database;

 

select'查看控制文件'fromdual;

selectnamefromv$controlfile;

 

select'查看表空间的名称及大小'fromdual;

selectt.tablespace_name,round(sum(bytes/(1024*1024)),0)ts_sizefromdba_tablespacest,dba_data_filesdwheret.tablespace_name=d.tablespace_namegroupbyt.tablespace_name;

 

select'查看表空间物理文件的名称及大小'fromdual;

selecttablespace_name,file_id,file_name,round(bytes/(1024*1024),0)total_spacefromdba_data_filesorderbytablespace_name;

 

select'查看表空间的使用情况'fromdual;

selectsum(bytes)/(1024*1024)asfree_space,tablespace_namefromdba_free_spacegroupbytablespace_name;

SELECTA.TABLESPACE_NAME,A.BYTESTOTAL,B.BYTESUSED,C.BYTESFREE,(B.BYTES*100)/A.BYTES"%USED",(C.BYTES*100)/A.BYTES"%FREE"

FROMSYS.SM$TS_AVAILA,SYS.SM$TS_USEDB,SYS.SM$TS_FREEC

WHEREA.TABLESPACE_NAME=B.TABLESPACE_NAMEANDA.TABLESPACE_NAME=C.TABLESPACE_NAME;1
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>