[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报表,保存这些报表里面就有.