8.3Managing Primary Database Events That Affect the Standby Database8.3 管理主庫能影響備庫的事件
To prevent possible problems, you must be aware of events on the primary database that affect a standby database and learn how to respond to them. This section describes these events and the recommended responses to these events.
In some cases, the events or changes that occur on a primary database are automatically propagated through redo data to the standby database and thus require no extra action on the standby database. In other cases, you might need to perform maintenance tasks on the standby database.
Table 8-1indicates whether or not a change made on the primary database requires additional intervention by the database administrator (DBA) to be propagated to the standby database. It also briefly describes how to respond to these events. Detailed descriptions of the responses are described in the section references provided.
The following events are automatically administered by redo transport services and Redo Apply, and therefore require no intervention by the database administrator:
A SQLALTER DATABASE
statement is issued with theENABLE THREAD
orDISABLE THREAD
clause.
The status of a tablespace changes (changes to read/write or read-only, placed online or taken offline).
A datafile is added or tablespace is created when theSTANDBY_FILE_MANAGEMENT
initialization parameter is set toAUTO
.
Table 8-1 Actions Required on a Standby Database After Changes to a Primary Database
Reference |
Change Made on Primary Database |
Action Required on Standby Database |
Section 8.3.1 |
Add a datafile or create a tablespace 添加檔案或建立資料表空間 |
If you did not set theSTANDBY_FILE_MANAGEMENT initialization parameter toAUTO , you must copy the new datafile to the standby database. 如果STANDBY_FILE_MANAGEMENT初始化參數沒有設定為AUTO,那麼你必須將新的資料檔案拷貝到備庫 |
Section 8.3.2 |
Drop or delete a tablespace or datafile 刪除資料表空間或資料檔案 |
Delete datafiles from primary and standby databases after the archived redo log file containing theDROP orDELETE command was applied. 從主庫刪除資料檔案,備庫機會應用程式套件含DROP或者DELETE命令的歸檔重做日誌來應用 |
Section 8.3.3 |
Use transportable tablespaces 使用傳輸資料表空間 |
Move tablespaces between the primary and standby databases. 在主備庫之間移動資料表空間 |
Section 8.3.4 |
Rename a datafile 重新命名一個資料檔案 |
Rename the datafile on the standby database. 在備庫重命令資料檔案 |
Section 8.3.5 |
Add or drop redo log files 添加或刪除重做記錄檔愛你 |
Synchronize changes on the standby database. 在備庫上同步改變 |
Section 8.3.6 |
Perform a DML or DDL operation using theNOLOGGING orUNRECOVERABLE clause 使用NOLOGGING 或者UNRECOVERABLE 執行DML或者DDL操作, |
Send the datafile containing the unlogged changes to the standby database. 向備庫發送包含沒有日誌記錄的檔案 |
Chapter 13 |
Change initialization parameters 改變初始化參數 |
Dynamically change the standby parameters or shut down the standby database and update the initialization parameter file. 動態改變備用的參數或者關閉備庫,再更新初始化參數檔案 |
8.3.1Adding a Datafile or Creating a Tablespace8.3.1添加一個資料檔案或者建立一個資料表空間
The initialization parameter,STANDBY_FILE_MANAGEMENT
, enables you to control whether or not adding a datafile to the primary database is automatically propagated to the standby database, as follows:
STANDBY_FILE_MANAGEMENT初始化參數檔案,能使用控制是否在添加資料檔案到主庫自動傳播到備庫,如下:
If you set theSTANDBY_FILE_MANAGEMENT
initialization parameter in the standby database server parameter file (SPFILE) toAUTO
, any new datafiles created on the primary database are automatically created on the standby database as well.
如果STANDBY_FILE_MANAGEMENT這個初始化參數檔案在備庫中的spfile是AUTO,那麼任何在主庫上新建立的資料檔案會自動的在備庫建立。
If you do not specify theSTANDBY_FILE_MANAGEMENT
initialization parameter or if you set it toMANUAL
, then you must manually copy the new datafile to the standby database when you add a datafile to the primary database.
如果STANDBY_FILE_MANAGEMENT沒有設定或者設定為MANUAL,那麼當你在主庫添加資料檔案時,你必須手動拷貝新的資料檔案到備庫
Note that if you copy an existing datafile from another database to the primary database, then you must also copy the new datafile to the standby database and re-create the standby control file, regardless of the setting ofSTANDBY_FILE_MANAGEMENT
initialization parameter.
注意,如果你從另一個資料庫已存在的資料檔案拷貝到到主庫,那麼你必須也要拷貝到倒庫,然後重新建立備用控制檔案,除非你設定了STANDBY_FILE_MANAGEMENT
初始化參數。
The following sections provide examples of adding a datafile to the primary and standby databases when theSTANDBY_FILE_MANAGEMENT
initialization parameter is set toAUTO
andMANUAL,
respectively.
按以下提供的例子來添加一個資料檔案到主庫,備庫的STANDBY_FILE_MANAGEMENT分別設定為AUTO和MANUAL。
8.3.1.1When STANDBY_FILE_MANAGEMENT Is Set to AUTO8.3.1.1 當STANDBY_FILE_MANAGEMENT設定為AUTO時,The following example shows the steps required to add a new datafile to the primary and standby databases when the
STANDBY_FILE_MANAGEMENT
initialization parameter is set to
AUTO
.
以下的例子給出了主庫添加一個資料檔案,備庫的STANDBY_FILE_MANAGEMENT為AUTO時的步驟。
Add a new tablespace to the primary database:
1.添加一個新的資料表空間到主庫:
SQL> CREATE TABLESPACE new_ts DATAFILE '/disk1/Oracle/oradata/payroll/t_db2.dbf'2> SIZE 1m AUTOEXTEND ON MAXSIZE UNLIMITED;
Archive the current online redo log file so the redo data will be transmitted to and applied on the standby database:
歸檔當前現在重做日誌,這樣,重做日誌會傳輸到備庫,並且備庫會應用傳輸過來的日誌:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Verify the new datafile was added to the primary database:
3.驗證新的資料檔案被添加到主庫:
SQL> SELECT NAME FROM V$DATAFILE;NAME----------------------------------------------------------------------/disk1/oracle/oradata/payroll/t_db1.dbf/disk1/oracle/oradata/payroll/t_db2.dbf
Verify the new datafile was added to the standby database:
驗證信的資料檔案被添加到備庫:
SQL> SELECT NAME FROM V$DATAFILE;NAME----------------------------------------------------------------------/disk1/oracle/oradata/payroll/s2t_db1.dbf/disk1/oracle/oradata/payroll/s2t_db2.dbf