Home  >  Article  >  Database  >  Oracle 10g中获取DBID

Oracle 10g中获取DBID

WBOY
WBOYOriginal
2016-06-07 17:05:411102browse

一般数据库能mount获取dbid比较容易C:\Users\Liangweigt;rman target /恢复管理器: Release 10.2.0.3.0 - Production on 星期五

一般数据库能mount获取dbid比较容易

C:\Users\Liangwei>rman target /

恢复管理器: Release 10.2.0.3.0 - Production on 星期五 10月 7 21:29:05 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

已连接到目标数据库: TEST (DBID=2061567322, 未打开)

SQL> select dbid from v$database;

      DBID
----------
2061567322

 

数据库不能mount的情况下获取dbid的方法

1.如果有AWR报告,从AWR报告中也可以获取DBID

WORKLOAD REPOSITORY report for

DB Name         DB Id           Instance     Inst Num  Release       RAC           Host
------------      -----------------   ------------    -------------   -----------       -------         ------------
TEST           2061567322    test                1              10.2.0.3.0     NO            SS-LIANGWEI

二、从备份文件中恢复控制文件后mount数据库

RMAN> restore controlfile from 'E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TEST\BACKUPSET\2011_10_
07\O1_MF_NCSNF_TAG20111007T172440_78XKDLGF_.BKP';

启动 restore 于 07-10月-11
使用通道 ORA_DISK_1

通道 ORA_DISK_1: 正在复原控制文件
通道 ORA_DISK_1: 恢复完成, 用时: 00:00:04
输出文件名=E:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\CONTROL01.CTL
输出文件名=E:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\CONTROL02.CTL
输出文件名=E:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\CONTROL03.CTL
完成 restore 于 07-10月-11

SQL> alter database mount;

数据库已更改。

C:\Users\Liangwei>rman target /

恢复管理器: Release 10.2.0.3.0 - Production on 星期五 10月 7 21:48:52 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

已连接到目标数据库: TEST (DBID=2061567322, 未打开)

三、设置错误的dbid在restore时RMAN会告诉你正确的DBID

C:\Users\Liangwei>rman target /

恢复管理器: Release 10.2.0.3.0 - Production on 星期五 10月 7 21:40:51 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

连接到目标数据库: test (未装载)

RMAN> set dbid=1234567890

正在执行命令: SET DBID

RMAN>  restore database;
启动 restore 于 07-10月-11
释放的通道: ORA_DISK_1
启动 implicit crosscheck backup 于 07-10月-11
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: restore 命令 (在 10/07/2011 21:42:50 上) 失败
RMAN-12010: 自动通道分配初始化失败
RMAN-06189: 当前 DBID 1234567890 与目标装载数据库 (2061567322) 不匹配

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn