ITPub博客

首页 > 数据库 > Oracle > [20161214]如何确定dbid.txt

[20161214]如何确定dbid.txt

Oracle 作者:lfree 时间:2016-12-14 14:45:38 0 删除 编辑

[20161214]如何确定dbid.txt

--如何确定数据库的dbid,我曾经写过一篇blog,链接:http://blog.itpub.net/267265/viewspace-2125849/
--实际上还有1种非常武断的方法,直接使用strings扫sysaux表空间对应的数据文件,就可以知道:

例子如下:
SYS@book> @&r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SYS@book> column name format a40
SYS@book> select * from v$dbfile;
     FILE# NAME
---------- ----------------------------------------
         4 /mnt/ramdisk/book/users01.dbf
         3 /mnt/ramdisk/book/undotbs01.dbf
         2 /mnt/ramdisk/book/sysaux01.dbf
         1 /mnt/ramdisk/book/system01.dbf
         5 /mnt/ramdisk/book/example01.dbf

$ strings  /mnt/ramdisk/book/sysaux01.dbf | grep "database id"| head -10
ADDM:1337401710_1_59GADDM auto run: snapshots [58, 59],  instance 1,  database id 1337401710
ADDM:1337401710_1_58GADDM auto run: snapshots [57, 58],  instance 1,  database id 1337401710
ADDM:1337401710_1_58GADDM auto run: snapshots [57, 58],  instance 1,  database id 1337401710
ADDM:1337401710_1_58GADDM auto run: snapshots [57, 58],  instance 1,  database id 1337401710
ADDM:1337401710_1_46GADDM auto run: snapshots [45, 46],  instance 1,  database id 1337401710
ADDM:1337401710_1_46GADDM auto run: snapshots [45, 46],  instance 1,  database id 1337401710
ADDM:1337401710_1_46GADDM auto run: snapshots [45, 46],  instance 1,  database id 1337401710
ADDM:1337401710_1_45GADDM auto run: snapshots [44, 45],  instance 1,  database id 1337401710
ADDM:1337401710_1_45GADDM auto run: snapshots [44, 45],  instance 1,  database id 1337401710
ADDM:1337401710_1_45GADDM auto run: snapshots [44, 45],  instance 1,  database id 1337401710

SYS@book> select dbid from v$database;
      DBID
----------
1337401710

--说明正确.一般数据库不会保存别的机器的addm,awr信息.利用这个特点就很容易确定.

--实际上别人会问,我现在是要恢复数据库,数据文件在rman备份集里面.实际上如果你做过awr报表,保存这些报表里面就有.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2130571/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969378