实验描述:
数据库性能视图是随实例启动而创建,实例关闭而删除。与数据字典有些许不同,数据字典的信息是从数据文件中取得;而动态性能视图的信息则是从SGA内存以及控制文件中取得。
一般情况下,我们可以通过动态性能数据掌握两类重要的数据库运行信息。
一是了解数据库运行相关的性能数据,如内存的使用量、磁盘排序发生的机率等等。
二是取得与磁盘和内存结构相关的其他信息。这些信息将是我们进行数据库维护与数据库性能调整的主要参考依据。
1.V_$fixed_table该动态性能视图用于列出所有可用的动态性能视图和动态性能表
SQL> desc V_$fixed_table
Name Null? Type
----------------------------------------- -------- ----------------------------
NAME VARCHAR2(30)
OBJECT_ID NUMBER
TYPE VARCHAR2(5)
TABLE_NUM NUMBER
2.数据库在不同状态下可以查询的性能视图
1).nomount
Oracle数据库会打开参数文件,分配SGA内存并启动后台进程此时,动态性呢视图收集的信息来源只有是SGA,而不会从控制文件中收集相关的信息。
SGA--------V$PARAMETER、V$SGA、V$OPTION V$PROCESS、V$SESSION、V$VERSION V$INSTANCE
2).MOUNT
装载数据库时,ORACLE根据初始化参数control_file 打开所有控制文件。当例程处于MOUNT状态时,不仅可以访问从SGA中获取信息的动态性能视图,还可以访问从控制文件中获取信息的动态性能视图。
控制文件-------V$THREAD、V$CONTROLFILE、V$DATABASE、V$DATAFILE、V$DATAFILE_HEADER、V$LOGFILE
3).OPEN
数据库打开时,ORACLE按照控制文件所记载的信息打开所有数据文件和重做日志。除了可以访问SGA和控制文件中获取信息的动态性能视图外,还可以访问与ORACLE性能相关的动态性能视图(V$FILESTAT V$SESSION_WAIT V$WAITSTAT)
注意的是,只有处于OPEN状态时,才能访问数据字典视图。
4.oracle官方文档关于动态性能视图的描述
http://download.oracle.com/docs/cd/E11882_01/server.112/e10713/datadict.htm#i4370
1)Contents of the Dynamic Performance Views
Dynamic performance views are sometimes called fixed views because they cannot be altered or removed by a database administrator. However, database administrators can query and create views on the tables and grant access to these views to other users.
SYS owns the dynamic performance tables, whose names begin with V_$. Views are created on these tables, and then public synonyms prefixed with V$. For example, the V$DATAFILE view contains information about data files. The V$FIXED_TABLE view contains information about all of the dynamic performance tables and views.
For almost every V$ view, a corresponding GV$ view exists. In Oracle Real Application Clusters (Oracle RAC), querying a GV$ view retrieves the V$ view information from all qualified database instances
When you use the Database Configuration Assistant (DBCA) to create a database, Oracle automatically creates the data dictionary. Oracle Database automatically runs the catalog.sql script, which contains definitions of the views and public synonyms for the dynamic performance views. You must runcatalog.sql to create these views and synonyms.
2)Storage of the Dynamic Performance Views
Dynamic performance views are based on virtual tables built from database memory structures. Thus, they are not conventional tables stored in the database.Read consistency is not guaranteed for the views because the data is updated dynamically.
Because the dynamic performance views are not true tables, the data is dependent on the state of the database and instance. For example, you can queryV$INSTANCE and V$BGPROCESS when the database is started but not mounted. However, you cannot query V$DATAFILE until the database has been mounted.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26739940/viewspace-766210/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26739940/viewspace-766210/