oracle 10g logical standby db creation

wisdomone1發表於2010-01-19

1,構建一個物理備庫,我們已經有了,哈哈,對吧
2,停止物理備庫日誌應用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
3,調整主庫用於支援邏輯備庫
 如主庫切換為邏輯備庫
  配置如下引數
LOG_ARCHIVE_DEST_3=
 'LOCATION=/oracle/centos/
  VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
  DB_UNIQUE_NAME=centos'
LOG_ARCHIVE_DEST_STATE_3=ENABLE


4,在重作資料中構建資料字典
在主庫
EXECUTE DBMS_LOGSTDBY.BUILD;


5,轉變為邏輯備庫
在備庫
 alter database recover to logical standby logic; --為新的邏輯備庫起的新db_name
 orapwd file=./orapwrhel password=system entries=10 force=y --為新logical standby db構建password file
 
6,為邏輯備庫調節某些引數
  shutdown immediate;
  startup mount;

  *.log_archive_config='dg_config=(centos,rhel)'
*.log_archive_dest_1='location=/oracle/rhelarch valid_for=(online_logfiles,all_roles) db_unique_name=rhel'  --logical standby db本地日誌的歸檔所有
*.log_archive_dest_2='location=/oracle/receive_centos_arch valid_for=(standby_logfiles,standby_role) db_unique_name=rhel'  ---主庫歸檔傳送過來,接收所在地

7,開啟邏輯備庫
 ALTER DATABASE OPEN RESETLOGS;
8,開始邏輯備庫日誌應用
 ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

 
9,備庫重作日誌的(standby logfile)的相關資訊
SQL> select group#,dbid,archived,status from v$standby_log;

    GROUP# DBID                                     ARC STATUS
---------- ---------------------------------------- --- ----------
         4 UNASSIGNED                               NO  UNASSIGNED
         5 3004476886                               YES ACTIVE
         6 UNASSIGNED                               YES UNASSIGNED

SQL>

10,以上日誌新增,可採用如下操作


Example 3-2 Adding a Standby Redo Log File Group to a Specific Group Number

You can also specify a number that identifies the group using the GROUP clause:

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 10
  2> ('/oracle/dbs/log1c.rdo','/oracle/dbs/log2c.rdo') SIZE 500M;

Using group numbers can make administering standby redo log file groups easier. However, the group number must be between 1 and the value of the MAXLOGFILES clause. Do not skip log file group numbers (that is, do not number groups 10, 20, 30, and so on), or you will use additional space in the standby database control file.

Note:
Although the standby redo log is only used when the database is running in the standby role, Oracle recommends that you create a standby redo log on the primary database so that the primary database can switch over quickly to the standby role without the need for additional DBA intervention. Consider using Oracle Enterprise Manager to automatically configure standby redo log on both your primary and standby databases.

Step 5   Verify the standby redo log file groups were created.

To verify the standby redo log file groups are created and running correctly, invoke a log switch on the primary database, and then query either the V$STANDBY_LOG view or the V$LOGFILE view on the standby database once it has been created. For example:

SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;

GROUP#     THREAD#    SEQUENCE#  ARC STATUS    
---------- ---------- ---------- --- ----------
         3          1         16 NO  ACTIVE   
         4          0          0 YES UNASSIGNED
         5          0          0 YES UNASSIGNED
 

 

11,最後一點,因為我們是基於物理備庫,轉換為邏輯備庫,所以邏輯備庫採用了新的db_name,故主備庫的tnsnames.ora及listener.ora檔案要重建,及重啟

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

相關文章