首页 oracle oracle 系统表大全

oracle oracle 系统表大全

举报
开通vip

oracle oracle 系统表大全oracleoracle系统表大全2009年06月07日星期日13:14数据字典dict总是属于Oracle用户sys的。  1、用户:   selectusernamefromdba_users;  改口令   alteruserspgroupidentifiedbyspgtest;  2、表空间:   select*fromdba_data_files;   select*fromdba_tablespaces;//表空间   selecttablespace_name,sum(bytes),sum(block...

oracle oracle 系统表大全
oracleoracle系统表大全2009年06月07日星期日13:14数据字典dict总是属于Oracle用户sys的。  1、用户:   selectusernamefromdba_users;  改口令   alteruserspgroupidentifiedbyspgtest;  2、表空间:   select*fromdba_data_files;   select*fromdba_tablespaces;//表空间   selecttablespace_name,sum(bytes),sum(blocks)    fromdba_free_spacegroupbytablespace_name;//空闲表空间   select*fromdba_data_files    wheretablespace_name='RBS';//表空间对应的数据文件   select*fromdba_segments    wheretablespace_name='INDEXS';  3、数据库对象:   select*fromdba_objects;   CLUSTER、DATABASELINK、FUNCTION、INDEX、LIBRARY、PACKAGE、PACKAGEBODY、   PROCEDURE、SEQUENCE、SYNONYM、TABLE、TRIGGER、TYPE、UNDEFINED、VIEW。  4、表:   select*fromdba_tables;   analyzemy_tablecomputestatistics;->dba_tables后6列   selectextent_id,bytesfromdba_extents   wheresegment_name='CUSTOMERS'andsegment_type='TABLE'   orderbyextent_id;//表使用的extent的信息。segment_type='ROLLBACK'查看回滚段的空间分配信息   列信息:    selectdistincttable_name    fromuser_tab_columns    wherecolumn_name='SO_TYPE_ID';  5、索引:    select*fromdba_indexes;//索引,包括主键索引   select*fromdba_ind_columns;//索引列   selecti.index_name,i.uniqueness,c.column_name    fromuser_indexesi,user_ind_columnsc     wherei.index_name=c.index_name     andi.table_name='ACC_NBR';//联接使用  6、序列:   select*fromdba_sequences;  7、视图:   select*fromdba_views;   select*fromall_views;  text可用于查询视图生成的脚本  8、聚簇:   select*fromdba_clusters;  9、快照:   select*fromdba_snapshots;  快照、分区应存在相应的表空间。  10、同义词:   select*fromdba_synonyms    wheretable_owner='SPGROUP';    //ifownerisPUBLIC,thenthesynonymsisapublicsynonym.     ifownerisoneofusers,thenthesynonymsisaprivatesynonym.  11、数据库链:   select*fromdba_db_links;  在spbase下建数据库链   createdatabaselinkdbl_spnew   connecttospnewidentifiedbyspnewusing'jhhx';   insertintoacc_nbr@dbl_spnew   select*fromacc_nbrwherenxx_nbr='237'andline_nbr='8888';  12、触发器:   select*fromdba_trigers;  存储过程,函数从dba_objects查找。  其文本:selecttextfromuser_sourcewherename='BOOK_SP_EXAMPLE';  建立出错:select*fromuser_errors;  oracle总是将存储过程,函数等软件放在SYSTEM表空间。  13、约束:  (1)约束是和表关联的,可在createtable或altertabletable_nameadd/drop/modify来建立、修改、删除约束。  可以临时禁止约束,如:   altertablebook_example   disableconstraintbook_example_1;   altertablebook_example   enableconstraintbook_example_1;  (2)主键和外键被称为表约束,而notnull和unique之类的约束被称为列约束。通常将主键和外键作为单独的命名约束放在字段列表下面,而列约束可放在列定义的同一行,这样更具有可读性。  (3)列约束可从表定义看出,即describe;表约束即主键和外键,可从dba_constraints和dba_cons_columns查。   select*fromuser_constraints   wheretable_name='BOOK_EXAMPLE';   selectowner,CONSTRAINT_NAME,TABLE_NAME    fromuser_constraints    whereconstraint_type='R'    orderbytable_name;  (4)定义约束可以无名(系统自动生成约束名)和自己定义约束名(特别是主键、外键)  如:createtablebook_example    (identifiernumbernotnull);    createtablebook_example    (identifiernumberconstranitbook_example_1notnull);  14、回滚段:  在所有的修改结果存入磁盘前,回滚段中保持恢复该事务所需的全部信息,必须以数据库发生的事务来相应确定其大小(DML语句才可回滚,create,drop,truncate等DDL不能回滚)。  回滚段数量=并发事务/4,但不能超过50;使每个回滚段大小足够处理一个完整的事务;   createrollbacksegmentr05   tablespacerbs;   createrollbacksegmentrbs_cvt   tablespacerbs   storage(initial1Mnext500k);  使回滚段在线   alterrollbacksegmentr04online;  用dba_extents,v$rollback_segs监测回滚段的大小和动态增长。  回滚段的区间信息   select*fromdba_extents   wheresegment_type='ROLLBACK'andsegment_name='RB1';  回滚段的段信息,其中bytes显示目前回滚段的字节数   select*fromdba_segments    wheresegment_type='ROLLBACK'andsegment_name='RB1';  为事物指定回归段   settransactionuserollbacksegmentrbs_cvt  针对bytes可以使用回滚段回缩。   alterrollbacksegmentrbs_cvtshrink;   selectbytes,extents,max_extentsfromdba_segments    wheresegment_type='ROLLBACK'andsegment_name='RBS_CVT';  回滚段的当前状态信息:   select*fromdba_rollback_segs    wheresegment_name='RB1';  比多回滚段状态status,回滚段所属实例instance_num  查优化值optimal   selectn.name,s.optsize    fromv$rollnamen,v$rollstats     wheren.usn=s.usn;  回滚段中的数据   settransactionuserollbacksegmentrb1;/*回滚段名*/   selectn.name,s.writes    fromv$rollnamen,v$rollstats     wheren.usn=s.usn;  当事务处理完毕,再次查询$rollstat,比较writes(回滚段条目字节数)差值,可确定事务的大小。  查询回滚段中的事务   columnrrheading'RBSegment'formata18   columnusheading'Username'formata15   columnosheading'OsUser'formata10   columnteheading'Terminal'formata10   selectr.namerr,nvl(s.username,'notransaction')us,s.osuseros,s.terminalte    fromv$lockl,v$sessions,v$rollnamer     wherel.sid=s.sid(+)     andtrunc(l.id1/65536)=R.USN     andl.type='TX'     andl.lmode=6   orderbyr.name;  15、作业  查询作业信息   selectjob,broken,next_date,interval,whatfromuser_jobs;   selectjob,broken,next_date,interval,whatfromdba_jobs;  查询正在运行的作业   select*fromdba_jobs_running;  使用包execdbms_job.submit(:v_num,'a;',sysdate,'sysdate+(10/(24*60*60))')加入作业。间隔10秒钟execdbms_job.submit(:v_num,'a;',sysdate,'sysdate+(11/(24*60))')加入作业。间隔11分钟使用包execdbms_job.remove(21)删除21号作业。原文网址:http://hi.baidu.com/aku88168/blog/item/47a79aeff63d6c1efdfa3cf4.html由弘一网童保存,尚未注册。注册
本文档为【oracle oracle 系统表大全】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
个人认证用户
kellyz
暂无简介~
格式:doc
大小:21KB
软件:Word
页数:0
分类:房地产
上传时间:2020-02-05
浏览量:0