How to Change the DBID and the DBNAME by using NID [ID 224266.1]

DiffusionDrive实战:如何用截断扩散模型3个月搞定自动驾驶轨迹规划(附代码) 本文详细介绍了如何利用DiffusionDrive截断扩散模型,在三个月内快速构建端到端的自动驾驶轨迹预测系统。内容涵盖从环境搭建、数据处理、模型架构解析到训练调参和推理优化的完整实战流程,并提供了关键代码示例,旨在帮助开发者高效实现高质量的自动驾驶轨迹规划。 阅读详情
How to Change the DBID and the DBNAME by using NID [ID 224266.1] 

 Modified 16-JUL-2009     Type PROBLEM     Status PUBLISHED 
Checked for relevance on 05-March-08


Introduction
============

The NID (New Database ID)is a new utility introduced with Oracle 9.2.  The NID
utility allows you to change only the DBNAME, or only the DBID or both 
DBNAME and DBID in the same command.

  1. If you change the DBID you must open the database with the RESETLOGS 
     option, which re-creates the online redo logs and resets their sequence
     to 1. 

  2. If you change the DBNAME without changing the DBID then this does not 
     require you to open with the RESETLOGS option, so database backups and
     archived logs are not invalidated.  You must change the DB_NAME initialization
     parameter after a database name change to reflect the new name.  Also, 
     you may have to re-create the Oracle password file.  If you restore an old
     backup of the control file (before the name change, then you should
     use the initialization parameter file and password file from before the 
     database name change.
 

Purpose
=======

It is useful to troubleshoot from the situation when duplicate database ID's
cause errors such as the following.

  RMAN-20002: target database already registered in recovery catalog 
       Cause: target database is already registered in the recovery catalog 
      Action: If the target database is really registered, there is no need to 
              register it again. Note that the recovery catalog enforces that 
              all databases have a unique DBID. If the new database was created
              by copying files from an existing database, it will have the same
              DBID as the original database and cannot be registered in the 
              same recovery catalog.

  RMAN-20011, 1, "target database incarnation is not current in recovery catalog"
  RMAN-20009, 1, "database incarnation already registered"

  -or-

  SQLPLUS> alter database mount standby database;
  alter database mount standby database
  *
  ORA-01102: cannot mount database in EXCLUSIVE mode


Restrictions and Usage Notes
============================

The DBNEWID utility has the following restrictions:

 - The utility is available only on the UNIX and Windows NT operating systems. 
 - The NID executable file should be owned and run by the Oracle owner because 
   it needs direct access to the datafiles and control files. 
 - If another user runs the utility, then set the user ID to the owner of the datafiles and control files. 
 - The DBNEWID utility must access the datafiles of the database directly through a local connection.
   Although DBNEWID can accept a net service name, it cannot change the DBID of a nonlocal database. 
 - To change the DBID of a database, the database must be mounted and must have been shut down consistently 
   prior to mounting. In the case of an Oracle Real Application Clusters database, the database must be
   mounted in NOPARALLEL mode. i.e set the init parameter CLUSTER_DATABASE=FALSE and then mount the database 
 - You must open the database with the RESETLOGS option after changing the DBID. 
 - Note that you do not have to open with the RESETLOGS option after changing only the database name. 
 - No other process should be running against the database when DBNEWID is executing. 
   If another session shuts down and starts the database, then DBNEWID aborts. 
 - All online datafiles should be consistent without needing recovery. 
 - Normal offline datafiles should be accessible and writable.
   If this is not the case, you must drop these files before invoking the DBNEWID utility. 
 - All read-only tablespaces must be accessible and made writable at the operating system level prior
   to invoking DBNEWID. If these tablespaces cannot be made writable (for example, they are on a CD-ROM),
   then you must unplug the tablespaces using the transportable tablespace feature and then plug them back
   in the database before invoking the DBNEWID utility (see the Oracle9i Database Administrator's Guide). 
 - You can only specify REVERT when changing only the DBID.
 

Change Only the DBID
====================

  1. Backup the database
  2. SHUTDOWN IMMEDIATE of the database
  3. STARTUP MOUNT
  4. Open one session and run NID with sysdba privileges
     % nid TARGET=SYS/password@test_db 
  5. Shutdown IMMEDIATE of the database
  6. Set the DB_NAME initialization parameter in the initialization parameter 
     file to the new database name 
  7. Create a new password file 
  8. Startup of the database with open resetlogs


Example:
========

1. C:/>set ORACLE_SID=TEST1BY
   C:/>sqlplus "/as sysdba"
   SQL*Plus: Release 9.2.0.1.0 - Production on Tue Dec 24 11:16:52 2002
   Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
   Connected to an idle instance.

   SQL> startup pfile=D:/oracle/admin/TEST1BY/pfile/initTEST1BY.ora
   ORACLE instance started.

   Total System Global Area  135338868 bytes
   Fixed Size                   453492 bytes
   Variable Size             109051904 bytes
   Database Buffers           25165824 bytes
   Redo Buffers                 667648 bytes
   Database mounted.
   Database opened.

2. check the DBID before change 

   SQL> select dbid,name,open_mode,activation#,created from v$database;

         DBID NAME      OPEN_MODE  ACTIVATION# CREATED
   ---------- --------- ---------- ----------- ---------
   1395399949 TEST1BY   READ WRITE  1395404134 10-SEP-02


3. SQL> shutdown immediate;
   Database closed.
   Database dismounted.
   ORACLE instance shut down.

4. SQL> startup mount pfile=D:/oracle/admin/TEST1BY/pfile/initTEST1BY.ora
   ORACLE instance started.

   Total System Global Area  135338868 bytes
   Fixed Size                   453492 bytes
   Variable Size             109051904 bytes
   Database Buffers           25165824 bytes
   Redo Buffers                 667648 bytes
   Database mounted.
   SQL>exit

5. execute NID

   C:/>nid target=sys/oracle@TEST1BY

   DBNEWID: Release 9.2.0.1.0 - Production
   Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

   Connected to database TEST1BY (DBID=1395399949)

   Control Files in database:
     D:/ORACLE/BASE_TEST/TEST1BYCONTROL01.CTL

   Change database ID of database TEST1BY? (Y/[N]) => y

   Proceeding with operation
   Changing database ID from 1395399949 to 1397190693
   Control File D:/ORACLE/BASE_TEST/TEST1BYCONTROL01.CTL - modified
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/SYSTEM01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/UNDOTBS01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/DRSYS01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/EXAMPLE01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/INDX01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/TOOLS01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/USERS01.DBF - dbid changed
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/XDB01.DBF - dbid changed
   Control File D:/ORACLE/BASE_TEST/TEST1BYCONTROL01.CTL - dbid changed

   Database ID for database TEST1BY changed to 1397190693.
   All previous backups and archived redo logs for this database are unusable.
   Shut down database and open with RESETLOGS option.
   Succesfully changed database ID.
   DBNEWID - Completed succesfully.

6. SQL> shutdown immediate;
   ORA-01109: database not open
   Database dismounted.
   ORACLE instance shut down.

7. create the new passwordfile

8. SQL> startup mount pfile=D:/oracle/admin/TEST1BY/pfile/initTEST1BY.ora
   ORACLE instance started.

   Total System Global Area  135338868 bytes
   Fixed Size                   453492 bytes
   Variable Size             109051904 bytes
   Database Buffers           25165824 bytes
   Redo Buffers                 667648 bytes
   Database mounted.

9. SQL> alter database open resetlogs;
   Database altered.

10. check the new DBID

    SQL> select dbid,name,open_mode,activation#,created from v$database;

          DBID NAME      OPEN_MODE  ACTIVATION# CREATED
    ---------- --------- ---------- ----------- ---------
    1397190693 TEST1BY   READ WRITE  1397188261 10-SEP-02


NOTE: The NID change the OLD DBID 1395399949 to the NEW DBID 1397190693
  
        
Change Only the DBNAME
======================

  1. Backup the database
  2. SHUTDOWN IMMEDIATE of the database
  3. STARTUP MOUNT
  4. Open one session and run NID with sysdba privileges
     % nid TARGET=SYS/password@test_db DBNAME=test_db2 SETNAME=Y
     - the value of DBNAME is the new dbname of the database
     - SETNAME must be set to Y. The default is N and causes the 
       DBID to be changed also.
  5. shutdown IMMEDIATE of the database
  6. Set the DB_NAME initialization parameter in the initialization parameter
     file to the new database name
  7. Create a new password file 
  8. Startup of the database(without resetlogs)
 
          
Change Both DBID and DBNAME
===========================

  1. Backup of the database. 
  2. Shutdown IMMEDIATE of the database
  3. STARTUP MOUNT
  4. Open one session and run NID with sysdba privileges
     % nid TARGET=SYS/password@test_db DBNAME=test_db2
     - the value of DBNAME is the new dbname of the database
  5. After DBNEWID successfully changes the DBID,Shutdown IMMEDIATE of the database 
  6. Set the DB_NAME initialization parameter in the
     initialization parameter file to the new database name. 
  7. Create a new password file. 
  8. Startup of the database with open resetlogs
  

Example:
========

1. Shutdown the databse

   SQL> shutdown immediate;
   Database closed.
   Database dismounted.
   ORACLE instance shut down.

2. Mount the database

   SQL> startup mount pfile=d:/oracle/admin/test1by/pfile/inittest1by.ora
   ORACLE instance started.

   Total System Global Area  135338868 bytes
   Fixed Size                   453492 bytes
   Variable Size             109051904 bytes
   Database Buffers           25165824 bytes
   Redo Buffers                 667648 bytes
   Database mounted.
   startup mount

3. Run NID utility

   C:/>nid target=sys/oracle@test1 dbname=test1by logfile=d:/oracle/base_test/nid.log
  
   DBNEWID: Release 9.2.0.1.0 - Production
   Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

   Connected to database TEST1 (DBID=849281895)

   Control Files in database:
     D:/ORACLE/BASE_TEST/TEST1BYCONTROL01.CTL

   Changing database ID from 849281895 to 1395399949
   Changing database name from TEST1 to TEST1BY
   Control File D:/ORACLE/BASE_TEST/TEST1BYCONTROL01.CTL - modified
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/SYSTEM01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/UNDOTBS01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/DRSYS01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/EXAMPLE01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/INDX01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/TOOLS01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/USERS01.DBF - dbid changed, wrote new name
   Datafile D:/ORACLE/BASE_TEST/TEST1BY/XDB01.DBF - dbid changed, wrote new name
   Control File D:/ORACLE/BASE_TEST/TEST1BYCONTROL01.CTL - dbid changed, wrote new name

   Database name changed to TEST1BY.
   Modify parameter file and generate a new password file before restarting.
   Database ID for database TEST1BY changed to 1395399949.
   All previous backups and archived redo logs for this database are unusable.
   Shut down database and open with RESETLOGS option.
   Succesfully changed database name and ID.
   DBNEWID - Completed succesfully.

4. Shutdown immediate of the database
 
5. Modfiy the file init.ora of the database
   change the parameter BD_NAME=TEST1 TO DBNAME=TEST1BY

6. create a new password file

   Usage: orapwd file=<fname> password=<password> entries=<users>
   where
    file - name of password file (mand),
    password - password for SYS (mand),
    entries - maximum number of distinct DBA and OPERs (opt),
   
7. mount the database

   SQL> startup mount pfile=d:/oracle/admin/test1by/pfile/inittest1by.ora
   ORACLE instance started.

   Total System Global Area  135338868 bytes
   Fixed Size                   453492 bytes
   Variable Size             109051904 bytes
   Database Buffers           25165824 bytes
   Redo Buffers                 667648 bytes
   Database mounted.

8. Open the databse with RESETLOGS
   SQL> alter database open resetlogs;
   Database altered.

9. check the dictionary view for the new DBID and DBNAME
   select dbid, name, open_mode, activation#, created from v$database;
 

Other Useful Information
========================

Except the parameters like LOGFILE=, APPEND, HELP, there is a specific option 
REVERT which allows us to go back on the steps of executing.  If the value of 
REVERT is YES that means that a failed change of DBID should be reverted but a 
successfully completed change of DBID cannot be reverted.  REVERT=YES is only 
valid when a DBID change failed.  Default value is NO.

In 10.2 and higher the database may automatically shut down after a change.
Do not be alarmed if this occurs.
 

Documentation
=============

Oracle9i Database Utilities Release 2 (9.2)
数据库课程案例——电力公司收费管理系统分析与实践,完整带SQL语句 某电力公司收费管理信息系统实现客户信息、用电类型(类别号、类别名、电价)及业务员管理;实现客户用电信息管理(客户号、月份、用电类别号、用电度数);实现客户费用管理(客户号、月份、费用、收费标志),收费标志的默认值为“未收”;实现收费登记(客户、月份、应收费用、实收费用、业务员),并自动修改收费标志(用触发器实现);创建触发器,实现收费时自动更加应收费用和实收费用,计算本次结余,然后修改客户信息表中的结余金额;创建存储过程统计指定月份应收费用和实收费用;创建存储过程查询指定月份未交费的用户信息,以便崔费;创建 阅读详情

相关推荐

vmware虚拟机网络连接问题

主机:ubuntu14.04 Vitual Network Editor

入门虽易,精通不易,且学且珍惜! 1354

Oracle 修改DB_NAME 和 DBID

<br /> <br />一. 相关概念<br /> <br />关于DB_NAME,INSTANCE_NAME 的定义,参考我的Blog:<br />       DBID,SID,DB_NAME,DB_DOMAIN,INSTANCE_NAME,DB_UNIQUE_NAME,SERVICE_NAMES 及监听参数的说明<br />       http://blog.csdn.net/tianlesoftware/archive/2010/12/20/6086066.aspx<br /> <br />关于

David Dai -- Focus on Oracle 8242

嵌入式开发实战:如何用cJSON库在STM32上实现轻量级JSON通信(附完整代码)

本文详细介绍了如何在STM32嵌入式系统中使用cJSON库实现高效的JSON通信方案。针对嵌入式环境的内存限制,提供了内存优化策略、cJSON库的深度定制方法以及完整的通信流程实现代码,帮助开发者解决JSON解析效率低下和跨平台兼容性等核心挑战。

star5的专栏 471

设置ODBC的自定义类CSetODBC

何志丹一,功能描述用于配置数据源用户名及密码.1,可以得到连接串,此串可用于CMyRecordset(派生于CRecordset)的GetDefaultConnect(),也可以用干CDataBase类OpenEx.2,如果用户配置正确,只需要配置一次,相关信息记录在文件.3,可以指定存储信息的文件名.因为有可能几个程序共用一个数据源.4,用户可以重新配置数据5,可以得到当前数据的类型.6

闻缺陷则喜何志丹 3115

AD7768与STM32F439的硬件设计避坑指南:如何优化高精度ADC系统的电源与PCB布局

本文详细解析了AD7768与STM32F439在高精度ADC系统硬件设计中的关键问题与优化方案。从电源系统设计、PCB布局到基准电压选型,提供了实用的避坑指南和实测数据,帮助工程师提升系统性能至110dB动态范围。特别强调了SPI信号布线和电源滤波对ADC精度的重要影响。

sugar的博客 735

7、基于机器学习的生产效率估计方法解析

本文探讨了基于机器学习的生产效率估计方法,重点介绍了效率分析树(EAT)和凸效率分析树(CEAT)算法的原理及其与传统自由处置壳(FDH)和数据包络分析(DEA)方法的对比。通过剪枝优化、生产可能性集构建及方向距离函数(DDF)估计,EAT和CEAT在避免过拟合、提升估计稳定性与处理凸性假设方面展现出优势。结合PISA教育数据的实证研究,采用箱线图、核密度图和非参数检验方法验证了不同模型效率得分分布的显著差异。研究表明,EAT与CEAT为生产效率评估提供了更准确、灵活的工具,适用于教育、企业生产和医疗等多个

milk5的博客 92

Oracle静默安装,含仅软件安装和数据库安装及常见报错处理方法DBT-10317 DBT-05509 [FATAL] ORA-03114

本文详解Oracle 19c单机版静默安装与数据库创建全流程,涵盖目录配置、响应文件编写、安装及建库命令,附常见报错(如DBT-10317、ORA-03114)解析与解决方案,包含删库指令与日志分析,适合内网环境自学实战,免费干货,实用性强。

qq_41474349的博客 177

华为OD机试新系统真题 【简单表达式计算】

华为OD机试 新系统真题【简单表达式计算】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【简单表达式计算】题解

qq_45776114的博客 675
上一篇: 浏览器对Jre的支持
下一篇: ERP 跨平台迁移
木划离
博客等级 码龄19年 27粉丝 112原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值