重做日誌檔案的相關操作

yeahokay發表於2008-05-20

1.ADD LOG GROUP:

只增加一個日誌成員的寫法,用此種方法以後一定要再至少建立一個日誌成員:

ALTER DATABASE [database] ADD LOGFILE GROUP integer filespec SIZE size [REUSE] [,GROUP integer filespec SIZE size [REUSE] ...] ;

同時增加多個日誌成員的寫法(注意多了個小括號):

ALTER DATABASE [database] ADD LOGFILE GROUP integer ( filespec , filespec , filespec ...] ) SIZE size [REUSE];

說明:

--- filespec 包括地址的全檔名

--- 注意可以同時建立多個檔案

--- REUSE: 表示如果已經存在此檔案就重用它!

2.ADD LOG MEMBER:

ALTER DATABASE [database] ADD LOGFILE MEMBER 'filename' [REUSE] [, 'filename' [REUSE]...] TO GROUP integer | ( all_file_in_the_group_spec );

說明:

--- filespec 包括地址的全檔名

--- REUSE: 表示如果已經存在此檔案就重用它!

3.DROP LOG GROUP:

ALTER DATABASE [database] DROP LOGFILE GROUP integer | ( all_file_in_the_group_spec ) [,GROUP integer | ( all_file_in_the_group_spec ) ... ];

說明:

--- An instance requires at least two groups of online redo log files.(每個組至少要有兩個成員)

--- An active or current group cannot be dropped.(一個處於activecurrent狀態的組不能被刪除)

--- When an online redo log group is dropped, the operating system files are not deleted. (所用的刪除操作是指刪除資料庫中的資訊,在作業系統中不刪除。)

--- all_file_in_the_group_spec 此日誌組包括的所有的成員的全檔名

--- 當刪除用的是drop logfile group 5的時候,則group 5中的所有成員也同樣在資料庫中被刪除

4.DROP LOG MEMBER

ALTER DATABASE [database] DROP LOGFILE MEMBER 'filename'[, 'filename' ...];

說明:

--- If the member you want to drop is the last valid member of the group, you cannot drop that member.(組的最後一個成員不能刪除)

--- If the group is current, you must force a log file switch before you can drop the member.(正在使用的組不能刪除)

--- If the database is running in ARCHIVELOG mode and the log file group to which the member belongs is not archived, then the member cannot be dropped.(在歸檔模式下,必須歸檔後才能刪除)

--- When an online redo log member is dropped, the operating system file is not deleted.

5. RENAME LOG FILE

--- MUST BE IN THE MOUNT MODE 必須在mount模式下

--- 如果要將A檔案重新命名為B檔案,則必須在作業系統下複製A一份命名為B檔案,再在資料庫中更改!

6. CLEAR LOG FILE

當日志檔案(組)的所有成員被破壞以後(丟失,錯誤資訊等),DBA可以clear這個日誌檔案組。clear檔案相當於先刪除再重建一個新的一模一樣的日誌檔案組一樣,只是該方法當只有兩個日誌組其中一個出問題的情況,甚至這個出問題的log file沒有歸檔(在歸檔模式下)。

Syntax

ALTER DATABASE [database] CLEAR [UNARCHIVED] LOGFILE {GROUP integer | (‘filename’ [,’filename’,...])} [,{GROUP integer | (‘filename’ [,’filename’,...])},...]...;

7.Relocating Log File:

relocating = create a new same log file + remove the old log file

[@more@]

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

相關文章