資料庫引數檔案控制檔案日誌檔案資料檔案跟蹤檔案等8大檔案的字典

skyin_1603發表於2016-12-22

這裡將檢視的是資料庫系統8大檔案的相關字典。8大檔案包括:
引數檔案、密碼檔案、控制檔案、重做日誌檔案、歸檔日誌檔案、資料檔案、alert告警檔案和trace跟蹤檔案。
細說的當然還有臨時檔案、備份檔案、概要檔案等檔案,這些對於資料庫來說都很重要。

瞭解這8大檔案的存放位置以及相關的內容,對管理資料庫起到至關重要的作用。

----檢視資料檔案的相關字典:

---1檢視引數檔案:

sys@PROD>show parameter spfile

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      /u01/app/oracle/product/11.2.0

                                                 /dbhome_1/dbs/spfilePROD.ora

sys@PROD>show parameter pfile

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      /u01/app/oracle/product/11.2.0

                                                 /dbhome_1/dbs/spfilePROD.ora

---2密碼檔案:通常密碼檔案與兩個引數檔案的存放目錄是一樣的。

---3檢視alert告警檔案

sys@PROD>show parameter dump_dest

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

background_dump_dest                 string      /u01/app/oracle/diag/rdbms/pro

                                                 d/PROD/trace

core_dump_dest                       string      /u01/app/oracle/diag/rdbms/pro

                                                 d/PROD/cdump

user_dump_dest                       string      /u01/app/oracle/diag/rdbms/pro

                                                 d/PROD/trace

---4檢視trace跟蹤檔案:

sys@PROD>show parameter dump_dest

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

background_dump_dest                 string      /u01/app/oracle/diag/rdbms/pro

                                                 d/PROD/trace

core_dump_dest                       string      /u01/app/oracle/diag/rdbms/pro

                                                 d/PROD/cdump

user_dump_dest                       string      /u01/app/oracle/diag/rdbms/pro

                                                d/PROD/trace

#trace檔案與alert檔案同在一個目錄下面,所以還可以使用以下方法檢視這兩個檔案存放的位置:
sys@PROD>select value from v$diag_info where name='Diag Alert';
VALUE
----------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/prod/PROD/alert
或者:

sys@PROD>select value from v$diag_info where name='Diag Trace';
VALUE
----------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/prod/PROD/trace
 


---5檢視控制檔案:

sys@PROD>show parameter control_file

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

control_file_record_keep_time        integer     7

control_files                        string      /u01/app/oracle/oradata/PROD/c

                                                 ontrol01.ctl, /u01/app/oracle/

                                                 fast_recovery_area/PROD/contro

                                                 l02.ctl

或者:

Select * from  v$controlfile;

sys@PROD>desc v$controlfile

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 STATUS                                             VARCHAR2(7)

 NAME                                               VARCHAR2(513)

 IS_RECOVERY_DEST_FILE                              VARCHAR2(3)

 BLOCK_SIZE                                         NUMBER

 FILE_SIZE_BLKS                                     NUMBER

 

---6檢視資料檔案:

Select * from v$datafile;

sys@PROD>desc v$datafile

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 FILE#                                              NUMBER

 CREATION_CHANGE#                                   NUMBER

 CREATION_TIME                                      DATE

 TS#                                                NUMBER

 RFILE#                                             NUMBER

 STATUS                                             VARCHAR2(7)

... ...
或者:
--檢視資料檔案的資訊:


Select * from dba_data_files;

sys@PROD>desc dba_data_files;

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 FILE_NAME                                          VARCHAR2(513)

 FILE_ID                                            NUMBER

 TABLESPACE_NAME                                    VARCHAR2(30)

 BYTES                                              NUMBER

 BLOCKS                                             NUMBER

 STATUS                                             VARCHAR2(9)

 RELATIVE_FNO                                       NUMBER

 AUTOEXTENSIBLE                                     VARCHAR2(3)

 MAXBYTES                                           NUMBER

 MAXBLOCKS                                          NUMBER

 INCREMENT_BY                                       NUMBER

 USER_BYTES                                         NUMBER

 USER_BLOCKS                                        NUMBER

 ONLINE_STATUS                                      VARCHAR2(7)


---7檢視重做日誌檔案(redo_log:

Select * from  v$log;

sys@PROD>desc v$log;

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 GROUP#                                             NUMBER

 THREAD#                                            NUMBER

 SEQUENCE#                                          NUMBER

 BYTES                                              NUMBER

 BLOCKSIZE                                          NUMBER

 MEMBERS                                            NUMBER

... ...

Select * from v$logfile;

sys@PROD>desc v$logfile;

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 GROUP#                                             NUMBER

 STATUS                                             VARCHAR2(7)

 TYPE                                               VARCHAR2(7)

 MEMBER                                             VARCHAR2(513)

 IS_RECOVERY_DEST_FILE                              VARCHAR2(3)

 

---8檢視歸檔日誌檔案

select * from v$archived_log

sys@PROD>desc v$archived_log;

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 RECID                                              NUMBER

 STAMP                                              NUMBER

 NAME                                               VARCHAR2(513)

 DEST_ID                                            NUMBER

 THREAD#                                            NUMBER

 SEQUENCE#                                          NUMBER

 RESETLOGS_CHANGE#                                  NUMBER

 RESETLOGS_TIME                                     DATE

... ...

 

---9檢視歸檔日誌的存放目錄:

select * from v$archive_dest;

desc v$archive_dest;

sys@PROD>desc v$archive_dest;

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 DEST_ID                                            NUMBER

 DEST_NAME                                          VARCHAR2(256)

 STATUS                                             VARCHAR2(9)

 BINDING                                            VARCHAR2(9)

 NAME_SPACE                                         VARCHAR2(7)

 TARGET                                             VARCHAR2(7)

 ARCHIVER                                           VARCHAR2(10)

... ...

---相關資料檔案:

---10檢視臨時檔案資訊:

Select * from v$tempfile;

SQL> desc v$tempfile

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 FILE#                                              NUMBER

 CREATION_CHANGE#                                   NUMBER

 CREATION_TIME                                      DATE

 TS#                                                NUMBER

 RFILE#                                             NUMBER

 STATUS                                             VARCHAR2(7)

 ENABLED                                            VARCHAR2(10)

 

---11檢視備份檔案的資訊:

Select * from v$backup_files;

sys@PROD>desc v$backup_files

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 PKEY                                               NUMBER

 BACKUP_TYPE                                        VARCHAR2(32)

 FILE_TYPE                                          VARCHAR2(32)

 KEEP                                               VARCHAR2(3)

 KEEP_UNTIL                                         DATE

 KEEP_OPTIONS                                       VARCHAR2(13)

 STATUS                                             VARCHAR2(16)

 FNAME                                              VARCHAR2(1024)

 TAG                                                VARCHAR2(32)

 MEDIA                                              VARCHAR2(80)

 RECID                                              NUMBER

 STAMP                                              NUMBER

 DEVICE_TYPE                                        VARCHAR2(255)

... ...

---12檢視資料檔案頭部:

Select * from v$datafile_header;

sys@PROD>desc v$datafile_header;

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 FILE#                                              NUMBER

 STATUS                                             VARCHAR2(7)

 ERROR                                              VARCHAR2(18)

 FORMAT                                             NUMBER

 RECOVER                                            VARCHAR2(3)

 FUZZY                                              VARCHAR2(3)

 CREATION_CHANGE#                                   NUMBER

 CREATION_TIME                                      DATE

 TABLESPACE_NAME                                    VARCHAR2(30)

 TS#                                                NUMBER

... ...

---13檢視使用者概要檔案的資訊:

Select * from dba_profiles;

sys@PROD>desc dba_profiles

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 PROFILE                                   NOT NULL VARCHAR2(30)

 RESOURCE_NAME                             NOT NULL VARCHAR2(32)

 RESOURCE_TYPE                                      VARCHAR2(8)

 LIMIT                                              VARCHAR2(40)

#使用者概要檔案,約束賬戶的一些行為的檔案。

--羅列查來這些主要是能夠方便大家容易集中地獲取到這些重要的字典資訊。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2131228/,如需轉載,請註明出處,否則將追究法律責任。

相關文章