使用DBNEWID Utility 工具可以同时修改数据库名、DBID,也可以只修改其中一项

官方参考:

https://docs.oracle.com/cd/E11882_01/server.112/e22490/dbnewid.htm#SUTIL014

一、同时修改db name 和 dbid  (本例:emdb -> mydb)

1.修改之前建议给数据库做个全备。

2.干净关闭数据库,并重启到mount状态

shutdown immediate;

startup mount;

3.开始使用nid 工具修改数据库名和dbid

[oracle@Database ~]$ which nid
/u01/app/oracle/product/11.2.0.4/db_1/bin/nid

查看命令帮助:

[oracle@Database ~]$ nid -help

DBNEWID: Release 11.2.0.4.0 - Production on Tue Jun 5 15:03:50 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Keyword      Description                     (Default)
---------------------------------------------------------
TARGET    Username/Password         (NONE)
DBNAME    New database name         (NONE)
LOGFILE   Output Log                        (NONE)
REVERT    Revert failed change         NO
SETNAME Set a new database name only NO
APPEND    Append to output log          NO
HELP         Displays these messages   NO

[oracle@Database ~]$ nid target=sys dbname=mydb

DBNEWID: Release 11.2.0.4.0 - Production on Tue Jun 5 15:04:37 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Password:
Connected to database EMDB (DBID=2097101097)

Connected to server version 11.2.0

Control Files in database:
/u01/app/oracle/oradata/emdb/control01.ctl
/u01/app/oracle/oradata/emdb/control02.ctl

Change database ID and database name EMDB to MYDB? (Y/[N]) => y

Proceeding with operation
Changing database ID from 2097101097 to 2892995079
Changing database name from EMDB to MYDB
Control File /u01/app/oracle/oradata/emdb/control01.ctl - modified
Control File /u01/app/oracle/oradata/emdb/control02.ctl - modified
Datafile /u01/app/oracle/oradata/emdb/system01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/sysaux01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/undotbs01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/users01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/mgmt_ecm_depot1.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/mgmt.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/mgmt_deepdive.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/emdb/temp01.db - dbid changed, wrote new name
Control File /u01/app/oracle/oradata/emdb/control01.ctl - dbid changed, wrote new name
Control File /u01/app/oracle/oradata/emdb/control02.ctl - dbid changed, wrote new name
Instance shut down

Database name changed to MYDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database MYDB changed to 2892995079.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

4.最后修改参数文件中的db_name

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1853947904 bytes
Fixed Size 2254264 bytes
Variable Size 939526728 bytes
Database Buffers 905969664 bytes
Redo Buffers 6197248 bytes
SQL> alter system set db_name='mydb' scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01507: database not mounted

ORACLE instance shut down.

5. 以resetlogs方式打开数据库

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1853947904 bytes
Fixed Size 2254264 bytes
Variable Size 939526728 bytes
Database Buffers 905969664 bytes
Redo Buffers 6197248 bytes
Database mounted.

SQL> alter database open resetlogs;

二、只修改dbid (在使用nid 命令不加dbname参数即可)

[oracle@Database ~]$ nid target=sys dbname=mydb

三、只修改dbname  (在nid 命令中 加上 SETNAME=YES 选项,表示只修改数据库名称)

[oracle@Database ~]$ nid target=sys dbname=mydb SETNAME=YES

												

使用DBNEWID Utility 修改oracle数据库的 db name 和 dbid的更多相关文章

  1. Oracle 修改oracle数据库名

    Oracle 修改oracle数据库名 by:授客 QQ:1033553122 1.确保你有个可用于数据库恢复的,完整的数据库备份 2.确保数据库处于mount,非open状态,并且在加载前先以imm ...

  2. 修改oracle数据库内存报错

    今天修改oracle数据库内存时, alter system set memory_max_target=10240M scope=spfile;语句正确修改:但重启时却报错 : SQL> al ...

  3. 修改oracle数据库的编码为utf-8

    1.查看数据库字符集 ? 数据库服务器字符集select * from nls_database_parameters,其来源于props$,是表示数据库的字符集. 客户端字符集环境select * ...

  4. 修改oracle数据库时间

    1.修改前需要先停止 oracle 数据库服务 2.修改 oracle 数据库所在的服务器时间 3.再次启动 oracle 数据库,即可 以上就是小编修改 oracle 数据库的时间,修改完之后,其他 ...

  5. 如何修改oracle数据库用户密码过期策略

    转至:https://www.cnblogs.com/zhangshuaihui/p/11451590.html 1.   查询数据库用户何时过期 登陆数据库PL/SQL工具,输入以下sql语句: s ...

  6. 修改Oracle数据库的字符集为UTF-8

    1.改客户端字符集:通过WINDOWS的运行菜单运行Regedit,修改注册表 Start -> Run -> Rededit <-| Under registry Editor - ...

  7. 修改oracle数据库密码

    1.用Xshell远程连接安装数据库的服务器,切换到安装oracle数据库的用户下,(我的oracle数据库就安装在oracle用户下) 命令: su - oracle; 2.进入oracle控制台 ...

  8. Linux下修改Oracle数据库字符集命令

    常见情形:从服务器备份Oracle数据库后再到本地机器上还原Oracle数据库的时候经常会碰见数据库字符编码不一致的情况,可以用以下命令来修改本地的Oracle数据库字符编码,然后顺利还原Oracle ...

  9. 修改oracle数据库默认时间格式

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://ccchencheng.blog.51cto.com/2419062/929695 ...

随机推荐

  1. JavaScript周报#184

    This week’s JavaScript news Read this issue on the Web | Issue Archive JavaScript Weekly Issue 184Ju ...

  2. Android 图片缩略图显示

    //通过openRawResource获取一个inputStream对象 InputStream inputStream = getResources().openRawResource(R.draw ...

  3. EF6 code first 新建项目注意问题

    1.一开始就建立自动迁移模式 打开Package Manager Console,确保Package source是nuget.org 命令行输入: enable-migrations 然后第一次运行 ...

  4. MySQL复制报错(Slave failed to initialize relay log info structure from the repository)

    机器重启以后,主从出现了问题,具体报错信息: Slave failed to initialize relay log info structure from the repository 解决方案: ...

  5. 使用dsoframer控件出现"Unable to display the inactive document. Click here to reactivate the document."的问题 .

    使用如下属性设置: axFramerControl.ActivationPolicy = DSOFramer.dsoActivationPolicy.dsoKeepUIActiveOnAppDeact ...

  6. DOM介绍

    什么是DOM DOM:文档对象模型.DOM 为文档提供了结构化表示,并定义了如何通过脚本来访问文档结构.目的其实就是为了能让js操作html元素而制定的一个规范. DOM就是由节点组成的. 解析过程 ...

  7. iso、ios、osi的区别

    ISO  国际标准化组织(International Organization for Standardization)简称ISO,是一个全球性的非政府组织,是国际标准化领域中一个十分重要的组织.IS ...

  8. ThreadState属性

    这个属性代表了线程运行时状态,在不同的情况下有不同的值,我们有时候可以通过对该值的判断来设计程序流程. ThreadState 属性的取值如下: Aborted:线程已停止: AbortRequest ...

  9. (MUA)mutt-"No authenticators available" 发送不出去邮件

    问题: 使用mutt发送邮件的时候,在调试模式下总是显示"No authenticators available", 后来在google上查到可能要设置验证方法gssapi,但是设 ...

  10. join语句中on条件与where条件的区别

    大纲:on是在生成连接表的起作用,where是生成连接表之后对连接表再进行过滤 当使用left join时,无论on的条件是否满足,都会返回左表的所有记录,对于满足的条件的记录,两个表对应的记录会连接 ...