{"id":6020,"date":"2021-07-27T23:53:47","date_gmt":"2021-07-27T23:53:47","guid":{"rendered":"https:\/\/swiv.com.br\/considerations-about-database-dbid\/"},"modified":"2026-05-27T20:02:30","modified_gmt":"2026-05-27T19:02:30","slug":"considerations-about-database-dbid","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/07\/27\/considerations-about-database-dbid\/","title":{"rendered":"Considerations about Database DBID"},"content":{"rendered":"\n<p>Em alguns cen\u00e1rio de recupera\u00e7\u00e3o usando o RMAN, \u00e9 necess\u00e1rio definirmos o DBID do ambiente (por exemplo quando restauramos o SPFILE ou Control file), e esta pode ser uma tarefa complicada caso n\u00e3o tenhamos nenhum arquivo externo de log de backup dispon\u00edvel para consulta.<\/p>\n\n\n\n<p>O DBID \u00e9 exibido assim que conectamos no target database pelo RMAN, conforme exemplo abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel8 ~]$ rman target \/\n \nRecovery Manager: Release 18.0.0.0.0 - Production on Tue Jul 27 19:41:30 2021\nVersion 18.13.0.0.0\n \nCopyright (c) 1982, 2018, Oracle and\/or its affiliates.  All rights reserved.\n \nconnected to target database: RMANDB (DBID=3825250984)\n<\/pre><\/div>\n\n\n<p>Caso n\u00e3o tenhamos alterado a formata\u00e7\u00e3o do arquivo de backup do Control file, esse DBID tamb\u00e9m estar\u00e1 presente no backupset gerado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; SHOW CONTROLFILE AUTOBACKUP FORMAT;\n \nRMAN configuration parameters for database with db_unique_name RMANDB are:\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO &#039;%F&#039;; # default\n<\/pre><\/div>\n\n\n<p>Os detalhes est\u00e3o expostos na documenta\u00e7\u00e3o:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/swiv.com.br\/wp-content\/uploads\/2022\/07\/image-34-1-1024x130.png\" alt=\"\" class=\"wp-image-7477\"\/><figcaption>Fonte&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.oracle.com\/cd\/B14117_01\/server.101\/b10735\/setup.htm\" target=\"_blank\">AQUI<\/a><\/figcaption><\/figure>\n\n\n\n<p>Por\u00e9m percebo que a formata\u00e7\u00e3o do RMAN n\u00e3o est\u00e1 sendo aplicada, por conta da FRA que est\u00e1 configurada em meu ambiente:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; BACKUP CURRENT CONTROLFILE;\n \nStarting backup at 2021-07-27:20:17:46\nusing channel ORA_DISK_1\nchannel ORA_DISK_1: starting full datafile backup set\nchannel ORA_DISK_1: specifying datafile(s) in backup set\nincluding current control file in backup set\nchannel ORA_DISK_1: starting piece 1 at 2021-07-27:20:17:47\nchannel ORA_DISK_1: finished piece 1 at 2021-07-27:20:17:48\npiece handle=\/oracle\/fra\/RMANDB\/backupset\/2021_07_27\/o1_mf_ncnnf_TAG20210727T201746_jj150v6p_.bkp tag=TAG20210727T201746 comment=NONE\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01\nFinished backup at 2021-07-27:20:17:48\n \nStarting Control File and SPFILE Autobackup at 2021-07-27:20:17:48\npiece handle=\/oracle\/fra\/RMANDB\/autobackup\/2021_07_27\/o1_mf_s_1079036268_jj150wmp_.bkp comment=NONE\nFinished Control File and SPFILE Autobackup at 2021-07-27:20:17:49\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; sho parameter db_recovery_file_dest;\n \nNAME                                 TYPE        VALUE\n------------------------------------ ----------- ------------------------------\ndb_recovery_file_dest                string      \/oracle\/fra\ndb_recovery_file_dest_size           big integer 5G\n<\/pre><\/div>\n\n<p>E o Oracle Note &#8220;<strong>How To Determine The DBID When Using RMAN. (Doc ID 227060.1)<\/strong>&#8221; (link <a rel=\"\\&quot;noreferrer noopener\" noopener=\"\" href=\"\/\/support.oracle.com\/epmos\/faces\/DocumentDisplay?_afrLoop=241746620730388&amp;id=227060.1&amp;displayIndex=3&amp;_afrWindowMode=0&amp;_adf.ctrl-state=1auffmmkqb_166\\&quot;\" target=\"\\&quot;_blank\\&quot;\">AQUI<\/a>) explica o motivo do DBID n\u00e3o ser exposto no arquivo de autobackup quando a FRA \u00e9 usada:<\/p>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/swiv.com.br\/wp-content\/uploads\/2022\/07\/image-35-1-1024x148.png\" alt=\"\" class=\"wp-image-7478\"\/><\/figure>\n\n\n\n<p>Outros m\u00e9todos poss\u00edveis de pegar o DBID do nosso ambiente de acordo com a pr\u00f3pria nota:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; SELECT dbid FROM v$database;\n\n      DBID\n----------\n3825250984\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; list incarnation;\n \n \nList of Database Incarnations\nDB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time\n------- ------- -------- ---------------- --- ---------- ----------\n1       1       RMANDB   3825250984       PARENT  1          2018-02-07:19:20:08\n2       2       RMANDB   3825250984       PARENT  1477662    2020-04-05:21:44:14\n3       3       RMANDB   3825250984       CURRENT 3489797    2021-07-23:21:04:57\n<\/pre><\/div>\n\n\n<p>E em caso extremo, podemos usar o comando de S.O abaixo para buscar a informa\u00e7\u00e3o nos datafiles da SYSTEM\/SYSAUX ou UNDO:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel8 2021_07_27]$ strings \/oracle\/RESTORE\/undo.tbs | grep MAXVALUE | sort | uniq\n3825250984, MAXVALUE\n3825250984, MAXVALUE\nJ03825250984, MAXVALUE\nU3825250984, MAXVALUE\n \n...\n \n&#x5B;oracle@oel8 2021_07_27]$ strings \/oracle\/RESTORE\/sysaux.dbf | grep MAXVALUE | sort | uniq\n#3825250984, MAXVALUE\n3825250984, MAXVALUE\n \n...\n \n&#x5B;oracle@oel8 2021_07_27]$ strings \/oracle\/RESTORE\/system.dbf | grep MAXVALUE | sort | uniq\n1201448, MAXVALUE,\n1201448, MAXVALUE&amp;lt;\n3825250984, MAXVALUE\n3825250984, MAXVALUE\n3825250984, MAXVALUE,\n<\/pre><\/div>\n\n\n<p>Obs: Ap\u00f3s essa opera\u00e7\u00e3o, fiz o validate do banco de dados e observei o Alert.log e n\u00e3o foi reportado nenhum problema.<\/p>\n\n\n\n<p>Uma vez de posse do DBID, \u00e9 indicado salv\u00e1-lo em um arquivo externo que fique dispon\u00edvel para uso (em uma \u00e1rea que tenha backup). Pode haver o dia de voc\u00ea precisar deste DBID para recuperar o ambiente (espero que n\u00e3o precise, mas DBA desprevinido n\u00e3o \u00e9 DBA). Segue um exemplo bem simples, que pode ser aperfei\u00e7oado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel8 trace]$ echo &quot;3825250984&quot; &gt; \/home\/oracle\/RMANDB_DBID.log\n&#x5B;oracle@oel8 trace]$ cat \/home\/oracle\/RMANDB_DBID.log\n3825250984\n<\/pre><\/div>\n\n\n<p> Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laborat\u00f3rio pessoal para fins de aprendizado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Em alguns cen\u00e1rio de recupera\u00e7\u00e3o usando o RMAN, \u00e9 necess\u00e1rio definirmos o DBID do ambiente (por exemplo quando restauramos o SPFILE ou Control file), e esta pode ser uma tarefa complicada caso n\u00e3o tenhamos nenhum arquivo externo de log de backup dispon\u00edvel para consulta. O DBID \u00e9 exibido assim que conectamos no target database pelo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-6020","post","type-post","status-publish","format-standard","hentry","category-backup-recovery"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=6020"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6020\/revisions"}],"predecessor-version":[{"id":9071,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6020\/revisions\/9071"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=6020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=6020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=6020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}