Pessoal, abaixo uma atividade que executamos e achei interessante compartilhar:

Problema:

Criar uma forma de uma instância de catalogo fazer uma atualização em uma tabela de controle de um usuário de outra instância do mesmo ambiente. É um ambiente RAC com RMAN utilizando catalogo.

Solução:

Criar um database link entre o catalogo e a outra instância.

[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”Q29uZWN0YW5kbyBubyBjYXTDoWxvZ286CltvcmFjbGVAY2FwaW4wMSB+XSQgZXhwb3J0IE9SQUNMRV9TSUQ9SU5TVEFOQ0lBX0NBVEFMT0dPOwpbb3JhY2xlQGNhcGluMDEgfl0kIGVjaG8gJE9SQUNMRV9TSUQKSU5TVEFOQ0lBX0NBVEFMT0dPCltvcmFjbGVAY2FwaW4wMSB+XSQgc3FscGx1cyAvIGFzIHN5c2RiYQpDb25uZWN0ZWQgdG86Ck9yYWNsZSBEYXRhYmFzZSAxMGcgUmVsZWFzZSAxMC4yLjAuNC4wIOKAkyA2NGJpdCBQcm9kdWN0aW9uCldpdGggdGhlIFJlYWwgQXBwbGljYXRpb24gQ2x1c3RlcnMgb3B0aW9uCgpTUUw+IHNlbGVjdCBJTlNUQU5DRV9OQU1FIGZyb20gdiRpbnN0YW5jZTsKSU5TVEFOQ0VfTkFNRQrigJTigJTigJTigJTigJQtCklOU1RBTkNJQV9DQVRBTE9HTw==” hover_enabled=”0″]Q29uZWN0YW5kbyBubyBjYXTDoWxvZ286CltvcmFjbGVAY2FwaW4wMSB+XSQgZXhwb3J0IE9SQUNMRV9TSUQ9SU5TVEFOQ0lBX0NBVEFMT0dPOwpbb3JhY2xlQGNhcGluMDEgfl0kIGVjaG8gJE9SQUNMRV9TSUQKSU5TVEFOQ0lBX0NBVEFMT0dPCltvcmFjbGVAY2FwaW4wMSB+XSQgc3FscGx1cyAvIGFzIHN5c2RiYQpDb25uZWN0ZWQgdG86Ck9yYWNsZSBEYXRhYmFzZSAxMGcgUmVsZWFzZSAxMC4yLjAuNC4wIOKAkyA2NGJpdCBQcm9kdWN0aW9uCldpdGggdGhlIFJlYWwgQXBwbGljYXRpb24gQ2x1c3RlcnMgb3B0aW9uCgpTUUw+IHNlbGVjdCBJTlNUQU5DRV9OQU1FIGZyb20gdiRpbnN0YW5jZTsKSU5TVEFOQ0VfTkFNRQrigJTigJTigJTigJTigJQtCklOU1RBTkNJQV9DQVRBTE9HTw==[/et_pb_dmb_code_snippet]

Depois de conectados e garantirmos que estamos no CATALOGO criar o database link;

[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”Q3JpYXIgRGF0YWJhc2UgTGluazoKU1FMPgpjcmVhdGUgcHVibGljIGRhdGFiYXNlIGxpbmsgREJMX09VVFJBX0lOU1RBTkNJQSBjb25uZWN0IHRvIE9VVFJPX09XTkVSIGlkZW50aWZpZWQgYnkgU0VOSEFfT1VUUk9fT1dORVIgdXNpbmcgJ1NJRF9PVVRST19PV05FUic7″ hover_enabled=”0″]Q3JpYXIgRGF0YWJhc2UgTGluazoKU1FMPgpjcmVhdGUgcHVibGljIGRhdGFiYXNlIGxpbmsgREJMX09VVFJBX0lOU1RBTkNJQSBjb25uZWN0IHRvIE9VVFJPX09XTkVSIGlkZW50aWZpZWQgYnkgU0VOSEFfT1VUUk9fT1dORVIgdXNpbmcgJ1NJRF9PVVRST19PV05FUic7[/et_pb_dmb_code_snippet]

Obs.: Os ‘nomes em maiúsculos’ são alterados conforme a sua necessidade;

Criar um usuário para acessar via CATALOGO e fazer as alterações necessárias:

[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”U1FMPgpjcmVhdGUgdXNlciBVU1VBUklPX0NBVAppZGVudGlmaWVkIGJ5IFVTVUFSSU9fQ0FUCmRlZmF1bHQgdGFibGVzcGFjZSBVU0VSUwp0ZW1wb3JhcnkgdGFibGVzcGFjZSBURU1QClNRTD4KU1FMPiBncmFudCBjb25uZWN0IHRvIFVTVUFSSU9fQ0FUOw==” hover_enabled=”0″]U1FMPgpjcmVhdGUgdXNlciBVU1VBUklPX0NBVAppZGVudGlmaWVkIGJ5IFVTVUFSSU9fQ0FUCmRlZmF1bHQgdGFibGVzcGFjZSBVU0VSUwp0ZW1wb3JhcnkgdGFibGVzcGFjZSBURU1QClNRTD4KU1FMPiBncmFudCBjb25uZWN0IHRvIFVTVUFSSU9fQ0FUOw==[/et_pb_dmb_code_snippet]

Obs.: Ainda conectado com sysdba;

[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”VGVzdGUgRGF0YWJhc2UgTGluazoKU1FMPiBTZWxlY3QgKiBGcm9tIE9VVFJPX09XTkVSLlRhYmVsYV9Db250cm9sZUBEQkxfT1VUUkFfSU5TVEFOQ0lBOwoKVGVzdGUgVXBkYXRlOgpTUUw+ClVwZGF0ZSBPVVRST19PV05FUi5UYWJlbGFfQ29udHJvbGVAREJMX09VVFJBX0lOU1RBTkNJQQpTZXQgREFUQV9DT05UUk9MRSA9IFN5c2RhdGU=” hover_enabled=”0″]VGVzdGUgRGF0YWJhc2UgTGluazoKU1FMPiBTZWxlY3QgKiBGcm9tIE9VVFJPX09XTkVSLlRhYmVsYV9Db250cm9sZUBEQkxfT1VUUkFfSU5TVEFOQ0lBOwoKVGVzdGUgVXBkYXRlOgpTUUw+ClVwZGF0ZSBPVVRST19PV05FUi5UYWJlbGFfQ29udHJvbGVAREJMX09VVFJBX0lOU1RBTkNJQQpTZXQgREFUQV9DT05UUk9MRSA9IFN5c2RhdGU=[/et_pb_dmb_code_snippet]

Para facilitar um pouco o script que realiza todo o processo, ficou mais fácil criar um sinônimo para essa tabela.

[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”Q3JpYcOnw6NvIFNpbsO0bmltbzoKU1FMPiBDcmVhdGUgT3IgUmVwbGFjZSBTeW5vbnltIFVTVUFSSU9fQ0FULlRhYmVsYV9Db250cm9sZSBGb3IgT1VUUk9fT1dORVIuVGFiZWxhX0NvbnRyb2xlQERCTF9PVVRSQV9JTlNUQU5DSUE7CgpUZXN0ZSBjb25leMOjbyBzaW7DtG5pbW86ClNRTD4gU2VsZWN0ICogRnJvbSBVU1VBUklPX0NBVC5UYWJlbGFfQ29udHJvbGU7ClNRTD4gZXhpdAoKVGVzdGUgY29tIG8gdXN1w6FyaW8gcXVlIGlyw6EgcmVhbGl6YXIgYXMgYcOnw7VlczoKW29yYWNsZUBjYXBpbjAxIH5dJCBzcWxwbHVzIFVTVUFSSU9fQ0FUL1VTVUFSSU9fQ0FUClNRTD4gU2VsZWN0ICogRnJvbSBUYWJlbGFfQ29udHJvbGU7″ hover_enabled=”0″]Q3JpYcOnw6NvIFNpbsO0bmltbzoKU1FMPiBDcmVhdGUgT3IgUmVwbGFjZSBTeW5vbnltIFVTVUFSSU9fQ0FULlRhYmVsYV9Db250cm9sZSBGb3IgT1VUUk9fT1dORVIuVGFiZWxhX0NvbnRyb2xlQERCTF9PVVRSQV9JTlNUQU5DSUE7CgpUZXN0ZSBjb25leMOjbyBzaW7DtG5pbW86ClNRTD4gU2VsZWN0ICogRnJvbSBVU1VBUklPX0NBVC5UYWJlbGFfQ29udHJvbGU7ClNRTD4gZXhpdAoKVGVzdGUgY29tIG8gdXN1w6FyaW8gcXVlIGlyw6EgcmVhbGl6YXIgYXMgYcOnw7VlczoKW29yYWNsZUBjYXBpbjAxIH5dJCBzcWxwbHVzIFVTVUFSSU9fQ0FUL1VTVUFSSU9fQ0FUClNRTD4gU2VsZWN0ICogRnJvbSBUYWJlbGFfQ29udHJvbGU7[/et_pb_dmb_code_snippet]

O script vai fica mais simples com o sinônimo e vai executar essa ação em todas as instâncias e serviços do RAC que devem estar ativos.
Uma forma de receber via email/sms/sinal de fumaça e agir pró ativamente até antes mesmo do cliente perceber.

Espero ter colaborado.
Att,
capin