您好,登錄后才能下訂單哦!
這篇文章主要介紹“Oracle中怎么配置RAC + SingleADG”,在日常操作中,相信很多人在Oracle中怎么配置RAC + SingleADG問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Oracle中怎么配置RAC + SingleADG”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
主庫 | 備庫 | |
架構 |
| 單機 |
操作系統 | RedHat Linux 7.7 x64 | RedHat Linux 7.7 x64 |
數據庫版本 | Oracle 19.3 | Oracle 19.3 |
IP地址 | 192.168.84.91 | 192.168.84.92 |
SID | woo1 | woo2 | woo |
DB_NAME | woo | woo |
DB_UNIQU_NAME | woo_pri | woosty |
RAC各個節點按如下配置:
[oracle@ora19crac1 ~]$ vi $ORACLE_HOME/network/admin/listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = scan-ora19cracdb)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = woo_DGMGRL) (ORACLE_HOME =/u01/app/oracle/product/19.3.0/dbhome_1) (SID_NAME = woo) ) ) [oracle@ora19crac2 ~]$ cat $ORACLE_HOME/network/admin/listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = scan-ora19cracdb)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = woo_DGMGRL) (ORACLE_HOME =/u01/app/oracle/product/19.3.0/dbhome_1) (SID_NAME = woo) ) )
單實例節點配置:
[oracle@ora19cadg ~]$ cat $ORACLE_HOME/network/admin/listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ora19cadg)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = woo_DGMGRL) (ORACLE_HOME =/u01/app/oracle/product/19.3.0/dbhome_1) (SID_NAME = woo) ) )
所有節點配置如下:
[oracle@ora19crac1 ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. WOO = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = scan-ora19cracdb)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = woo) ) ) WOOSTY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.84.99)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = woosty) (UR=A) ) )
[root@ora19cadg ~]# tail -2 /etc/hosts 192.168.84.95 scan-ora19cracdb 192.168.84.99 ora19cadg
需要關閉一個實例,在一個實例上做以下操作即可:
SQL> alter database force logging; Database altered. SQL> alter system set db_recovery_file_dest='+FRA_GP01' scope=spfile sid='*'; System altered. SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=2g scope=spfile sid='*'; System altered. SQL> shut immediate SQL> startup mount; ORACLE instance started. Total System Global Area 805304088 bytes Fixed Size 9139992 bytes Variable Size 394264576 bytes Database Buffers 394264576 bytes Redo Buffers 7634944 bytes Database mounted. SQL> alter database archivelog; Database altered. SQL> alter database open; Database altered. SQL> alter database flashback on; Database altered. SQL> col force_logging format a10 SQL> select name,open_mode,database_role,flashback_on,force_logging from v$database; NAME OPEN_MODE DATABASE_ROLE FLASHBACK_ON FORCE_LOGG --------- -------------------- ---------------- ------------------ ---------- WOO READ WRITE PRIMARY YES YES
SQL> show parameter db_name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_name string woo SQL> show parameter uniq NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_unique_name string woo
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(woo,woosty)' sid='*'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=woo' sid='*'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=woosty ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=woosty' sid='*'; ALTER SYSTEM SET db_file_name_convert='/DBSoft/oracle/oradata/woo/','+DATA_GP01/WOO/'scope=spfile sid='*'; ALTER SYSTEM SET log_file_name_convert='/DBSoft/oracle/oradata/woo/','+DATA_GP01/WOO/ONLINELOG/' scope=spfile sid='*'; ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO sid='*'; ALTER SYSTEM SET FAL_SERVER='woosty';
SQL> alter system set dg_broker_start=true; System altered.
SQL> alter database add standby logfile 2 group 5 ('+DATA_GP01/WOO/ONLINELOG/group_5.log') size 200m; Database altered. SQL> alter database add standby logfile 2 group 6 ('+DATA_GP01/WOO/ONLINELOG/group_6.log') size 200m; Database altered. SQL> alter database add standby logfile 2 group 7 ('+DATA_GP01/WOO/ONLINELOG/group_7.log') size 200m; Database altered. SQL> alter database add standby logfile 2 group 8 ('+DATA_GP01/WOO/ONLINELOG/group_8.log') size 200m; Database altered. SQL> alter database add standby logfile 2 group 9 ('+DATA_GP01/WOO/ONLINELOG/group_9.log') size 200m; Database altered. SQL> select group#,status,type from v$logfile; GROUP# STATUS TYPE ---------- ------- ------- 2 ONLINE 1 ONLINE 3 ONLINE 4 ONLINE 5 STANDBY 6 STANDBY 7 STANDBY 8 STANDBY 9 STANDBY 9 rows selected.
[oracle@ora19cadg ~]$ mkdir -p /DBSoft/oracle/oradata/woo/pdbseed [oracle@ora19cadg ~]$ mkdir -p /DBSoft/oracle/fast_recovery_area/woo [oracle@ora19cadg ~]$ mkdir -p /DBSoft/oracle/admin/woo/adump
[oracle@ora19cadg dbs]$ cat initwoo.ora *.audit_file_dest='/DBSoft/oracle/admin/woo/adump' *.audit_trail='db' *.cluster_database=false *.compatible='19.0.0' *.control_files='/DBSoft/oracle/oradata/woo/control01.ctl' *.db_block_size=8192 *.db_create_file_dest='/DBSoft/oracle/oradata/woo' *.db_name='woo' *.db_recovery_file_dest='/DBSoft/oracle/fast_recovery_area/woo' *.DB_RECOVERY_FILE_DEST_SIZE = 2g *.diagnostic_dest='/DBSoft/oracle' *.enable_pluggable_database=true *.DB_UNIQUE_NAME=woosty *.LOG_ARCHIVE_CONFIG='DG_CONFIG=(woo,woosty)' *.LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=woosty' *.LOG_ARCHIVE_DEST_2='SERVICE=woo ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=woo' *.db_file_name_convert='+DATA_GP01/WOO/','/DBSoft/oracle/oradata/woo/' *.log_file_name_convert='+DATA_GP01/WOO/ONLINELOG/','/DBSoft/oracle/oradata/woo/' *.STANDBY_FILE_MANAGEMENT=AUTO *.FAL_SERVER='woo' [oracle@ora19cadg dbs]$ orapwd file=orapwwoo password=oracle entries=10 OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters. [oracle@ora19cadg dbs]$ orapwd file=orapwwoo password=oracle entries=10 format=12
[oracle@ora19cadg admin]$ rman TARGET sys/oracle@woo AUXILIARY sys/oracle@woosty Recovery Manager: Release 19.0.0.0.0 - Production on Fri Mar 20 01:08:52 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: WOO (DBID=78639635) connected to auxiliary database: WOO (not mounted) RMAN> DUPLICATE TARGET DATABASE 2> FOR STANDBY 3> FROM ACTIVE DATABASE 4> DORECOVER 5> NOFILENAMECHECK; Starting Duplicate Db at 20-MAR-20 using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=434 device type=DISK current log archived contents of Memory Script: { backup as copy reuse passwordfile auxiliary format '/DBSoft/oracle/product/19.3/dbhome_1/dbs/orapwwoo' ; } executing Memory Script Starting backup at 20-MAR-20 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=407 instance=woo1 device type=DISK Finished backup at 20-MAR-20 contents of Memory Script: { restore clone from service 'woo' standby controlfile; } executing Memory Script Starting restore at 20-MAR-20 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: restoring control file channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 output file name=/DBSoft/oracle/oradata/woo/control01.ctl Finished restore at 20-MAR-20 contents of Memory Script: { sql clone 'alter database mount standby database'; } executing Memory Script sql statement: alter database mount standby database contents of Memory Script: { set newname for tempfile 1 to "/DBSoft/oracle/oradata/woo/tempfile/temp.264.1034100827"; set newname for tempfile 2 to "/DBSoft/oracle/oradata/woo/9ff1c0f54b74ff37e0535b54a8c0e689/tempfile/temp.268.1034101685"; switch clone tempfile all; set newname for datafile 1 to "/DBSoft/oracle/oradata/woo/datafile/system.257.1034100693"; set newname for datafile 3 to "/DBSoft/oracle/oradata/woo/datafile/sysaux.258.1034100727"; set newname for datafile 4 to "/DBSoft/oracle/oradata/woo/datafile/undotbs1.259.1034100753"; set newname for datafile 5 to "/DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/system.265.1034101665"; set newname for datafile 6 to "/DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/sysaux.266.1034101665"; set newname for datafile 7 to "/DBSoft/oracle/oradata/woo/datafile/users.260.1034100753"; set newname for datafile 8 to "/DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/undotbs1.267.1034101665"; set newname for datafile 9 to "/DBSoft/oracle/oradata/woo/datafile/undotbs2.269.1034101939"; restore from nonsparse from service 'woo' clone database ; sql 'alter system archive log current'; } executing Memory Script executing command: SET NEWNAME executing command: SET NEWNAME renamed tempfile 1 to /DBSoft/oracle/oradata/woo/tempfile/temp.264.1034100827 in control file renamed tempfile 2 to /DBSoft/oracle/oradata/woo/9ff1c0f54b74ff37e0535b54a8c0e689/tempfile/temp.268.1034101685 in control file executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 20-MAR-20 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00001 to /DBSoft/oracle/oradata/woo/datafile/system.257.1034100693 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00003 to /DBSoft/oracle/oradata/woo/datafile/sysaux.258.1034100727 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00004 to /DBSoft/oracle/oradata/woo/datafile/undotbs1.259.1034100753 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00005 to /DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/system.265.1034101665 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00006 to /DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/sysaux.266.1034101665 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00007 to /DBSoft/oracle/oradata/woo/datafile/users.260.1034100753 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00008 to /DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/undotbs1.267.1034101665 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00009 to /DBSoft/oracle/oradata/woo/datafile/undotbs2.269.1034101939 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 20-MAR-20 sql statement: alter system archive log current current log archived contents of Memory Script: { restore clone force from service 'woo' archivelog from scn 3205006; switch clone datafile all; } executing Memory Script Starting restore at 20-MAR-20 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=16 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: using network backup set from service woo channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=17 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 20-MAR-20 datafile 1 switched to datafile copy input datafile copy RECID=4 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/datafile/system.257.1034100693 datafile 3 switched to datafile copy input datafile copy RECID=5 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/datafile/sysaux.258.1034100727 datafile 4 switched to datafile copy input datafile copy RECID=6 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/datafile/undotbs1.259.1034100753 datafile 5 switched to datafile copy input datafile copy RECID=7 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/system.265.1034101665 datafile 6 switched to datafile copy input datafile copy RECID=8 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/sysaux.266.1034101665 datafile 7 switched to datafile copy input datafile copy RECID=9 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/datafile/users.260.1034100753 datafile 8 switched to datafile copy input datafile copy RECID=10 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/86b637b62fe07a65e053f706e80a27ca/datafile/undotbs1.267.1034101665 datafile 9 switched to datafile copy input datafile copy RECID=11 STAMP=1035508216 file name=/DBSoft/oracle/oradata/woo/datafile/undotbs2.269.1034101939 contents of Memory Script: { set until scn 3205256; recover standby clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 20-MAR-20 using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 16 is already on disk as file /DBSoft/oracle/fast_recovery_area/woo/WOOSTY/archivelog/2020_03_20/o1_mf_1_16_h779vphh_.arc archived log for thread 1 with sequence 17 is already on disk as file /DBSoft/oracle/fast_recovery_area/woo/WOOSTY/archivelog/2020_03_20/o1_mf_1_17_h779vqp4_.arc archived log file name=/DBSoft/oracle/fast_recovery_area/woo/WOOSTY/archivelog/2020_03_20/o1_mf_1_16_h779vphh_.arc thread=1 sequence=16 archived log file name=/DBSoft/oracle/fast_recovery_area/woo/WOOSTY/archivelog/2020_03_20/o1_mf_1_17_h779vqp4_.arc thread=1 sequence=17 media recovery complete, elapsed time: 00:00:00 Finished recover at 20-MAR-20 contents of Memory Script: { delete clone force archivelog all; } executing Memory Script released channel: ORA_DISK_1 released channel: ORA_AUX_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=407 instance=woo1 device type=DISK deleted archived log archived log file name=/DBSoft/oracle/fast_recovery_area/woo/WOOSTY/archivelog/2020_03_20/o1_mf_1_16_h779vphh_.arc RECID=1 STAMP=1035508214 deleted archived log archived log file name=/DBSoft/oracle/fast_recovery_area/woo/WOOSTY/archivelog/2020_03_20/o1_mf_1_17_h779vqp4_.arc RECID=2 STAMP=1035508215 Deleted 2 objects Finished Duplicate Db at 20-MAR-20 RMAN>
SQL> create spfile from pfile; File created. SQL> startup mount force; ORACLE instance started. Total System Global Area 306183456 bytes Fixed Size 8895776 bytes Variable Size 239075328 bytes Database Buffers 50331648 bytes Redo Buffers 7880704 bytes Database mounted.
SQL> recover managed standby database using current logfile disconnect; Media recovery complete.
三、 檢查
3.1 查看角色
RAC主庫端:
SQL> select name,protection_mode,database_role role, switchover_status from v$database; NAME PROTECTION_MODE ROLE SWITCHOVER_STATUS --------- -------------------- ---------------- -------------------- WOO MAXIMUM PERFORMANCE PRIMARY TO STANDBY
單機備庫端:
SQL> select name,protection_mode,database_role role,switchover_status from v$database; NAME PROTECTION_MODE ROLE SWITCHOVER_STATUS --------- -------------------- ---------------- -------------------- WOO MAXIMUM PERFORMANCE PHYSICAL STANDBY NOT ALLOWED SQL> select THREAD#,SEQUENCE#,ARCHIVED,APPLIED,DELETED,STATUS from v$archived_log; THREAD# SEQUENCE# ARC APPLIED DEL S ---------- ---------- --- --------- --- - 1 16 YES YES YES D 1 17 YES YES YES D 2 7 YES NO NO A 1 20 YES NO NO A 1 19 YES NO NO A 1 21 YES NO NO A 1 22 YES NO NO A 1 23 YES NO NO A 1 24 YES NO NO A 1 25 YES NO NO A 1 26 YES NO NO A THREAD# SEQUENCE# ARC APPLIED DEL S ---------- ---------- --- --------- --- - 1 18 YES NO NO A 1 27 YES NO NO A 1 28 YES NO NO A 14 rows selected. SQL> SELECT ROLE, THREAD#, SEQUENCE#, ACTION FROM V$DATAGUARD_PROCESS; ROLE THREAD# SEQUENCE# ACTION ------------------------ ---------- ---------- ------------ log writer 0 0 IDLE redo transport monitor 0 0 IDLE gap manager 0 0 IDLE redo transport timer 0 0 IDLE archive local 0 0 IDLE archive redo 0 0 IDLE archive redo 0 0 IDLE archive redo 0 0 IDLE RFS async 2 8 IDLE RFS async 1 29 IDLE RFS ping 1 29 IDLE ROLE THREAD# SEQUENCE# ACTION ------------------------ ---------- ---------- ------------ RFS ping 2 8 IDLE RFS archive 0 0 IDLE RFS archive 0 0 IDLE RFS archive 0 0 IDLE RFS archive 0 0 IDLE 16 rows selected.
到此,關于“Oracle中怎么配置RAC + SingleADG”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。