239 lines
8.2 KiB
Markdown
239 lines
8.2 KiB
Markdown
|
|
Network configuration
|
||
|
|
---------------------
|
||
|
|
|
||
|
|
`/etc/listener.ora` on primary server:
|
||
|
|
|
||
|
|
|
||
|
|
LISTENER_DG =
|
||
|
|
(ADDRESS_LIST=
|
||
|
|
(ADDRESS=(PROTOCOL=tcp)(HOST=taris.swgalaxy)(PORT=1523))
|
||
|
|
)
|
||
|
|
|
||
|
|
SID_LIST_LISTENER_DG =
|
||
|
|
(SID_LIST =
|
||
|
|
(SID_DESC =
|
||
|
|
(GLOBAL_DBNAME = ASTYPRD_DGMGRL)
|
||
|
|
(SID_NAME = ASTYPRD)
|
||
|
|
(ORACLE_HOME = /app/oracle/product/21)
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
`/etc/listener.ora` on secondary server:
|
||
|
|
|
||
|
|
LISTENER_DG =
|
||
|
|
(ADDRESS_LIST=
|
||
|
|
(ADDRESS=(PROTOCOL=tcp)(HOST=mandalore.swgalaxy)(PORT=1523))
|
||
|
|
)
|
||
|
|
|
||
|
|
SID_LIST_LISTENER_DG =
|
||
|
|
(SID_LIST =
|
||
|
|
(SID_DESC =
|
||
|
|
(GLOBAL_DBNAME = ASTYDRP_DGMGRL)
|
||
|
|
(SID_NAME = ASTYDRP)
|
||
|
|
(ORACLE_HOME = /app/oracle/product/21)
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
Start `LISTENER_DG` on both servers:
|
||
|
|
|
||
|
|
lsnrctl start LISTENER_DG
|
||
|
|
|
||
|
|
|
||
|
|
`/etc/tnsnames.ora` on both servers:
|
||
|
|
|
||
|
|
ASTYPRD_DGMGRL =
|
||
|
|
(DESCRIPTION =
|
||
|
|
(ADDRESS_LIST =
|
||
|
|
(ADDRESS = (PROTOCOL = TCP)(HOST = taris.swgalaxy)(PORT = 1523))
|
||
|
|
)
|
||
|
|
(CONNECT_DATA =
|
||
|
|
(SERVER = DEDICATED)
|
||
|
|
(SERVICE_NAME = ASTYPRD_DGMGRL)
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
ASTYDRP_DGMGRL =
|
||
|
|
(DESCRIPTION =
|
||
|
|
(ADDRESS_LIST =
|
||
|
|
(ADDRESS = (PROTOCOL = TCP)(HOST = mandalore.swgalaxy)(PORT = 1523))
|
||
|
|
)
|
||
|
|
(CONNECT_DATA =
|
||
|
|
(SERVER = DEDICATED)
|
||
|
|
(SERVICE_NAME = ASTYDRP_DGMGRL)
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
Dataguard initial duplication
|
||
|
|
-----------------------------
|
||
|
|
|
||
|
|
From primary init.ora, create an init.ora from secondary database, test-it starting the secondary database in nomount and create a spfile from this init.ora. Startup secondary database in nomount mode. Copy also the passwordfile from primry to secondary server.
|
||
|
|
|
||
|
|
Try cross connections from both primary and secondary servers:
|
||
|
|
|
||
|
|
sqlplus 'sys/"*****"'@ASTYPRD_DGMGRL as sysdba
|
||
|
|
sqlplus 'sys/"*****"'@ASTYDRP_DGMGRL as sysdba
|
||
|
|
|
||
|
|
|
||
|
|
Create standby redolog on primary database using the result of following queries:
|
||
|
|
|
||
|
|
select 'ALTER DATABASE ADD STANDBY LOGFILE THREAD '||thread#||' size '||bytes||';' from v$log;
|
||
|
|
select distinct 'ALTER DATABASE ADD STANDBY LOGFILE THREAD '||thread#||' size '||bytes||';' from v$log;
|
||
|
|
|
||
|
|
If you plan to use backups on standby database, set required RMAN parameters **prior** to duplicate step:
|
||
|
|
|
||
|
|
configure archivelog deletion policy to applied on all standby;
|
||
|
|
configure db_unique_name 'ASTYDRP' connect identifier 'ASTYDRP_DGMGRL';
|
||
|
|
configure db_unique_name 'ASTYPRD' connect identifier 'ASTYPRD_DGMGRL';
|
||
|
|
|
||
|
|
|
||
|
|
Duplicate primary database *for standby*:
|
||
|
|
|
||
|
|
rman target='sys/"*****"'@ASTYPRD_DGMGRL auxiliary='sys/"*****"'@ASTYDRP_DGMGRL
|
||
|
|
|
||
|
|
run
|
||
|
|
{
|
||
|
|
allocate channel pri01 device type disk;
|
||
|
|
allocate channel pri02 device type disk;
|
||
|
|
allocate channel pri03 device type disk;
|
||
|
|
allocate channel pri04 device type disk;
|
||
|
|
allocate channel pri05 device type disk;
|
||
|
|
allocate channel pri06 device type disk;
|
||
|
|
allocate channel pri07 device type disk;
|
||
|
|
allocate channel pri08 device type disk;
|
||
|
|
allocate channel pri09 device type disk;
|
||
|
|
allocate channel pri10 device type disk;
|
||
|
|
|
||
|
|
allocate auxiliary channel aux01 device type disk;
|
||
|
|
allocate auxiliary channel aux02 device type disk;
|
||
|
|
allocate auxiliary channel aux03 device type disk;
|
||
|
|
allocate auxiliary channel aux04 device type disk;
|
||
|
|
allocate auxiliary channel aux05 device type disk;
|
||
|
|
allocate auxiliary channel aux06 device type disk;
|
||
|
|
allocate auxiliary channel aux07 device type disk;
|
||
|
|
allocate auxiliary channel aux08 device type disk;
|
||
|
|
allocate auxiliary channel aux09 device type disk;
|
||
|
|
allocate auxiliary channel aux10 device type disk;
|
||
|
|
|
||
|
|
duplicate database 'ASTY' for standby
|
||
|
|
from active database using compressed backupset section size 512M;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
It is nor mandatory but recommanded to activate flashback on both databases (leaving for exmple then default retention target of 1 day):
|
||
|
|
|
||
|
|
alter database flashback ON;
|
||
|
|
|
||
|
|
|
||
|
|
Dataguard broker configuration
|
||
|
|
------------------------------
|
||
|
|
|
||
|
|
On primary database:
|
||
|
|
|
||
|
|
alter system set dg_broker_config_file1='/app/oracle/base/admin/ASTYPRD/dgmgrl/dr1ASTYPRD.dat' scope=both sid='*';
|
||
|
|
alter system set dg_broker_config_file2='/app/oracle/base/admin/ASTYPRD/dgmgrl/dr2ASTYPRD.dat' scope=both sid='*';
|
||
|
|
alter system set dg_broker_start=TRUE scope=both sid='*';
|
||
|
|
|
||
|
|
On secondary database:
|
||
|
|
|
||
|
|
alter system set dg_broker_config_file1='/app/oracle/base/admin/ASTYDRP/dgmgrl/dr1ASTYDRP.dat' scope=both sid='*';
|
||
|
|
alter system set dg_broker_config_file2='/app/oracle/base/admin/ASTYDRP/dgmgrl/dr2ASTYDRP.dat' scope=both sid='*';
|
||
|
|
alter system set dg_broker_start=TRUE scope=both sid='*';
|
||
|
|
|
||
|
|
On primary or secondary server:
|
||
|
|
|
||
|
|
dgmgrl
|
||
|
|
connect sys/*****@ASTYPRD_DGMGRL
|
||
|
|
|
||
|
|
create configuration ASTY as
|
||
|
|
primary database is ASTYPRD
|
||
|
|
connect identifier is ASTYPRD_DGMGRL;
|
||
|
|
|
||
|
|
add database ASTYDRP
|
||
|
|
as connect identifier is ASTYDRP_DGMGRL
|
||
|
|
maintained as physical;
|
||
|
|
|
||
|
|
enable configuration;
|
||
|
|
|
||
|
|
edit database 'astyprd' set property ArchiveLagTarget=0;
|
||
|
|
edit database 'astyprd' set property LogArchiveMaxProcesses=2;
|
||
|
|
edit database 'astyprd' set property LogArchiveMinSucceedDest=1;
|
||
|
|
edit database 'astyprd' set property StandbyFileManagement='AUTO';
|
||
|
|
|
||
|
|
edit database 'astydrp' set property ArchiveLagTarget=0;
|
||
|
|
edit database 'astydrp' set property LogArchiveMaxProcesses=2;
|
||
|
|
edit database 'astydrp' set property LogArchiveMinSucceedDest=1;
|
||
|
|
edit database 'astydrp' set property StandbyFileManagement='AUTO';
|
||
|
|
|
||
|
|
edit instance 'ASTYPRD' set property 'StaticConnectIdentifier'='ASTYPRD_DGMGRL';
|
||
|
|
edit instance 'ASTYDRP' set property 'StaticConnectIdentifier'='ASTYPRD_DGMGRL';
|
||
|
|
|
||
|
|
edit instance 'ASTYPRD' set property 'StaticConnectIdentifier'='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=taris.swgalaxy)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=ASTYPRD_DGMGRL)(INSTANCE_NAME=ASTYPRD)(SERVER=DEDICATED)))';
|
||
|
|
edit instance 'ASTYDRP' set property 'StaticConnectIdentifier'='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mandalore.swgalaxy)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=ASTYDRP_DGMGRL)(INSTANCE_NAME=ASTYDRP)(SERVER=DEDICATED)))';
|
||
|
|
|
||
|
|
|
||
|
|
Wait a couple of minutes (after eventually archiving current log on primary database) therefore:
|
||
|
|
|
||
|
|
show configuration
|
||
|
|
show database 'astyprd'
|
||
|
|
show database 'astydrp'
|
||
|
|
|
||
|
|
validate database 'astyprd'
|
||
|
|
validate database 'astydrp'
|
||
|
|
|
||
|
|
|
||
|
|
To disable/enable redo apply on standby database:
|
||
|
|
|
||
|
|
edit database 'astydrp' set state='APPLY-OFF';
|
||
|
|
edit database 'astydrp' set state='ONLINE';
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
Backup primary and standby databases
|
||
|
|
------------------------------------
|
||
|
|
|
||
|
|
Backup primary database:
|
||
|
|
|
||
|
|
rman target /
|
||
|
|
|
||
|
|
run
|
||
|
|
{
|
||
|
|
set nocfau;
|
||
|
|
allocate channel ch01 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYPRD/%d_%U_%s_%t.bck';
|
||
|
|
allocate channel ch02 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYPRD/%d_%U_%s_%t.bck';
|
||
|
|
allocate channel ch03 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYPRD/%d_%U_%s_%t.bck';
|
||
|
|
allocate channel ch04 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYPRD/%d_%U_%s_%t.bck';
|
||
|
|
backup as compressed backupset incremental level 0 database section size 2G include current controlfile plus archivelog delete input;
|
||
|
|
release channel ch01;
|
||
|
|
release channel ch02;
|
||
|
|
release channel ch03;
|
||
|
|
release channel ch04;
|
||
|
|
allocate channel ch01 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYPRD/%d_%U_%s_%t.controlfile';
|
||
|
|
backup current controlfile;
|
||
|
|
release channel ch01;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
Backup standby database:
|
||
|
|
|
||
|
|
rman target='"sys/*****"'
|
||
|
|
|
||
|
|
run
|
||
|
|
{
|
||
|
|
set nocfau;
|
||
|
|
allocate channel ch01 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYDRP/%d_%U_%s_%t.bck';
|
||
|
|
allocate channel ch02 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYDRP/%d_%U_%s_%t.bck';
|
||
|
|
allocate channel ch03 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYDRP/%d_%U_%s_%t.bck';
|
||
|
|
allocate channel ch04 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYDRP/%d_%U_%s_%t.bck';
|
||
|
|
backup as compressed backupset incremental level 0 database section size 2G include current controlfile plus archivelog delete input;
|
||
|
|
release channel ch01;
|
||
|
|
release channel ch02;
|
||
|
|
release channel ch03;
|
||
|
|
release channel ch04;
|
||
|
|
allocate channel ch01 device type disk format '/mnt/yavin4/tmp/_oracle_/orabackup/ASTYDRP/%d_%U_%s_%t.controlfile';
|
||
|
|
backup current controlfile;
|
||
|
|
release channel ch01;
|
||
|
|
}
|
||
|
|
|