0% found this document useful (0 votes)
12 views6 pages

Procedure Create DG BD Single

Uploaded by

Rafael Cruz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Procedure Create DG BD Single

Uploaded by

Rafael Cruz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

-- Ambiente

Pré-requisitos:
1. Memsa versão de database
2. Database criado e em modo Open/archive
3. Binario no standby instalado

Host primary:
Host Secundário:
Database primary: BDPRM
Database secundário: BDSTB

-----------------------------------------------------------------------------------
---
Host: Primary
User: Grid

. oraenv
BDPRM

lsnrctl status

-- Editar o aquivo sqlnet.ora


vi $ORACLE_HOME/network/admin/sqlnet.ora

# sqlnet.ora Network Configuration File:


/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, EZCONNECT)
ADR_BASE = /u01/app/oracle

-- Editar o aquivo listener.ora

# listener.ora Network Configuration File:


/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o a
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host01.example.com)(PORT =
1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

-- Editar o aquivo tnsnames.ora

# tnsnames.ora Network Configuration File:


/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o ra # Generated by
Oracle configuration tools.

DBPRM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = host01.example.com)(PORT =
1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DBPRDM.example.com)
)
)

PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = host01.example.com)(PORT =
1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = host03.example.com)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME = prmy.example.com)
)
)

DBSTB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = host03.example.com)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DBSTB.example.com)
)
)

-----------------------------------------------------------------------------------
---
Host: Primary
User: Oracle

. oraenv
BDPRM

-- Verificar se o database em modo force_logging


SELECT force_logging FROM v$database;
ALTER DATABASE FORCE LOGGING;
SELECT force_logging FROM v$database;

-- Adicionar redo de standby com a mesma quantidade + 1 do original (nosso exemplo


4+1)
SQL> select group#,bytes from v$log;
GROUP# BYTES
---------- ----------
1 52428800
2 52428800
3 52428800

alter database add standby logfile


('/u01/app/oracle/oradata/BDPRM/stdbyredo01.log') size 50M;
alter database add standby logfile
('/u01/app/oracle/oradata/BDPRM/stdbyredo02.log') size 50M;
alter database add standby logfile
('/u01/app/oracle/oradata/BDPRM/stdbyredo03.log') size 50M;
alter database add standby logfile
('/u01/app/oracle/oradata/BDPRM/stdbyredo04.log') size 50M;

SQL> select group#,bytes from v$standby_log;


GROUP# BYTES
---------- ----------
4 52428800
5 52428800
6 52428800
7 52428800

-- Adicinar destino 1 com os parâmetros:

- The redo_log_type keywords are:


• ONLINE_LOGFILE: This destination is used only when archiving online redo log
files.
• STANDBY_LOGFILE: This destination is used only when archiving standby redo log
files or receiving archive logs from another database.
• ALL_LOGFILES: This destination is used when archiving either online or standby
redo log filies.

- The database_role keywords are the following:


• PRIMARY_ROLE: This destination is used only when the database is in the primary
database role.
• STANDBY ROLE: This destinationis used only when thedatabaseis in thestandby
STANDBY_ROLE: This destination is used only when the database is in the standby
(logical or physical) role.
• ALL_ROLES: This destination is used when the database is in either the primary or
the standby (logical or physical) role

- USE_DB_RECOVERY_FILE_DEST when the fast recovery area was being used. Ou


espeficiar o caminho dos archives.

alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST


valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=BDPRM' scope=both;

-- Habilitar o DEST_1 dos archives. ( default é habilitado)


alter system set log_archive_dest_state_1='enable' scope=both;

-- Aumentar a quantidade de archives tratados ao mesmo tempo


alter system set log_archive_max_processes=4 scope=both

-- Alterar as configurações dos parâmetros de archive config.


• Nome dos databases envolvidos no DG
• SEND
• NOSEND
• RECEIVE
• NORECEIVE

show parameter log_archive_config;


SELECT * FROM v$dataguard_config;
alter system set log_archive_config='dg_config=(BDPRM,BDSTB)' scope=both;

-- Habilitar o gerenciamento dos arquivos de standby


alter system set standby_file_management='auto' scope=both
-----------------------------------------------------------------------------------
---
Host: Standby
User: Oracle

Caso use o ASM, não será necessário criar os diretórios de dados e logs.
Caso não criar com o mkdir:
mkdir -p /u01/app/oracle/admin/DBSTB/adump
mkdir -p /u01/app/oracle/oradata/DBSTB
mkdir -p /u01/app/oracle/oradata/DBSTB/pdbseed
mkdir -p /u01/app/oracle/oradata/DBSTB/dev1
mkdir -p /u01/app/oracle/fast_recovery_area/DBSTB

-- Criar arquivos de parãmetros (init)


echo 'DB_NAME=DBSTB' > /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initDBSTB.ora
echo 'DB_DOMAIN=example.com' >>
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initDBSTB.ora

-- Copiar o arquivo de senhas do primary


scp oracle@host01:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwDBPRM
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwBDSTB

-- Iniciar o database em modo mount


sqlplus / as sysdba
startup nomount

-- Duplcate do database

. oraenv
DBSTB

rman target sys/oracle_4U@DBPRM auxiliary sys/oracle_4U@DBSTB

run
{
allocate channel prmy1 type disk;
allocate auxiliary channel stby1 type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'DBPRM','DBSTB'
set db_unique_name='london'
set db_file_name_convert='boston','london'
set log_file_name_convert='boston','london'
set fal_server='boston'
nofilenamecheck;
allocate auxiliary channel stby type disk;
sql channel stby "alter database recover managed standby database disconnect";
}

--
-----------------------------------------------------------------------------------
---
Host: Primary
User: Oracle

. oraenv
BDPRM
-- Habilitar a replicação
alter system set log_archive_dest_2='SERVICE=DBSTB ASYNC REOPEN=15
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=DBSTB' scope=both;

-- Verificar a sequence atual do BD


SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

-- Executar o switch do redo log


alter system switch logfile;

-----------------------------------------------------------------------------------
---
Host: Standby
User: Oracle

. oraenv
DBSTB

-- Verificar a sequence atual do BD


SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

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

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

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

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

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

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

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

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

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

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

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

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

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy