parknkjun

Focus on Oralce Focus on Mysql 版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

  • 博客访问: 461047
  • 博文数量: 117
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-11 15:59
  • 认证徽章:
个人简介

姓名:江政恒 网络ID:parknkjun Oracle 10g OCM, Oracle 11g,12c OCP, OCMU成员, Oracle Young Expert 邮箱:parknkjun@163.com 电话:15502113137 QQ群:136904065

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类
文章存档

2017年(4)

2016年(24)

2015年(61)

2014年(27)

2013年(1)

我的朋友
微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题
更改数据库DBID 2015-09-13 16:58:21

分类: Oracle

当克隆一个数据库到另外一台机器上,具有相同的数据库名称或者如果一个新的数据库名称是通过重建的控制文件,
那么需要改变DBBID,特别是如果是新的数据库在相同的rman catalog是注册。
尤其是如果使用rman catalog,rman catalog中只允许注册一个DBID,相同DBID不能注册在同一catalog当中,下面演示改变DBID:
1、关闭数据库,启动到mount状态
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area  626327552 bytes
Fixed Size                  2230952 bytes
Variable Size             444597592 bytes
Database Buffers          176160768 bytes
Redo Buffers                3338240 bytes
Database mounted.
2、确认sys用户可以连接
[oracle@jzh5 ~]$ sqlplus sys/oracle@jzh as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 13 08:43:52 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3、更改DBID
[oracle@jzh5 ~]$ cd $ORACLE_HOME/bin
[oracle@jzh5 bin]$ ./nid target=sys/oracle@jzh
DBNEWID: Release 11.2.0.3.0 - Production on Sun Sep 13 08:45:08 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to database JZH (DBID=233255254)----当前数据库DBID
Connected to server version 11.2.0
Control Files in database:
    /u01/app/oracle/oradata/jzh/control01.ctl
    /u01/app/oracle/fast_recovery_area/jzh/control02.ctl
Change database ID of database JZH? (Y/[N]) => y----是否更改DBID,输入Y
Proceeding with operation
Changing database ID from 233255254 to 249044244 -----DBID从233255254更改为249044244 
    Control File /u01/app/oracle/oradata/jzh/control01.ctl - modified
    Control File /u01/app/oracle/fast_recovery_area/jzh/control02.ctl - modified
    Datafile /u01/app/oracle/oradata/jzh/system01.db - dbid changed
    Datafile /u01/app/oracle/oradata/jzh/sysaux01.db - dbid changed
    Datafile /u01/app/oracle/oradata/jzh/undotbs01.db - dbid changed
    Datafile /u01/app/oracle/oradata/jzh/users01.db - dbid changed
    Datafile /u01/app/oracle/oradata/jzh/test01.db - dbid changed
    Datafile /u01/app/oracle/oradata/jzh/temp01.db - dbid changed
    Control File /u01/app/oracle/oradata/jzh/control01.ctl - dbid changed
    Control File /u01/app/oracle/fast_recovery_area/jzh/control02.ctl - dbid changed
    Instance shut down
Database ID for database JZH changed to 249044244.
All previous backups and archived redo logs for this database are unusable.---以前的数据库与归档备份现在不可用
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.----数据库被shutdown,以resetlogs打开。
Succesfully changed database ID.
DBNEWID - Completed succesfully.
4、打开数据库
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area  626327552 bytes
Fixed Size                  2230952 bytes
Variable Size             444597592 bytes
Database Buffers          176160768 bytes
Redo Buffers                3338240 bytes
Database mounted.
SYS@jzh>alter database open resetlogs;
Database altered.
5、检查新的DBID
[oracle@jzh5 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Sun Sep 13 08:50:45 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: JZH (DBID=249044244)----新的DBID
由于更改DBID会导致以前的备份失效,因此在更改DBID时还需要慎重考虑。




阅读(1355) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册