Fale pessoal. Andei brincando um pouco com o Oracle 12c últimamente, afinal, temos que nos manter sempre atualizados, senão o mercado dá uma rasteira em nós, ou usando uma gíria paraense, nós “levamos o farelo’. Fiz este pequeno tutorial de como configurar um ambiente de Dataguard usando o Oracle 12c EE. Todos os testes foram feitos no VirtualBox (host Debian 7 e guest OEL6.3). Espero que seja útil para vocês assim como foi útil para mim. Dúvidas/sugestões/críticas são bem-vindas.
1) INFORMAÇÕES INICIAIS
Versão SO: Oracle Enterprise Linux 6.3 – 64 bits
Versão do Clusterware: 12.1.0.1 – 64 bits (software owner: grid)
Versão RDBMS: 12.1.0.1 – 64 bits (software owner: oracle)
SID primário: CDBPROD (DB_NAME: CDBPROD | DB_UNIQUE_NAME: CDBPROD) – 192.168.0.123
SID standby: CDBPROD (DB_NAME: CDBPROD | DB_UNIQUE_NAME: PROD_DR) – 192.168.0.124
2) CONFIGURAÇÕES NO LADO PRIMÁRIO
Passo1: Habilitar o FORCE LOGGING
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBBTFRFUiBEQVRBQkFTRSBGT1JDRSBMT0dHSU5HOw==” hover_enabled=”0″]U1FMPiBBTFRFUiBEQVRBQkFTRSBGT1JDRSBMT0dHSU5HOw==[/et_pb_dmb_code_snippet]
Passo2: Copiar o password file do primário para o Standby
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”c2NwIG9yYXB3Y2RicHJvZCBvcmFjbGVAMTkyLjE2OC4wLjEyNDovdTAxL2FwcC9vcmFjbGUvcHJvZHVjdC8xMi4xLjAvZGJfaG9tZTEvZGJz” hover_enabled=”0″]c2NwIG9yYXB3Y2RicHJvZCBvcmFjbGVAMTkyLjE2OC4wLjEyNDovdTAxL2FwcC9vcmFjbGUvcHJvZHVjdC8xMi4xLjAvZGJfaG9tZTEvZGJz[/et_pb_dmb_code_snippet]
Passo3: Adicionar uma entrada estática no Listener para a base de dados primária. Editar esse arquivo com o usuário grid. Após sua edição, recarregar o listener. Ex:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U0lEX0xJU1RfTElTVEVORVIgPQoKKFNJRF9MSVNUID0KCihTSURfREVTQyA9CgooR0xPQkFMX0RCTkFNRSA9IGNkYnByb2QpCgooT1JBQ0xFX0hPTUUgPSAvdTAxL2FwcC8xMi4xLjAvcHJvZHVjdC9kYl8xKQoKKFNJRF9OQU1FID0gY2RicHJvZCkKCikKCihTSURfREVTQyA9CgooR0xPQkFMX0RCTkFNRSA9IGNkYnByb2RfREdNR1JMKSAjIyMgdXNvIGRvIGJyb2tlciAjIyMKCihPUkFDTEVfSE9NRSA9IC91MDEvYXBwLzEyLjEuMC9wcm9kdWN0L2RiXzEpCgooU0lEX05BTUUgPSBjZGJwcm9kKQoKKQoKKQ==” hover_enabled=”0″]U0lEX0xJU1RfTElTVEVORVIgPQoKKFNJRF9MSVNUID0KCihTSURfREVTQyA9CgooR0xPQkFMX0RCTkFNRSA9IGNkYnByb2QpCgooT1JBQ0xFX0hPTUUgPSAvdTAxL2FwcC8xMi4xLjAvcHJvZHVjdC9kYl8xKQoKKFNJRF9OQU1FID0gY2RicHJvZCkKCikKCihTSURfREVTQyA9CgooR0xPQkFMX0RCTkFNRSA9IGNkYnByb2RfREdNR1JMKSAjIyMgdXNvIGRvIGJyb2tlciAjIyMKCihPUkFDTEVfSE9NRSA9IC91MDEvYXBwLzEyLjEuMC9wcm9kdWN0L2RiXzEpCgooU0lEX05BTUUgPSBjZGJwcm9kKQoKKQoKKQ==[/et_pb_dmb_code_snippet]
Passo4: Adicionar uma entrada referente ao Standby no tnsnames.ora
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”UFJPRF9EUiA9CgooREVTQ1JJUFRJT04gPQoKKEFERFJFU1MgPSAoUFJPVE9DT0wgPSBUQ1ApKEhPU1QgPSB2bS1vcmExMi1zdGRiLmxvY2FsZG9tYWluKShQT1JUID0gMTUyMSkpCgooQ09OTkVDVF9EQVRBID0KCihTRVJWRVIgPSBERURJQ0FURUQpCgooU0VSVklDRV9OQU1FID0gcHJvZF9kcikKCik=” hover_enabled=”0″]UFJPRF9EUiA9CgooREVTQ1JJUFRJT04gPQoKKEFERFJFU1MgPSAoUFJPVE9DT0wgPSBUQ1ApKEhPU1QgPSB2bS1vcmExMi1zdGRiLmxvY2FsZG9tYWluKShQT1JUID0gMTUyMSkpCgooQ09OTkVDVF9EQVRBID0KCihTRVJWRVIgPSBERURJQ0FURUQpCgooU0VSVklDRV9OQU1FID0gcHJvZF9kcikKCik=[/et_pb_dmb_code_snippet]
Passo5: Criar os Standby REDO Logs. Criar G + 1 Standby REDO Logs, onde G indica o total de REDO Log Groups. Por exemplo, caso existam 4 REDO Log Groups, deve-se criar 5 Standby REDO Log Groups.
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”YWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA0IOKAmCtER1BST0Qx4oCZIHNpemUgMTAwTTsKCmFsdGVyIGRhdGFiYXNlIGFkZCBzdGFuZGJ5IGxvZ2ZpbGUgZ3JvdXAgNSDigJgrREdQUk9EMeKAmSBzaXplIDEwME07CgphbHRlciBkYXRhYmFzZSBhZGQgc3RhbmRieSBsb2dmaWxlIGdyb3VwIDYg4oCYK0RHUFJPRDHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA3IOKAmCtER1BST0Qx4oCZIHNpemUgMTAwTTs=” hover_enabled=”0″]YWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA0IOKAmCtER1BST0Qx4oCZIHNpemUgMTAwTTsKCmFsdGVyIGRhdGFiYXNlIGFkZCBzdGFuZGJ5IGxvZ2ZpbGUgZ3JvdXAgNSDigJgrREdQUk9EMeKAmSBzaXplIDEwME07CgphbHRlciBkYXRhYmFzZSBhZGQgc3RhbmRieSBsb2dmaWxlIGdyb3VwIDYg4oCYK0RHUFJPRDHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA3IOKAmCtER1BST0Qx4oCZIHNpemUgMTAwTTs=[/et_pb_dmb_code_snippet]
Passo6: Criar um PFILE baseado no SPFILE do primário, e copia-lo para o Standby. Esse PFILE será posteriormente editado no Standby, adequando seus parâmetros, para que finalmente, a base de dados Standby seja montada.
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBjcmVhdGUgcGZpbGUg4oCYL3UwMS9hcHAvb3JhY2xlLzEyLjEuMC9wcm9kdWN0L2RiXzEvZGJzL3BmaWxlX3N0YW5kYnkub3Jh4oCZIGZyb20gc3BmaWxlOwoKc2NwIHBmaWxlX3N0YW5kYnkub3JhIG9yYWNsZUAxOTIuMTY4LjAuMTI0Oi91MDEvYXBwL29yYWNsZS9wcm9kdWN0LzEyLjEuMC9kYl9ob21lMS9kYnM=” hover_enabled=”0″]U1FMPiBjcmVhdGUgcGZpbGUg4oCYL3UwMS9hcHAvb3JhY2xlLzEyLjEuMC9wcm9kdWN0L2RiXzEvZGJzL3BmaWxlX3N0YW5kYnkub3Jh4oCZIGZyb20gc3BmaWxlOwoKc2NwIHBmaWxlX3N0YW5kYnkub3JhIG9yYWNsZUAxOTIuMTY4LjAuMTI0Oi91MDEvYXBwL29yYWNsZS9wcm9kdWN0LzEyLjEuMC9kYl9ob21lMS9kYnM=[/et_pb_dmb_code_snippet]
Passo7: Criar um STANDBY Control File e copia-lo para seu destino final, no Standby
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBBTFRFUiBEQVRBQkFTRSBDUkVBVEUgU1RBTkRCWSBDT05UUk9MRklMRSBBUyDigJgvdTAxL2FwcC8xMi4xLjAvcHJvZHVjdC9kYl8xL2Ricy9jb250cm9sMDEuY3Rs4oCZOwoKc2NwIGNvbnRyb2wwMS5jdGwgb3JhY2xlQDE5Mi4xNjguMC4xMjQ6L3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiX2hvbWUxL2Ricw==” hover_enabled=”0″]U1FMPiBBTFRFUiBEQVRBQkFTRSBDUkVBVEUgU1RBTkRCWSBDT05UUk9MRklMRSBBUyDigJgvdTAxL2FwcC8xMi4xLjAvcHJvZHVjdC9kYl8xL2Ricy9jb250cm9sMDEuY3Rs4oCZOwoKc2NwIGNvbnRyb2wwMS5jdGwgb3JhY2xlQDE5Mi4xNjguMC4xMjQ6L3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiX2hvbWUxL2Ricw==[/et_pb_dmb_code_snippet]
[LADO STANDBY] Após o termino da cópia do Standby controlfile para o Standby, deve-se copiar esse controlfile para dentro do ASM, via RMAN.
Passo8:[EXECUTAR APENAS APÓS O RESTORE] Após a conclusão do RESTORE do Standby, é necessário alterar alguns parâmetros no primário, relacionados às configurações do Standby. Após realizar essas alterações, reiniciar a base de dados primária.
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBBTFRFUiBTWVNURU0gU0VUIExPR19BUkNISVZFX0NPTkZJRz3igJlER19DT05GSUc9KENEQlBST0QsUFJPRF9EUinigJkgU0NPUEU9U1BGSUxFOwoKU1FMPiBBTFRFUiBTWVNURU0gU0VUIExPR19BUkNISVZFX0RFU1RfMj3igJlTRVJWSUNFPVBST0RfRFIgQVNZTkMgTk9BRkZJUk0gUkVPUEVOPTE1IFZBTElEX0ZPUj0oQUxMX0xPR0ZJTEVTLFBSSU1BUllfUk9MRSkgREJfVU5JUVVFX05BTUU9UFJPRF9EUuKAmSBTQ09QRT1TUEZJTEXigJk7CgpTUUw+IEFMVEVSIFNZU1RFTSBTRVQgU1RBTkRCWV9GSUxFX01BTkFHRU1FTlQ94oCZQVVUT+KAmSBTQ09QRT1TUEZJTEU7CgpTUUw+IEFMVEVSIFNZU1RFTSBTRVQgTE9HX0FSQ0hJVkVfREVTVF9TVEFURV8yPeKAmUVOQUJMReKAmSBTQ09QRT1TUEZJTEU7CgpTUUw+IEFMVEVSIFNZU1RFTSBTRVQgRkFMX1NFUlZFUj3igJlQUk9EX0RS4oCZIFNDT1BFPVNQRklMRTsKClNRTD4gQUxURVIgU1lTVEVNIFNFVCBGQUxfQ0xJRU5UPeKAmUNEQlBST0TigJkgU0NPUEU9U1BGSUxFOw==” hover_enabled=”0″]U1FMPiBBTFRFUiBTWVNURU0gU0VUIExPR19BUkNISVZFX0NPTkZJRz3igJlER19DT05GSUc9KENEQlBST0QsUFJPRF9EUinigJkgU0NPUEU9U1BGSUxFOwoKU1FMPiBBTFRFUiBTWVNURU0gU0VUIExPR19BUkNISVZFX0RFU1RfMj3igJlTRVJWSUNFPVBST0RfRFIgQVNZTkMgTk9BRkZJUk0gUkVPUEVOPTE1IFZBTElEX0ZPUj0oQUxMX0xPR0ZJTEVTLFBSSU1BUllfUk9MRSkgREJfVU5JUVVFX05BTUU9UFJPRF9EUuKAmSBTQ09QRT1TUEZJTEXigJk7CgpTUUw+IEFMVEVSIFNZU1RFTSBTRVQgU1RBTkRCWV9GSUxFX01BTkFHRU1FTlQ94oCZQVVUT+KAmSBTQ09QRT1TUEZJTEU7CgpTUUw+IEFMVEVSIFNZU1RFTSBTRVQgTE9HX0FSQ0hJVkVfREVTVF9TVEFURV8yPeKAmUVOQUJMReKAmSBTQ09QRT1TUEZJTEU7CgpTUUw+IEFMVEVSIFNZU1RFTSBTRVQgRkFMX1NFUlZFUj3igJlQUk9EX0RS4oCZIFNDT1BFPVNQRklMRTsKClNRTD4gQUxURVIgU1lTVEVNIFNFVCBGQUxfQ0xJRU5UPeKAmUNEQlBST0TigJkgU0NPUEU9U1BGSUxFOw==[/et_pb_dmb_code_snippet]
OBS1: Caso se use o Broker para gerenciar o Dataguard, não será necessário setar o parâmetro LOG_ARCHIVE_DEST_2, pois isso será automaticamente feito pelo Broker durante a sua configuração. Caso se defina esse parâmetro, no momento de criar a configuração do Broker, o erro ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added será lançado.
3) CONFIGURAÇÕES NO LADO STANDBY
Passo1:Criar as estruturas de diretórios necessárias, como o AUDIT_FILE_DEST:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”Y2QgJE9SQUNMRV9CQVNFCgpta2RpciDigJNwIGFkbWluL3Byb2RfZHIvYWR1bXA=” hover_enabled=”0″]Y2QgJE9SQUNMRV9CQVNFCgpta2RpciDigJNwIGFkbWluL3Byb2RfZHIvYWR1bXA=[/et_pb_dmb_code_snippet]
Passo2: Adicionar uma entrada estática no Listener para a base de dados Standby. Editar esse arquivo com o usuário grid. Após sua edição, recarregar o listener. Ex:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U0lEX0xJU1RfTElTVEVORVIgPQoKKFNJRF9MSVNUID0KCihTSURfREVTQyA9CgooR0xPQkFMX0RCTkFNRSA9IHByb2RfZHIpCgooT1JBQ0xFX0hPTUUgPSAvdTAxL2FwcC9vcmFjbGUvcHJvZHVjdC8xMi4xLjAvZGJob21lXzEpCgooU0lEX05BTUUgPSBjZGJwcm9kKQoKKQoKKFNJRF9ERVNDID0KCihHTE9CQUxfREJOQU1FID0gcHJvZF9kcl9ER01HUkwpICMjIyB1c28gZG8gYnJva2VyICMjIwoKKE9SQUNMRV9IT01FID0gL3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiaG9tZV8xKQoKKFNJRF9OQU1FID0gY2RicHJvZCkKCikKCik=” hover_enabled=”0″]U0lEX0xJU1RfTElTVEVORVIgPQoKKFNJRF9MSVNUID0KCihTSURfREVTQyA9CgooR0xPQkFMX0RCTkFNRSA9IHByb2RfZHIpCgooT1JBQ0xFX0hPTUUgPSAvdTAxL2FwcC9vcmFjbGUvcHJvZHVjdC8xMi4xLjAvZGJob21lXzEpCgooU0lEX05BTUUgPSBjZGJwcm9kKQoKKQoKKFNJRF9ERVNDID0KCihHTE9CQUxfREJOQU1FID0gcHJvZF9kcl9ER01HUkwpICMjIyB1c28gZG8gYnJva2VyICMjIwoKKE9SQUNMRV9IT01FID0gL3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiaG9tZV8xKQoKKFNJRF9OQU1FID0gY2RicHJvZCkKCikKCik=[/et_pb_dmb_code_snippet]
Passo3:Adicionar 2 entradas no tnsnames.ora, uma apontando para a base Primária e outra para a base Standby
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”IyBzdGFuZGJ5CgpQUk9EX0RSID0KCihERVNDUklQVElPTiA9CgooQUREUkVTUyA9IChQUk9UT0NPTCA9IFRDUCkoSE9TVCA9IHZtLW9yYTEyLXN0ZGIubG9jYWxkb21haW4pKFBPUlQgPSAxNTIxKSkKCihDT05ORUNUX0RBVEEgPQoKKFNFUlZFUiA9IERFRElDQVRFRCkKCihTRVJWSUNFX05BTUUgPSBwcm9kX2RyKQoKKQoKIAoKIyBwcmltw6FyaW8KCkNEQlBST0QgPQoKKERFU0NSSVBUSU9OID0KCihBRERSRVNTID0gKFBST1RPQ09MID0gVENQKShIT1NUID0gdm0tb3JhMTIubG9jYWxkb21haW4pKFBPUlQgPSAxNTIxKSkKCihDT05ORUNUX0RBVEEgPQoKKFNFUlZFUiA9IERFRElDQVRFRCkKCihTRVJWSUNFX05BTUUgPSBjZGJwcm9kKQoKKQ==” hover_enabled=”0″]IyBzdGFuZGJ5CgpQUk9EX0RSID0KCihERVNDUklQVElPTiA9CgooQUREUkVTUyA9IChQUk9UT0NPTCA9IFRDUCkoSE9TVCA9IHZtLW9yYTEyLXN0ZGIubG9jYWxkb21haW4pKFBPUlQgPSAxNTIxKSkKCihDT05ORUNUX0RBVEEgPQoKKFNFUlZFUiA9IERFRElDQVRFRCkKCihTRVJWSUNFX05BTUUgPSBwcm9kX2RyKQoKKQoKIAoKIyBwcmltw6FyaW8KCkNEQlBST0QgPQoKKERFU0NSSVBUSU9OID0KCihBRERSRVNTID0gKFBST1RPQ09MID0gVENQKShIT1NUID0gdm0tb3JhMTIubG9jYWxkb21haW4pKFBPUlQgPSAxNTIxKSkKCihDT05ORUNUX0RBVEEgPQoKKFNFUlZFUiA9IERFRElDQVRFRCkKCihTRVJWSUNFX05BTUUgPSBjZGJwcm9kKQoKKQ==[/et_pb_dmb_code_snippet]
Passo4:Editar o PFILE copiado do primário, adequando seus parâmetros para o Standby. Os parâmetros alterados foram os seguintes:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”Ki5hdWRpdF9maWxlX2Rlc3Q94oCZbm92b19jYW1pbmhvX2FycXVpdm9zX2F1ZGl0b3JpYeKAmQoKKi5jb250cm9sX2ZpbGVzPeKAmWNhbWluaG9fc3RhbmRieV9jb250cm9sZmlsZeKAmQoKKi5kYl9uYW1lPeKAmWNkYnByb2TigJkKCiouZGJfdW5pcXVlX25hbWU94oCZcHJvZF9kcuKAmQoKKi5sb2dfYXJjaGl2ZV9kZXN0XzI94oCZc2VydmljZT1jZGJwcm9kIGFzeW5jIG5vYWZmaXJtIHJlb3Blbj0xNSB2YWxpZF9mb3IoYWxsX2xvZ2ZpbGVzLHByaW1hcnlfcm9sZSkgZGJfdW5pcXVlX25hbWU9Y2RicHJvZOKAmQoKKi5zdGFuZGJ5X2ZpbGVfbWFuYWdlbWVudD3igJlBVVRP4oCZCgoqLmxvZ19hcmNoaXZlX2Rlc3Rfc3RhdGVfMT3igJlFTkFCTEXigJkKCioubG9nX2FyY2hpdmVfZGVzdF9zdGF0ZV8yPeKAmUVOQUJMReKAmQoKKi5kYl9maWxlX25hbWVfY29udmVydD0o4oCYK0RHUFJPRDHigJks4oCZK0RHREFUQeKAmSkKCioubG9nX2ZpbGVfbmFtZV9jb252ZXJ0PSjigJgrREdQUk9EMeKAmSzigJkrREdEQVRB4oCZLOKAmStER0ZSQeKAmSzigJkrREdEQVRB4oCZKQoKKi4gbG9nX2FyY2hpdmVfY29uZmlnPeKAmURHX0NPTkZJRz0oQ0RCUFJPRCxQUk9EX0RSKeKAmQoKKi5mYWxfc2VydmVyPeKAmUNEQlBST0TigJk=” hover_enabled=”0″]Ki5hdWRpdF9maWxlX2Rlc3Q94oCZbm92b19jYW1pbmhvX2FycXVpdm9zX2F1ZGl0b3JpYeKAmQoKKi5jb250cm9sX2ZpbGVzPeKAmWNhbWluaG9fc3RhbmRieV9jb250cm9sZmlsZeKAmQoKKi5kYl9uYW1lPeKAmWNkYnByb2TigJkKCiouZGJfdW5pcXVlX25hbWU94oCZcHJvZF9kcuKAmQoKKi5sb2dfYXJjaGl2ZV9kZXN0XzI94oCZc2VydmljZT1jZGJwcm9kIGFzeW5jIG5vYWZmaXJtIHJlb3Blbj0xNSB2YWxpZF9mb3IoYWxsX2xvZ2ZpbGVzLHByaW1hcnlfcm9sZSkgZGJfdW5pcXVlX25hbWU9Y2RicHJvZOKAmQoKKi5zdGFuZGJ5X2ZpbGVfbWFuYWdlbWVudD3igJlBVVRP4oCZCgoqLmxvZ19hcmNoaXZlX2Rlc3Rfc3RhdGVfMT3igJlFTkFCTEXigJkKCioubG9nX2FyY2hpdmVfZGVzdF9zdGF0ZV8yPeKAmUVOQUJMReKAmQoKKi5kYl9maWxlX25hbWVfY29udmVydD0o4oCYK0RHUFJPRDHigJks4oCZK0RHREFUQeKAmSkKCioubG9nX2ZpbGVfbmFtZV9jb252ZXJ0PSjigJgrREdQUk9EMeKAmSzigJkrREdEQVRB4oCZLOKAmStER0ZSQeKAmSzigJkrREdEQVRB4oCZKQoKKi4gbG9nX2FyY2hpdmVfY29uZmlnPeKAmURHX0NPTkZJRz0oQ0RCUFJPRCxQUk9EX0RSKeKAmQoKKi5mYWxfc2VydmVyPeKAmUNEQlBST0TigJk=[/et_pb_dmb_code_snippet]
OBS1: Caso se use o Broker para gerenciar o Dataguard, não será necessário setar o parâmetro LOG_ARCHIVE_DEST_2, pois isso será automaticamente feito pelo Broker durante a sua configuração. Caso se defina esse parâmetro, no momento de criar a configuração do Broker, o erro ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added será lançado.
NOTA1: O parâmetro DB_UNIQUE_NAME será diferente entre o primário e o Standby, e o parâmetro DB_NAME será o mesmo para ambos.
NOTA2: O parâmetro STANDBY_ARCHIVE_DEST está depreciado.
Passo5:Iniciar a base Standby em NOMOUNT, usando o PFILE previamente editado. Depois alterar o estado da base de dados para MOUNT.
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”ZXhwb3J0IE9SQUNMRV9TSUQ9Y2RicHJvZAoKc3FscGx1cyAvIGFzIHN5c2RiYQoKU1FMPiBzdGFydHVwIG5vbW91bnQgcGZpbGU94oCZL3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiX2hvbWUxL2Ricy9wZmlsZV9zdGFuZGJ5Lm9yYeKAmTsKClNRTD4gQUxURVIgREFUQUJBU0UgTU9VTlQ7″ hover_enabled=”0″]ZXhwb3J0IE9SQUNMRV9TSUQ9Y2RicHJvZAoKc3FscGx1cyAvIGFzIHN5c2RiYQoKU1FMPiBzdGFydHVwIG5vbW91bnQgcGZpbGU94oCZL3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiX2hvbWUxL2Ricy9wZmlsZV9zdGFuZGJ5Lm9yYeKAmTsKClNRTD4gQUxURVIgREFUQUJBU0UgTU9VTlQ7[/et_pb_dmb_code_snippet]
Passo6:Iniciar o RESTORE da base de dados primária. O RESTORE será feito usando a nova feature do 12c, que é o restore via service_name (entrada tnsnames.ora)
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”cm1hbiB0YXJnZXQgLwoKUk1BTj4gUkVTVE9SRSBEQVRBQkFTRSBGUk9NIFNFUlZJQ0UgQ0RCUFJPRCBVU0lORyBDT01QUkVTU0VEIEJBQ0tVUFNFVDs=” hover_enabled=”0″]cm1hbiB0YXJnZXQgLwoKUk1BTj4gUkVTVE9SRSBEQVRBQkFTRSBGUk9NIFNFUlZJQ0UgQ0RCUFJPRCBVU0lORyBDT01QUkVTU0VEIEJBQ0tVUFNFVDs=[/et_pb_dmb_code_snippet]
Passo7: Criar os Standby REDO Logs. Criar G + 1 Standby REDO Logs, onde G indica o total de REDO Log Groups. Por exemplo, caso existam 4 REDO Log Groups, deve-se criar 5 Standby REDO Log Groups.
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”YWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA0IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA1IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA2IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA3IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOw==” hover_enabled=”0″]YWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA0IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA1IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA2IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOwoKYWx0ZXIgZGF0YWJhc2UgYWRkIHN0YW5kYnkgbG9nZmlsZSBncm91cCA3IOKAmCtER0RBVEHigJkgc2l6ZSAxMDBNOw==[/et_pb_dmb_code_snippet]
OBS1: O RESTORE via service_name já criou os Standby redo log files.
Passo8: Iniciar o Media Recovery Process (MRP)
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBBTFRFUiBEQVRBQkFTRSBSRUNPVkVSIE1BTkFHRUQgU1RBTkRCWSBEQVRBQkFTRSBESVNDT05ORUNUOw==” hover_enabled=”0″]U1FMPiBBTFRFUiBEQVRBQkFTRSBSRUNPVkVSIE1BTkFHRUQgU1RBTkRCWSBEQVRBQkFTRSBESVNDT05ORUNUOw==[/et_pb_dmb_code_snippet]
Passo9:Criar um SPFILE e o armazenar em um diskgroup:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBjcmVhdGUgc3BmaWxlPeKAmStER0RBVEEvUFJPRF9EUi9TUEZJTEUvc3BmaWxlY2RicHJvZC5vcmHigJkgZnJvbSBwZmlsZT3igJl1MDEvYXBwL29yYWNsZS9wcm9kdWN0LzEyLjEuMC9kYl9ob21lMS9kYnMvcGZpbGVfc3RhbmRieS5vcmHigJk7CgogCgojIyMgY3JpYXIgdW0gYXJxdWl2byDigJxpbml0PFNJRD4ub3Jh4oCdIGRlbnRybyBkZSBPUkFDTEVfSE9NRS9kYnMKCnZpIGluaXRjZGJwcm9kLm9yYQoKIAoKIyMjIGluc2VyaXIgbyBzZWd1aW50ZSBubyBhcnF1aXZvIGluaXRjZGJwcm9kLm9yYQoKc3BmaWxlPeKAmSArREdEQVRBL1BST0RfRFIvU1BGSUxFL3NwZmlsZWNkYnByb2Qub3Jh4oCZCgogCgojIyMgdGVzdGFyCgpTUUw+IHNodXRkb3duIGltbWVkaWF0ZTsKClNRTD4gc3RhcnR1cCBtb3VudDs=” hover_enabled=”0″]U1FMPiBjcmVhdGUgc3BmaWxlPeKAmStER0RBVEEvUFJPRF9EUi9TUEZJTEUvc3BmaWxlY2RicHJvZC5vcmHigJkgZnJvbSBwZmlsZT3igJl1MDEvYXBwL29yYWNsZS9wcm9kdWN0LzEyLjEuMC9kYl9ob21lMS9kYnMvcGZpbGVfc3RhbmRieS5vcmHigJk7CgogCgojIyMgY3JpYXIgdW0gYXJxdWl2byDigJxpbml0PFNJRD4ub3Jh4oCdIGRlbnRybyBkZSBPUkFDTEVfSE9NRS9kYnMKCnZpIGluaXRjZGJwcm9kLm9yYQoKIAoKIyMjIGluc2VyaXIgbyBzZWd1aW50ZSBubyBhcnF1aXZvIGluaXRjZGJwcm9kLm9yYQoKc3BmaWxlPeKAmSArREdEQVRBL1BST0RfRFIvU1BGSUxFL3NwZmlsZWNkYnByb2Qub3Jh4oCZCgogCgojIyMgdGVzdGFyCgpTUUw+IHNodXRkb3duIGltbWVkaWF0ZTsKClNRTD4gc3RhcnR1cCBtb3VudDs=[/et_pb_dmb_code_snippet]
Passo10: Adicionar a base de dados Standby ao Clusterware. Executar o comando abaixo como usuário “oracle”:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”c3J2Y3RsIGFkZCBkYXRhYmFzZSDigJNkIHByb2RfZHIg4oCTbiBjZGJwcm9kIOKAk3IgcGh5c2ljYWxfc3RhbmRieSDigJNzIG1vdW50IOKAk28gL3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiX2hvbWUxIOKAk3AgK0RHREFUQS9QUk9EX0RSL1NQRklMRS9zcGZpbGVjZGJwcm9kLm9yYQoKIAoKIyMjIGRlc2xpZ2FyIG8gc3RhbmRieSBlIGxpZ2FyIG5vdmFtZW50ZSBwYXJhIHF1ZSBvIGNsdXN0ZXJ3YXJlIHNlamEgYXR1YWxpemFkbwoKc2h1dGRvd24gaW1tZWRpYXRlOwoKc3RhcnR1cCBtb3VudDs=” hover_enabled=”0″]c3J2Y3RsIGFkZCBkYXRhYmFzZSDigJNkIHByb2RfZHIg4oCTbiBjZGJwcm9kIOKAk3IgcGh5c2ljYWxfc3RhbmRieSDigJNzIG1vdW50IOKAk28gL3UwMS9hcHAvb3JhY2xlL3Byb2R1Y3QvMTIuMS4wL2RiX2hvbWUxIOKAk3AgK0RHREFUQS9QUk9EX0RSL1NQRklMRS9zcGZpbGVjZGJwcm9kLm9yYQoKIAoKIyMjIGRlc2xpZ2FyIG8gc3RhbmRieSBlIGxpZ2FyIG5vdmFtZW50ZSBwYXJhIHF1ZSBvIGNsdXN0ZXJ3YXJlIHNlamEgYXR1YWxpemFkbwoKc2h1dGRvd24gaW1tZWRpYXRlOwoKc3RhcnR1cCBtb3VudDs=[/et_pb_dmb_code_snippet]
4) CONFIGURANDO O BROKER
Passo1: Alterar o parâmetro DG_BROKER_START, no standby e no primário:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPiBBTFRFUiBTWVNURU0gU0VUIERHX0JST0tFUl9TVEFSVD1UUlVFOw==” hover_enabled=”0″]U1FMPiBBTFRFUiBTWVNURU0gU0VUIERHX0JST0tFUl9TVEFSVD1UUlVFOw==[/et_pb_dmb_code_snippet]
Passo2:No primário, acessar a ferramenta DGMGRL e criar a configuração:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”ZGdtZ3JsCgpER01HUkw+IGNvbm5lY3Qgc3lzL3NlbmhhCgpER01HUkw+IGNyZWF0ZSBjb25maWd1cmF0aW9uIGNmZ19jZGJwcm9kIGFzIHByaW1hcnkgZGF0YWJhc2UgaXMgY2RicHJvZCBjb25uZWN0IGlkZW50aWZpZXIgaXMg4oCYY2RicHJvZOKAmTsKCkRHTUdSTD4gYWRkIGRhdGFiYXNlIOKAmHByb2RfZHLigJkgYXMgY29ubmVjdCBpZGVudGlmaWVyIGlzIOKAmHByb2RfZHLigJkgbWFpbnRhaW5lZCBhcyBwaHlzaWNhbDsKCkRHTUdSTD4gZW5hYmxlIGNvbmZpZ3VyYXRpb247CgogCgojIyMgdmFsaWRhcgoKREdNR1JMPiBzaG93IGNvbmZpZ3VyYXRpb247″ hover_enabled=”0″]ZGdtZ3JsCgpER01HUkw+IGNvbm5lY3Qgc3lzL3NlbmhhCgpER01HUkw+IGNyZWF0ZSBjb25maWd1cmF0aW9uIGNmZ19jZGJwcm9kIGFzIHByaW1hcnkgZGF0YWJhc2UgaXMgY2RicHJvZCBjb25uZWN0IGlkZW50aWZpZXIgaXMg4oCYY2RicHJvZOKAmTsKCkRHTUdSTD4gYWRkIGRhdGFiYXNlIOKAmHByb2RfZHLigJkgYXMgY29ubmVjdCBpZGVudGlmaWVyIGlzIOKAmHByb2RfZHLigJkgbWFpbnRhaW5lZCBhcyBwaHlzaWNhbDsKCkRHTUdSTD4gZW5hYmxlIGNvbmZpZ3VyYXRpb247CgogCgojIyMgdmFsaWRhcgoKREdNR1JMPiBzaG93IGNvbmZpZ3VyYXRpb247[/et_pb_dmb_code_snippet]
5) REALIZANDO UM SWITCHOVER
Um Switchover significa inverter os papeis em um ambiente de alta disponibilidade e Disaster Recovery configurado com o Dataguard. Nessa ação, o primário se tornará o novo Standby e o Standby atual se tornará o novo primário.
Passo1:Conectado no primário (via Broker), obter o nome da base de dados Standby:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”REdNR1JMPiBzaG93IGNvbmZpZ3VyYXRpb247″ hover_enabled=”0″]REdNR1JMPiBzaG93IGNvbmZpZ3VyYXRpb247[/et_pb_dmb_code_snippet]
Passo2:Conectado no primário (via Broker), executar o Switchover, apontando para o standby, que se tornará o novo primário:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”REdNR1JMPiBzd2l0Y2hvdmVyIHRvIHByb2RfZHI7″ hover_enabled=”0″]REdNR1JMPiBzd2l0Y2hvdmVyIHRvIHByb2RfZHI7[/et_pb_dmb_code_snippet]
6) REALIZANDO UM FAILOVER
Quando um failover é necessário, isso indica que o servidor primário foi perdido devido a alguma falha de hardware, de software ou um desastre no site principal. Com algum Standby sobrevivente, é possível retomar as atividades em com um curto período de downtime apenas.
Passo1:Conectado no Standby (via Broker), obter o nome da base de dados Standby:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”REdNR1JMPiBzaG93IGNvbmZpZ3VyYXRpb247″ hover_enabled=”0″]REdNR1JMPiBzaG93IGNvbmZpZ3VyYXRpb247[/et_pb_dmb_code_snippet]
Passo2:Conectado no Standby sobrevivente (via Broker), executar o Failover, apontando para o standby, que se tornará o novo primário:
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”REdNR1JMPiBmYWlsb3ZlciB0byBwcm9kX2RyOw==” hover_enabled=”0″]REdNR1JMPiBmYWlsb3ZlciB0byBwcm9kX2RyOw==[/et_pb_dmb_code_snippet]