91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

一步一步搭建11gR2 rac+dg之配置單實例的DG(八)

發布時間:2020-08-10 18:19:48 來源:ITPUB博客 閱讀:250 作者:達芬奇的夢 欄目:關系型數據庫




  1. RAC主庫配置單實例ActiveDataguard

本文文檔結構:


一步一步搭建11gR2 rac+dg之配置單實例的DG(八)

這里配置的過程中需要注意的一項是多看看rac1和rac2以及dg的告警日志會對配置過程有更深刻的理解。。。配置oracle rac的dg環境說白了首先將主庫的數據恢復到從庫上,然后在主從庫上配置一些DG需要用到的參數


注意:

  1. 由于DG是以DB_UNIQUE_NAME作為區分數據庫標識的,因此主從庫的該參數一定要不同以做區分。但是數據庫名db_name必須一致以便主從切換時方便
  2. Standby庫只需要安裝數據庫軟件,不必創建數據庫
  3. 主從庫的數據庫軟件大版本必須一致,且必須是企業版數據庫EE


  1. RAC主庫準備工作

該步驟主要是① 將rac主庫修改為歸檔+forcelogging模式 ② 利用rman備份db、archivelog、control file 、pfile 和口令文件

  1. ①RAC主庫必須置為歸檔模式:

和下一步一起做

  1. ②RAC主庫必須置為ForceLogging模式:

alter database force logging;

alter database archivelog; ---歸檔模式下修改




SQL> alter database force logging;


Database altered.



SQL> select name , open_mode, log_mode,force_logging from gv$database;


NAME     OPEN_MODE     LOG_MODE FOR

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

RACDB     READ WRITE     NOARCHIVELOG YES

RACDB     READ WRITE     NOARCHIVELOG YES


SQL> exit





[oracle@rac1 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 3 15:30:17 2014


Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to an idle instance.


SQL> startup mount

ORACLE instance started.


Total System Global Area 784998400 bytes

Fixed Size         2232472 bytes

Variable Size         532680552 bytes

Database Buffers     247463936 bytes

Redo Buffers         2621440 bytes

Database mounted.

SQL> select name , open_mode, log_mode,force_logging from gv$database;


NAME     OPEN_MODE     LOG_MODE FOR

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

RACDB     MOUNTED     NOARCHIVELOG YES


SQL> alter database archivelog;


Database altered.


SQL> shutdown immediate;

ORA-01109: database not open



Database dismounted.

ORACLE instance shut down.

SQL>




SQL> select name , open_mode, log_mode,force_logging from gv$database;


NAME     OPEN_MODE     LOG_MODE FOR

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

RACDB     READ WRITE     ARCHIVELOG YES

RACDB     READ WRITE     ARCHIVELOG YES


SQL>


  1. ③RAC主庫執行RMAN全備:

run {

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

allocate channel c4 type disk;

backup database format '/rman_backup/FULL_%U.bak';

backup archivelog all format '/rman_backup/ARC_%U.bak';

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}





  1. ④RAC主庫執行創建物理備庫控制文件:

Rman下:backup device type disk format '/rman_backup/standby_%U.ctl' current controlfile for standby;


或:SQL>alter database create standby controlfile as '/dats/backup/standby.ctl'



  1. ⑤RAC主庫創建物理備庫初始化參數文件:


create pfile ='/rman_backup/initphydb.ora' from spfile;



SQL> show parameter spfile


NAME                 TYPE     VALUE

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

spfile                 string     +DATA/racdb/spfileracdb.ora

SQL>


SQL> show parameter cluster_database


NAME                 TYPE     VALUE

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

cluster_database         boolean     TRUE

cluster_database_instances     integer     2

SQL>




  1. ⑥RAC主庫修改口令文件,使雙節點SYS用戶口令一致:


最好是將其中一個口令文件復制到另外一個節點上,最后復制到dg下,確保口令文件是一樣的



  1. 物理備庫準備工作

    1. ①FTP主庫備份文件+備庫控制文件+備庫參數文件至物理備庫服務器


將備份文件全部傳遞到dg庫:


----rac1

scp /rman_backup/*.bak oracle@192.168.59.140:/rman_backup/

scp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwracdb1 oracle@192.168.59.140:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwphydb




  1. ②物理備庫創建口令文件:

上一步已做,不需要創建了

  1. ③物理備庫初始化參數文件修改:



----------dg

[oracle@dg rman_backup]$ cp initphydb.ora $ORACLE_HOME/dbs/

[oracle@dg rman_backup]$ cd $ORACLE_HOME/dbs


這個是比較重要的步驟,我把行號弄出來了,當然寫的時候是沒有前邊的行號的


物理備庫初始化參數文件修改:


  1. phydb.__db_cache_size=255852544
  2. phydb.__java_pool_size=4194304
  3. phydb.__large_pool_size=4194304
  4. phydb.__oracle_base='/u01/app/oracle'#ORACLE_BASE environment from set
  5. phydb.__pga_aggregate_target=419430400
  6. phydb.__sga_target=423624704
  7. phydb.__shared_io_pool_size=0
  8. phydb.__shared_pool_size=146800640
  9. phydb.__streams_pool_size=0
  10. *.audit_file_dest='/u01/app/oracle/admin/phydb/adump'
  11. *.audit_trail='db'
  12. *.cluster_database=false
  13. *.compatible='11.2.0.0.0'
  14. *.control_files='+DATA/phydb/controlfile/cont.ctl'
  15. *.core_dump_dest='/u01/app/oracle/diag/rdbms/phydb/cdump'
  16. *.db_block_size=8192
  17. *.db_create_file_dest='+DATA'
  18. *.db_domain=''
  19. *.db_file_name_convert='+DATA/racdb/','+DATA/phydb/'
  20. *.db_name='racdb'
  21. *.db_recovery_file_dest='+FRA'
  22. *.db_recovery_file_dest_size=4070572032
  23. *.db_unique_name='phydb'
  24. *.diagnostic_dest='/u01/app/oracle'
  25. *.dispatchers='(PROTOCOL=TCP)(SERVICE=phydbXDB)'
  26. *.fal_client='phydb'
  27. *.fal_server='racdb1','racdb2'
  28. *.log_archive_config='dg_config=(racdb,phydb)'
  29. *.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=phydb'
  30. *.log_archive_dest_2='service=racdb1 valid_for=(online_logfiles,primary_role) db_unique_name=racdb'
  31. *.log_archive_format='ARC_%t_%S_%r.arc'
  32. *.log_file_name_convert='+DATA/racdb/','+DATA/phydb/'
  33. *.memory_target=842006528
  34. *.open_cursors=300
  35. *.processes=150
  36. *.remote_login_passwordfile='exclusive'
  37. *.service_names='phydb'
  38. *.standby_file_management='auto'
  39. *.thread=1
  40. *.undo_management='auto'
  41. *.undo_tablespace='UNDOTBS1'





[oracle@dg dbs]$ mkdir -p /u01/app/oracle/admin/phydb/adump

[oracle@dg dbs]$ mkdir -p /u01/app/oracle/diag/rdbms/phydb/cdump

[oracle@dg dbs]$


[grid@dg ~]$ asmcmd

ASMCMD> ls

DATA/

FRA/

GRIDDG/

ASMCMD> cd DATA

ASMCMD> ls

ASMCMD> mkdir phydb

ASMCMD> ls

phydb/

ASMCMD>



  1. ④配置RAC主庫,物理備庫的tnsnames.ora文件:

將以下內容復制到rac1,rac2和dg庫:

racdb =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.139)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = racdb.lhr.com)

)

)


racdb1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.135)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = racdb.lhr.com)

(INSTANCE_NAME = racdb1)

)

)


racdb2 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.136)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = racdb.lhr.com)

(INSTANCE_NAME = racdb2)

)

)


phydb =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.140)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = phydb)

)

)


驗證一下:

分別在3個庫上執行:

sqlplus sys/lhr@racdb as sysdba

sqlplus sys/lhr@racdb1 as sysdba

sqlplus sys/lhr@racdb2 as sysdba


確保3個庫可以連接

  1. 創建物理備庫

    1. ①物理備庫啟動NOMOUNT狀態:

startup nomount

  1. ②RMAN恢復備庫控制文件:

[oracle@dg dbs]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Fri Oct 3 19:06:52 2014


Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.


connected to target database: RACDB (not mounted)


RMAN> restore standby controlfile from '/rman_backup/standby_0tpk53jq_1_1.ctl';


Starting restore at 2014-10-03 19:06:55

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=16 device type=DISK


channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

output file name=+DATA/phydb/controlfile/cont.ctl

Finished restore at 2014-10-03 19:07:22


RMAN>



  1. ③MOUNT物理備庫:

SQL> alter database mount;

  1. ④RMAN restore物理備庫:

run {

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

allocate channel c4 type disk;

restore database ;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}



RMAN> restore database ;


Starting restore at 2014-10-03 19:13:48

Starting implicit crosscheck backup at 2014-10-03 19:13:48

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=32 device type=DISK

Crosschecked 6 objects

Finished implicit crosscheck backup at 2014-10-03 19:13:49


Starting implicit crosscheck copy at 2014-10-03 19:13:49

using channel ORA_DISK_1

Finished implicit crosscheck copy at 2014-10-03 19:13:49


searching for all files in the recovery area

cataloging files...

no files cataloged


using channel ORA_DISK_1


channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to +DATA/phydb/datafile/system.256.859849357

channel ORA_DISK_1: restoring datafile 00004 to +DATA/phydb/datafile/users.259.859849357

channel ORA_DISK_1: restoring datafile 00005 to +DATA/phydb/datafile/example.264.859849549

channel ORA_DISK_1: reading from backup piece /rman_backup/FULL_0npk5395_1_1.bak

channel ORA_DISK_1: piece handle=/rman_backup/FULL_0npk5395_1_1.bak tag=TAG20141003T164524

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:04:23

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00002 to +DATA/phydb/datafile/sysaux.257.859849357

channel ORA_DISK_1: restoring datafile 00003 to +DATA/phydb/datafile/undotbs1.258.859849357

channel ORA_DISK_1: restoring datafile 00006 to +DATA/phydb/datafile/undotbs2.265.859849971

channel ORA_DISK_1: reading from backup piece /rman_backup/FULL_0opk53c4_1_1.bak

channel ORA_DISK_1: piece handle=/rman_backup/FULL_0opk53c4_1_1.bak tag=TAG20141003T164524

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:01:45

Finished restore at 2014-10-03 19:20:01


RMAN>



  1. ⑤備庫上創建standbylogfile:

SQL> select name from v$datafile

2 union

3 select name from v$controlfile

4 union

5 select member from v$logfile;


NAME

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

+DATA/phydb/controlfile/cont.ctl

+DATA/phydb/datafile/example.258.860008433

+DATA/phydb/datafile/sysaux.260.860008695

+DATA/phydb/datafile/system.257.860008433

+DATA/phydb/datafile/undotbs1.261.860008697

+DATA/phydb/datafile/undotbs2.262.860008697

+DATA/phydb/datafile/users.259.860008435

+DATA/phydb/onlinelog/group_1.261.859849493

+DATA/phydb/onlinelog/group_2.262.859849495

+DATA/phydb/onlinelog/group_3.266.859850179

+DATA/phydb/onlinelog/group_4.267.859850183

+FRA/racdb/onlinelog/group_1.257.859849493

+FRA/racdb/onlinelog/group_2.258.859849495

+FRA/racdb/onlinelog/group_3.259.859850181

+FRA/racdb/onlinelog/group_4.260.859850187


15 rows selected.


SQL>


創建standbylogfile,這里的大小應根據主庫的v$log中的bytes列來計算:

一步一步搭建11gR2 rac+dg之配置單實例的DG(八)



alter database add standby logfile thread 1 group 5 size 50M ,group 6 size 50M ,group 7 size 50M ;

alter database add standby logfile thread 2 group 8 size 50M ,group 9 size 50M ,group 10 size 50M ;


創建完成后查詢:

select * from v$standby_log;


SQL> set linesize 1200

SQL> select * from v$standby_log;


GROUP# DBID                  THREAD#    SEQUENCE# BYTES BLOCKSIZE USED ARC STATUS     FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME LAST_CHANGE# LAST_TIME

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

     5 UNASSIGNED                     1        0 52428800     512      0 NO UNASSIGNED

     6 UNASSIGNED                     1        0 52428800     512      0 NO UNASSIGNED

     7 UNASSIGNED                     1        0 52428800     512      0 YES UNASSIGNED

     8 UNASSIGNED                     2        0 52428800     512      0 NO UNASSIGNED

     9 UNASSIGNED                     2        0 52428800     512      0 NO UNASSIGNED

    10 UNASSIGNED                     2        0 52428800     512      0 YES UNASSIGNED


6 rows selected.


SQL>

SQL> col member for a50

SQL> select * from v$logfile;


GROUP# STATUS TYPE MEMBER                     IS_

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

     2     ONLINE +DATA/phydb/onlinelog/group_2.270.860171617     NO

     2     ONLINE +FRA/phydb/onlinelog/group_2.294.860171767     YES

     1     ONLINE +DATA/phydb/onlinelog/group_1.269.860171391     NO

     1     ONLINE +FRA/phydb/onlinelog/group_1.293.860171601     YES

     3     ONLINE +DATA/phydb/onlinelog/group_3.271.860171811     NO

     3     ONLINE +FRA/phydb/onlinelog/group_3.295.860171893     YES

     4     ONLINE +DATA/phydb/onlinelog/group_4.272.860171905     NO

     4     ONLINE +FRA/phydb/onlinelog/group_4.296.860172007     YES

     5     STANDBY +DATA/phydb/onlinelog/group_5.263.860014755     NO

     5     STANDBY +FRA/phydb/onlinelog/group_5.256.860014769     YES

     6     STANDBY +DATA/phydb/onlinelog/group_6.264.860014775     NO

     6     STANDBY +FRA/phydb/onlinelog/group_6.257.860014789     YES

     7     STANDBY +DATA/phydb/onlinelog/group_7.265.860014795     NO

     7     STANDBY +FRA/phydb/onlinelog/group_7.258.860014811     YES

     8     STANDBY +DATA/phydb/onlinelog/group_8.266.860090543     NO

     8     STANDBY +FRA/phydb/onlinelog/group_8.259.860090581     YES

     9     STANDBY +DATA/phydb/onlinelog/group_9.267.860090607     NO

     9     STANDBY +FRA/phydb/onlinelog/group_9.260.860090659     YES

    10     STANDBY +DATA/phydb/onlinelog/group_10.268.860090669 NO

    10     STANDBY +FRA/phydb/onlinelog/group_10.261.860090715     YES


20 rows selected.


SQL>


這里可能會報一個錯誤:

ORA-15041: diskgroup "DATA" space exhausted

就是磁盤不足,具體大家上網搜吧,解決辦法就是添加磁盤,不詳解了:



alter diskgroup DATA add disk '/dev/raw/raw5';




  1. ⑥主庫參數調整:

[oracle@rac2 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 10 15:59:46 2014


Copyright (c) 1982, 2011, Oracle. All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options


SQL> show parameter spfile


NAME                 TYPE     VALUE

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

spfile                 string     +DATA/racdb/spfileracdb.ora

SQL>


--rac1

alter system set log_archive_dest_2='service=phydb lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=phydb' sid='*';

alter system set log_archive_config='dg_config=(racdb,phydb)' sid='*';


配置后的結果:

SQL> show parameter log_archive_dest_2


NAME                 TYPE     VALUE

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

log_archive_dest_2         string     service=phydb lgwr sync valid_

                         for=(online_logfiles,primary_r

                         ole) db_unique_name=phydb


SQL> show parameter log_archive_config


NAME                 TYPE     VALUE

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

log_archive_config         string     dg_config=(racdb,phydb)

SQL>



  1. ⑦備庫接收主庫日志:

SQL> select sequence#,name,applied from v$archived_log;


SEQUENCE# NAME                                                 APPLIED

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

    39 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_39.327.860599799                    NO

    40 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_40.328.860599799                    NO

    41 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_41.329.860599953                    NO

    49 +FRA/phydb/archivelog/2014_10_10/thread_1_seq_49.330.860600751                    NO

    50 +FRA/phydb/archivelog/2014_10_10/thread_1_seq_50.331.860600755                    NO

    51 +FRA/phydb/archivelog/2014_10_10/thread_1_seq_51.332.860600869                    NO

    42 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_42.333.860601127                    NO

    43 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_43.334.860601131                    NO

    44 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_44.335.860601415                    NO


9 rows selected.


SQL>


這里如果備庫無法順利接收主庫日志,則主庫的alert日志中有如下提示:

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

Check that the primary and standby are using a password file

and remote_login_passwordfile is set to SHARED or EXCLUSIVE,

and that the SYS password is same in the password files.

returning error ORA-16191

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

PING[ARC2]: Heartbeat failed to connect to standby 'phydb'. Error is 16191.

Process J000 died, see its trace file

kkjcre1p: unable to spawn jobq slave process

Errors in file /u01/app/oracle/diag/rdbms/racdb/racdb2/trace/racdb2_cjq0_14236.trc:

Process NSS2 died, see its trace file

Process J000 died, see its trace file

kkjcre1p: unable to spawn jobq slave process

Errors in file /u01/app/oracle/diag/rdbms/racdb/racdb2/trace/racdb2_cjq0_14236.trc:

Error 443 for archive log file 3 to 'phydb'

LGWR: Failed to archive log 3 thread 2 sequence 25 (443)

Process O000 died, see its trace file


該節點的用戶口令和備庫的口令不一致,最好的辦法是生成一份口令文件之后,然后將該口令文件拷貝到其它節點,重新生成口令有的時候也報錯的


---- 3 個節點

orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwracdb2 password=lhr force=y



  1. ⑧備庫開始應用日志:


SQL> alter database recover managed standby database using current logfile disconnect from session;


Database altered.


過幾分鐘后:



SQL> select sequence#,name,applied from v$archived_log;


SEQUENCE# NAME                                                                     APPLIED

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

39 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_39.327.860599799                    YES

    40 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_40.328.860599799                    YES

    41 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_41.329.860599953                    YES

    49 +FRA/phydb/archivelog/2014_10_10/thread_1_seq_49.330.860600751                    YES

    50 +FRA/phydb/archivelog/2014_10_10/thread_1_seq_50.331.860600755                    YES

    51 +FRA/phydb/archivelog/2014_10_10/thread_1_seq_51.332.860600869                    YES

    42 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_42.333.860601127                    NO

    43 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_43.334.860601131                    NO

    44 +FRA/phydb/archivelog/2014_10_10/thread_2_seq_44.335.860601415                    NO


  1. ⑨備庫以READONLY方式打開:


alter database recover managed standby database cancel;

alter database open;

alter database recover managed standby database using current logfile disconnect from session;


SQL> col name for a30

SQL> select dbid,name,current_scn,protection_mode,database_role,force_logging,open_mode,switchover_status from v$database;


DBID NAME              CURRENT_SCN PROTECTION_MODE     DATABASE_ROLE FOR OPEN_MODE     SWITCHOVER_STATUS

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

857466254 RACDB             1871595 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES READ ONLY WITH APPLY NOT ALLOWED


SQL>


至此,我們已經順利的給RAC主庫配置ActivePhysicalDataguard成功!

  1. 其它附加內容

    1. 11g rman duplicate命令

注意:11g以前的版本在執行復制命令dupilicate時,必須在備庫上存在有備份文件,即在主庫上備份完成后將文件拷到備庫相同目錄下

但是在11g一切都變的簡單,只需要在復制命令后加上FROM ACTIVE DATABASE參數即可。

例如為實現數據庫的文件回復,可以執行命令:

$ rman target / auxiliary sys/herenit@racheren_standby

RMAN>duplicate target database for standby from active database;

如果原目錄下有對應文件已經刪除,但是數據字典中存在,可以使用nofilenamecheck參數取消對文件名的檢查

RMAN>duplicate target database for standby from active database nofilenamecheck;

恢復完成以后,檢查備庫狀態

SQL> select status from v$instance;

STATUS$dEQ5b/C#x22494861------------ITPUB個人空間 T c:v_y!RMOUNTED

SQL> select open_mode from v$database;

OPEN_MODEITPUB個人空間FU?tN2FE5v:_wU}----------ITPUB個人空間1R_G@5k/kMOUNTED

SQL> select member from v$logfile;

SQL> select name from v$datafile;

SQL> select name from v$tempfile;

  1. 創建standby redo log 日志

DATA Guard在最大保護和最高可用性模式下,Standby數據庫必須配置 Standby Redo Log

備庫創建并配置 Standby Redo Log 是為了能夠接收到主庫傳過來的日志,用作恢復.

主庫創建并配置 Standby Redo Log 是為了在主備切換之后,能夠接收到原備庫(切換之后的主庫)傳過來的日志

注意:為了主備切換后能正常,主備庫都必須創建standby redo log


創建原則:建議Standby Redologs日志組數量基于Primary數據庫的線程數來確定(這里的線程數可以理解為RAC環境中的節點數)。

有一個推薦的公式可供參考:(每線程的日志組數+1)×最大線程數。

使用這個公式可以降低Primary數據庫實例LGWR進程鎖住的可能性。

創建原則和單實例一樣,大小相等,但是日志組數量要比primary數據庫多一組,比如在我的環境中,有2個節點,每個節點有4組redo,那么現在要創建的standby redo log組數為:(4+1)*2=10個

Standby Redologs的操作方式與Online Redologs幾乎一模一樣,只不過在創建或刪除時需要多指定一個Standby關鍵字

SQL>alter database add standby logfile thread 1 group 5 '+ORAFLASH/racheren/onlinelog/group_5.log' size 50M;

SQL>alter database add standby logfile thread 2 group 6 '+ORAFLASH/racheren/onlinelog/group_6.log' size 50M;

單實例上不需要thread標識

SQL>alter database add standby logfile group 6 '/oradata/racheren/onlinelog/group_6.log' size 50M;

刪除方式:

SQL>alter database drop standby logfile grop 6

查詢方式:

SQL>select group#,thread#,sequence#,archived,status from v$standby_log;


ERROR at line 1:

ORA-01156: recovery or flashback in progress may need access to files

--在備庫添加standby redo log需要先停MRP

SQL> alter database recover managed standby database cancel;



  1. 測試物理備庫功能

    1. 測試文件同步

      1. 查看主備庫的表空間信息

select tablespace_name, file_name from dba_data_files;


  1. 主庫創建表空間查看備庫是否同步

create tablespace dg_tbs datafile size 5m;



  1. 主庫刪除表空間查看備庫是否同步


drop tablespace dg_tbs including contents and datafiles;


  1. 測試數據同步

①主庫創建測試表:

② 備庫查看測試表同步:

Create table tmp_test(id number);

Insert into tmp_test values(1);

Commit;


Select * from tmp_test;


  1. 測試DATAGUARDSWITCHOVER功能

    1. RAC主庫、ActiveDataguard角色切換

即rac主庫切換為物理備庫,物理備庫切換為rac主庫。

  1. ①主庫修改相關參數fal_client、fal_server:

首先需要確保主庫采用spfile啟動,然后

Rac1上:

alter system set fal_client='rac1' sid='rac1';

Rac2上:

alter system set fal_client='rac2' sid='rac2';



alter system set fal_server='phydb' sid='*';






  1. ②主庫創建standbylogfile:


  1. ③主庫修改相關參數standby_file_management、db_file_name_convert 、log_filename_convert


  1. ④停止RAC節點2:





  1. 單實例主庫,RAC備庫角色切換

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

大连市| 诸暨市| 崇左市| 威远县| 荔浦县| 上蔡县| 霍山县| 贡山| 县级市| 思茅市| 贵溪市| 哈巴河县| 明光市| 平远县| 楚雄市| 洛浦县| 濮阳县| 通城县| 洪雅县| 渝北区| 天等县| 湘乡市| 平邑县| 广水市| 安义县| 浦东新区| 安丘市| 清流县| 茶陵县| 根河市| 同德县| 青铜峡市| 都江堰市| 汕尾市| 巴马| 灵台县| 鱼台县| 松阳县| 个旧市| 赞皇县| 青州市|