Một Active data guard là CSDL có thể thực hiện các thao tác select dữ liệu (dạng READ-ONLY), và nó là bản nâng cấp của Physical Standby database (mount).
THÔNG TIN CHI TIẾT 2 NODE:
Items | Primary – SRV1 | Standby – SRV2 |
hostname | srv1 | srv2 |
ip | 192.168.1.11 | 192.168.1.12 |
db name | duodb | duodb |
instance_name | duodb | stand |
db_unique_name | duodb | stand |
version DB | 19.3 | 19.3 |
DB_HOME | /u01/app/oracle/ product/19.3.0/dbhome_1 | /u01/app/oracle/ product/19.3.0/dbhome_1 |
DB_BASE | /u01/app/oracle | /u01/app/oracle |
global database name | srv1.localdomain | srv2.localdomain |
SRV1 – server tôi đặt là Primary
SRV2 – server tôi đặt là Standby
Kiểm tra thông tin database:
Check thông tin 2 DB:
select open_mode, status,instance_name,database_role from v$instance,v$database; select max(sequence#) from v$archived_log;
DB prim:
SQL> select open_mode, status,instance_name,database_role from v$instance,v$database;
OPEN_MODE STATUS INSTANCE_NAME DATABASE_ROLE
——————– ———— —————- —————-
READ WRITE OPEN duodb PRIMARY
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
————–
17
DB standby:
SQL> select open_mode, status,instance_name,database_role from v$instance,v$database;
OPEN_MODE STATUS INSTANCE_NAME DATABASE_ROLE
——————– ———— —————- —————-
MOUNTED MOUNTED stand PHYSICAL STANDBY
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
————–
17
Standby: check status, sau đó huỷ tiến trình đồng bộ redo log MRP, Open database:
select process,status,sequence# from v$managed_standby; alter database recover managed standby database cancel; alter database open; select status,instance_name,database_role,open_mode from v$database,v$instance;
SQL> select process,status,sequence# from v$managed_standby;
PROCESS STATUS SEQUENCE#
——— ———— ———-
DGRD ALLOCATED 0
ARCH CONNECTED 0
DGRD ALLOCATED 0
ARCH CONNECTED 0
ARCH CLOSING 17
ARCH CONNECTED 0
RFS IDLE 18
RFS IDLE 0
MRP0 APPLYING_LOG 18
9 rows selected.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
SQL> select status,instance_name,database_role,open_mode from v$database,v$instance;
STATUS INSTANCE_NAME DATABASE_ROLE OPEN_MODE
———— —————- —————- ——————–
OPEN stand PHYSICAL STANDBY READ ONLY
Standby: thực hiện ACTIVE tiến trình MRP để hệ thống đồng bộ redo log từ Primary:
alter database recover managed standby database disconnect from session; select process,status,sequence# from v$managed_standby; select open_mode, status,instance_name,database_role from v$instance,v$database;
SQL> select process,status,sequence# from v$managed_standby;
PROCESS STATUS SEQUENCE#
——— ———— ———-
ARCH CONNECTED 0
DGRD ALLOCATED 0
DGRD ALLOCATED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
RFS IDLE 0
RFS IDLE 18
MRP0 APPLYING_LOG 18
9 rows selected.
SQL> select open_mode, status,instance_name,database_role from v$instance,v$database;
OPEN_MODE STATUS INSTANCE_NAME DATABASE_ROLE
——————– ———— —————- —————-
READ ONLY WITH APPLY OPEN stand PHYSICAL STANDBY
Standby hiện tại đã ở chế độ READ-ONLY => Active data guard.
Chúc các bạn thành công.