Oracle常用数据字典培训讲义

更新时间:2024-03-24 20:50:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

常用DBA视图的使用、常用的辅助脚本、权限管理、工具

1、常用DBA视图介绍

1.1什么是数据字典

数据库数据字典是一组表和视图结构,它们存放在SYSTEM表空间中,是数据库的重要组成部分,存放数据库所用的有关信息,对用户来说是一组只读的表。 数据字典内容包括:

数据库中所有模式对象的信息,如表、视图、簇、及索引等,分配多少空间 当前使用了多少空间等。 列的缺省值。约束信息的完整性。 用户的名字。

用户及角色被授予的权限。 用户访问或使用的审计信息。 其它产生的数据库信息。

我的理解:就相当于windows操作系统的注册表,用来辅助oracle做自身管理。

1.2常用数据字典

命名说明

Oracle数据字典中,对象名称多数以\,\,\为前缀。 \视图中记录通常记录执行查询的帐户所拥有的对象的信息; \视图中记录包括\记录和授权至PUBLIC或用户的对象的信息; \视图包含所有数据库对象,而不管其所有者。

常用数据字典

视图名 dba_tablespaces v$tablespace dba_data_files v$datafile(是别名) dba_free_space 描述 记录数据库都有哪些表空间及存储参数 仅记录数据中的表空间 记录数据库所有的数据文件及所在的表空间 记录数据文件创建时间等信息 记录各个表空间剩余空间。 ALL_CATALOG Dba_tables(index) All_tables All tables, views, synonyms, sequences accessible to the user 系统所有表及所在表空间,存储参数。 所有表 All_views V$instance V$database 所有试图 当前数据库实例名 数据库名字 ALL_COL_COMMENTS All_tab_comments ALL_CONSTRAINTS ALL_DB_LINKS ALL_DEPENDENCIES ALL_SEQUENCES ALL_SYNONYMS ALL_TAB_COLUMNS ALL_TRIGGERS DBA_USERS

Comments on columns of accessible tables and views 表的备注 Constraint definitions on accessible tables Database links accessible to the user Dependencies to and from objects accessible to the user Description of SEQUENCEs accessible to the user All synonyms accessible to the user Columns of all tables, views and clusters Triggers accessible to the current user Information about all users of the database 其它的数据字典参见:《Oracle常用数据字典.doc》

2、常用辅助脚本

2.1捕捉运行很久的SQL (Oracle9 以上版本)

select username,sid,opname, round(sofar*100 / totalwork,0), time_remaining,sql_text from v$session_longops , v$sql

where time_remaining <>0 and sql_address = address and sql_hash_value = hash_value ;

2.2、耗资源的进程(top session)

select s.schemaname schema_name,

decode(sign(48 - command),1,to_char(command), 'Action Code #', to_char(command) ) action, status

session_status, s.osuser os_user_name, s.sid, p.spid , s.serial# serial_num,

nvl(s.username, '[Oracle process]') user_name, s.terminal terminal, s.program program, st.value criteria_value from v$sesstat st, v$session s , v$process p

where st.sid = s.sid and st.statistic# = to_number('38') and

('ALL' = 'ALL' or s.status = 'ALL') and p.addr = s.paddr order by st.value desc, p.spid asc, s.username asc, s.osuser asc ;

其它的数据字典参见:《Oracle优化的sql.txt》

3、相关工具

3.1 ObjectBrowser工具介绍

1、查看sql执行计划 2、查看表空间情况。 3、数据库锁情况。

4、创建表、视图、触发器等、公共链接。并且可以查看他们的源代码。

3.2 PL/SQL developer工具介绍

方法跟ob工具类似。

本文来源:https://www.bwwdw.com/article/vd68.html

Top