Oracle Data Guard_啟動和關閉物理備庫

來源:互聯網
上載者:User

啟動時應用重做日誌,關閉時取消重做日誌:

8.1Starting Up and Shutting Down a Physical Standby Database

This section describes the SQL*Plus statements used to start up and shut down a physical standby database.

8.1.1Starting Up a Physical Standby Database8.1.1 啟動物理備庫 

To start a physical standby database, use SQL*Plus to connect to the database with administrator privileges, and then use either the SQL*PlusSTARTUPorSTARTUPMOUNTstatement. When used on a physical standby database:

  • TheSTARTUPstatement starts the database, mounts the database as a physical standby database, and opens the database for read-only access.

  • TheSTARTUP MOUNTstatement starts and mounts the database as a physical standby database, but does not open the database.

  •  

Once mounted, the database can receive archived redo data from the primary database. You then have the option of either starting Redo Apply or real-time apply, or opening the database for read-only access.

一旦資料庫裝載後,資料庫就能從主庫接收歸檔重做日誌。然後,你可以選擇啟用應用重做或者即時應用,再或者以唯讀方式開啟資料庫來訪問。

 

For example:

  1. Start and mount the physical standby database:

    SQL> STARTUP MOUNT;
  2. Start Redo Apply or real-time apply:

    To start Redo Apply, issue the following statement:

    SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE2>DISCONNECT FROM SESSION; #########################################################################Sat Mar 29 11:48:57 2014ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSIONSat Mar 29 11:48:57 2014Attempt to start background Managed Standby Recovery process (PRODSTD)MRP0 started with pid=54, OS id=3158Sat Mar 29 11:48:57 2014MRP0: Background Managed Standby Recovery process started (PRODSTD)Managed Standby Recovery not using Real Time ApplyMedia Recovery Waiting for thread 1 sequence 29Sat Mar 29 11:49:03 2014Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION ############################################################################

    To start real-time apply, issue the following statement:

    SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE2>USING CURRENT LOGFILE;

 

On the primary database, query theRECOVERY_MODEcolumn in theV$ARCHIVE_DEST_STATUSview, which displays the standby database's operation asMANAGED_RECOVERYfor Redo Apply andMANAGED REAL TIME APPLYfor real-time apply.

在主庫上,你可以查詢V$ARCHIVE_DEST_STATUS的RECOVERY_MODE列,可以顯示出備庫的操作是MANAGED_RECOVERY 重做應用還是MANAGED REAL TIME APPLY即時應用。

 

SeeSection 6.3for information about Redo Apply,Section 6.2.1for information about real-time apply, andSection 8.2for information about opening a physical standby database for read-only or read/write access.

 

Note:

When you first start Redo Apply on a newly created physical standby database that has not yet received any redo data from the primary database, anORA-01112message may be returned. This indicates that Redo Apply is unable to determine the starting sequence number for media recovery. If this occurs, you must either manually retrieve and register an archived redo log file on the standby database, or wait for the automatic archiving to occur before restarting Redo Apply.當你在一個新建立的物理備庫上第一次應用重做時,主庫並沒有歸檔日誌傳輸到備庫來,於是報錯ORA-01112.這意味著重做應用無法為介質恢複提供一個日誌序號。如果這個情況發生,你必須手動在備庫上產生一個歸檔日誌,或者在重做應用之前自動歸檔。

8.1.2Shutting Down a Physical Standby Database

Toshut down a physical standby database and stop Redo Apply, use the SQL*PlusSHUTDOWNstatement. Control is not returned to the session that initiates a database shutdown until shutdown is complete.

關閉物理備庫以及關閉重做應用,使用SHUTDOWN 語句。

If the primary database is up and running, defer the destination on the primary database and perform a log switch before shutting down the standby database.

如果主庫正在運行,在主要資料庫上延遲目的地以及在關閉備庫之前先執行日誌切換。

 

To stop Redo Apply before shutting down the database, use the following steps:

在關閉資料庫之前要先停止重做應用,使用一下步驟:

 

  1. Issue the following query to find out if the standby database is performing Redo Apply or real-time apply. If the MRP0 or MRP process exists, then the standby database is applying redo.

    1.通過如下查詢找出備庫是在重做應用還是即時應用,如果MRP0或者MRP進程存在,那麼備庫正在應用重做。

    SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY; ###############################################################################PROCESS STATUS--------- ------------ARCH CONNECTEDARCH CONNECTEDMRP0 WAIT_FOR_LOGRFS IDLERFS IDLE###############################################################################
  2. If Redo Apply is running, cancel it as shown in the following example:

    2.如果重做應用正在運行,用如下例子來取消它。

    SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; ###############################################################################Sat Mar 29 11:49:40 2014ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCELSat Mar 29 11:49:42 2014MRP0: Background Media Recovery cancelled with status 16037Sat Mar 29 11:49:42 2014Errors in file /u01/app/Oracle/admin/PRODSTD/bdump/prodstd_mrp0_3158.trc:ORA-16037: user requested cancel of managed recovery operationRecovery interrupted!Sat Mar 29 11:49:43 2014Waiting for MRP0 pid 3158 to terminateWaiting for MRP0 pid 3158 to terminateWaiting for MRP0 pid 3158 to terminateSat Mar 29 11:49:45 2014Errors in file /u01/app/oracle/admin/PRODSTD/bdump/prodstd_mrp0_3158.trc:ORA-16037: user requested cancel of managed recovery operationSat Mar 29 11:49:45 2014MRP0: Background Media Recovery process shutdown (PRODSTD)Sat Mar 29 11:49:46 2014Managed Standby Recovery Canceled (PRODSTD)Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL 取消日誌應用之後,即沒有MRP0的進程了。###############################################################################
  3. Shut down the standby database.

    3.關閉備庫。

    SQL> SHUTDOWN IMMEDIATE;

推薦閱讀:

RMAN 配置歸檔日誌刪除策略

Oracle基礎教程之通過RMAN複製資料庫

RMAN備份策略制定參考內容

RMAN備份學習筆記

OracleDatabase Backup加密 RMAN加密

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.