動態效能檢視與資料字典的區別之一

zhjixi1234發表於2013-07-13

實驗描述:

資料庫效能檢視是隨例項啟動而建立,例項關閉而刪除。與資料字典有些許不同,資料字典的資訊是從資料檔案中取得;而動態效能檢視的資訊則是從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$PARAMETERV$SGAV$OPTION V$PROCESSV$SESSIONV$VERSION V$INSTANCE

2).MOUNT

裝載資料庫時,ORACLE根據初始化引數control_file 開啟所有控制檔案。當例程處於MOUNT狀態時,不僅可以訪問從SGA中獲取資訊的動態效能檢視,還可以訪問從控制檔案中獲取資訊的動態效能檢視。

控制檔案-------V$THREADV$CONTROLFILEV$DATABASEV$DATAFILEV$DATAFILE_HEADERV$LOGFILE

3)OPEN

資料庫開啟時,ORACLE按照控制檔案所記載的資訊開啟所有資料檔案和重做日誌。除了可以訪問SGA和控制檔案中獲取資訊的動態效能檢視外,還可以訪問與ORACLE效能相關的動態效能檢視(V$FILESTAT   V$SESSION_WAIT   V$WAITSTAT

注意的是,只有處於OPEN狀態時,才能訪問資料字典檢視。

 

4.oracle官方文件關於動態效能檢視的描述

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章