8. DBNEWID 工具(使用nid命令修改db name及dbid)
1、修改dbid及dbname的影响
a、修改dbid
b、只修改dbname
c、同时修改dbid及dbname
d、关于global_names
ALTER DATABASE RENAME GLOBAL_NAME TO sales.us.example.com
2、nid命令
[oracle@oracle1 ~]$ nid help=y
DBNEWID: Release 11.2.0.4. - Production on Sun Feb ::
Copyright (c) , , 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
3、修改步骤
a、全备数据库,如果是热备(rman or os)应确保所有的归档日志以及联机日志可用
nid target=sys/password # 此方式是仅仅修改dbid
nid target=/ dbname=new_dbname [setname=yes] # / 表明连接到当前环境的sid,且使用操作系统认证
nid target=sys/password dbname=new_dbname [setname=yes] # setname=yes 仅仅修改数据库名字,如果省略,则两者同时修改
nid target=sys/pwdd@conn_string dbname=new_dbname [setname=yes] # 使用连接串连接到远程主机并修改</span>
4、演示修改dbname
a. 启动到 Mount 状态
--查看当前数据库名
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string oracle1
db_unique_name string oracle1
global_names boolean FALSE
instance_name string oracle1
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string oracle1
--启动数据库到mount 状态
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 409194496 bytes
Fixed Size 2253744 bytes
Variable Size 314575952 bytes
Database Buffers 88080384 bytes
Redo Buffers 4284416 bytes
Database mounted.
SQL> select dbid,name,open_mode from v$database;
DBID NAME OPEN_MODE
---------- --------- --------------------
617378827 ORACLE1 MOUNTED
[oracle@oracle1 ~]$ nid target=/ dbname=orcl
DBNEWID: Release 11.2.0.4. - Production on Sun Feb ::
Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
Connected to database ORACLE1 (DBID=)
Connected to server version 11.2.
Control Files in database:
/u01/app/oracle/oradata/oracle1/control01.ctl
/u01/app/oracle/fast_recovery_area/oracle1/control02.ctl
Change database ID and database name ORACLE1 to ORCL? (Y/[N]) => y
Proceeding with operation
Changing database ID from to #DBID 变化
Changing database name from ORACLE1 to ORCL #DBNAME 变化
Control File /u01/app/oracle/oradata/oracle1/control01.ctl - modified #修改控制文件
Control File /u01/app/oracle/fast_recovery_area/oracle1/control02.ctl - modified
Datafile /u01/app/oracle/oradata/oracle1/system01.db - dbid changed, wrote new name #修改数据文件DBID/DBNAME
Datafile /u01/app/oracle/oradata/oracle1/sysaux01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/oracle1/undotbs01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/oracle1/users01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/oracle1/example01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/oracle1/t01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/oracle1/t16.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/oracle1/temp01.db - dbid changed, wrote new name
Control File /u01/app/oracle/oradata/oracle1/control01.ctl - dbid changed, wrote new name #修改控制文件DBID/DBNAME
Control File /u01/app/oracle/fast_recovery_area/oracle1/control02.ctl - dbid changed, wrote new name
Instance shut down #关闭实例
Database name changed to ORCL. #数据库名已变更为orcl
Modify parameter file and generate a new password file before restarting. #重启前请 修改参数文件,创建新密码文件
Database ID for database ORCL changed to . #DBID 已变更为
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. #数据库已关闭,请以Resetlogs方式打开
Succesfully changed database name and ID. #变更完成
DBNEWID - Completed succesfully.
[oracle@oracle1 ~]$ cd $ORACLE_HOME/dbs
[oracle@oracle1 dbs]$ orapwd help=y
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at command line,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only). There must be no spaces around the equal-to (=) character.
[oracle@oracle1 dbs]$ orapwd file=orapworcl password=oracle
[oracle@oracle1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4. Production on Sun Feb ::
Copyright (c) , , Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile;
File created.
SQL> quit
Disconnected
[oracle@oracle1 dbs]$ ls initoracle1.ora
initoracle1.ora
[oracle@oracle1 dbs]$ mv initoracle1.ora initorcl.ora
[oracle@oracle1 dbs]$ vi initorcl.ora #修改 pfile 中的db_name
*.db_name='orcl' # 修该 Pfile 文件中的db_name
[oracle@oracle1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4. Production on Sun Feb ::
Copyright (c) , , Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile; # 通过pfile 创建 spfile,然后通过spfile 启动
File created.
SQL> startup
ORACLE instance started.
Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted.
ORA-: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open RESETLOGS; #以 RestLogs 方式打开数据库
Database altered.
SQL> show parameter name #数据库名已变更
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string orcl
SQL> select dbid,name,open_mode from v$database;
DBID NAME OPEN_MODE
---------- --------- --------------------
ORCL READ WRITE
SQL> set line pages
SQL> col value for a80
SQL> col name for a30
SQL> select * from v$diag_info;
INST_ID NAME VALUE
---------- ------------------------------ --------------------------------------------------------------------------------
Diag Enabled TRUE
ADR Base /u01/app/oracle
ADR Home /u01/app/oracle/diag/rdbms/orcl/orcl
Diag Trace /u01/app/oracle/diag/rdbms/orcl/orcl/trace
Diag Alert /u01/app/oracle/diag/rdbms/orcl/orcl/alert
Diag Incident /u01/app/oracle/diag/rdbms/orcl/orcl/incident
Diag Cdump /u01/app/oracle/diag/rdbms/orcl/orcl/cdump
Health Monitor /u01/app/oracle/diag/rdbms/orcl/orcl/hm
Default Trace File /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_102730.trc
Active Problem Count
Active Incident Count
rows selected.
# ADR 在新的位置,其他的数据文件等位置都不变,之前的ADR,参数文件,密码文件 不会自动删除,需手工删除。
# 如果配置了静态监听,则需要修改监听文件指向新的数据库
# 如果配置了TNS 文件,同样需要修改
# 如果需要使用dbconsole,需重建
SQL> SELECT GROUP#,SEQUENCE#,ARCHIVED,STATUS FROM V$LOG;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
NO CURRENT # Sequence 重置为1
YES UNUSED # 在线重做日志重建,置于UNUSED状态。
YES UNUSED
8. DBNEWID 工具(使用nid命令修改db name及dbid)的更多相关文章
- 使用DBNEWID Utility 修改oracle数据库的 db name 和 dbid
使用DBNEWID Utility 工具可以同时修改数据库名.DBID,也可以只修改其中一项 官方参考: https://docs.oracle.com/cd/E11882_01/server.112 ...
- redis cluster集群管理工具redis-trib.rb命令小结-运维笔记
redis-trib.rb是redis官方推出的管理redis集群的工具,集成在redis的源码src目录下,是基于redis提供的集群命令封装成简单.便捷.实用的操作工具.redis-trib.rb ...
- Delphi 调用netsh命令修改IP地址
Delphi 调用netsh命令修改IP地址 先介绍一下Netsh命令的使用方法: 在这里跟大家介绍几个简单的指令 1.Show IP 1.1Cmd Mode 直接在cmd下面输入 netsh int ...
- linux:终端常用命令 + vi命令修改文件及保存 方法
首先介绍一下Ubuntu下各个目录的一般作用: / 这就是根目录,一台电脑有且只有一个根目录,所有的文件都是从这里开始的.举个例子:当你在终端里输入“/home”,你其实是在告诉电脑,先从/(根目录 ...
- Cordova - Windows版本图形界面管理工具,告别命令行输入方式!
Cordova本身提供的是命令行管理工具,并没有提供图形界面管理工具,虽然命令行管理工具可以完成所有Cordova管理,但是对于我这种懒蛋,可真不希望每次都输入命令,而且我更担心一旦输错一个字符,命令 ...
- AIX用chsec命令修改快捷修改配置文件
前言 AIX的所有配置设置通过一个命令来进行更改配置文件中的键-值对,以达到修改配置的目的.如:group/user/limits/passwd等等 命令格式 chsec [-f file] [-s ...
- Linux命令:修改文件权限命令chmod、chgrp、chown详解
Linux系统中的每个文件和目录都有访问许可权限,用它来确定谁可以通过何种方式对文件和目录进行访问和操作. 文件或目录的访问权 限分为只读,只写和可执行三种.以文件为例,只读权限表示只允许读其内容,而 ...
- Windows系统自带工具的 cmd 命令
目标 与计算机高手无关,只是为了减少鼠标点击的次数,提高效率. 适用范围 Windows XP,Windows 7,Window 8 (在Windows 7 下验证通过.) 使用方法 在 “运行“ 对 ...
- Oracle 10g -- 修改DB的编码
修改DB的原因是:因为我的DB不支持中文,所以每当我向数据库表中插入一条数据的时候,中文就都变了类似于“?(是反问号)”的乱码,为了能顺利插入成功,故做了此次修改; 系统:windows XP 英文版 ...
随机推荐
- 01.css选择器-->类选择器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Client tried to access password protected page without proper authorization (status code 401) 无法发布SceneService的解决方法
前不久,一客户反映原来已经部署好的WebGIS系统忽然无法正常运行了,具体配置如下: Portal for ArcGIS 10.5 ArcGIS Server 10.5 Web Adpator 10. ...
- C/C++遍历进程和进程ID的小工具
原文:http://blog.csdn.net/qq78442761/article/details/54646010 当我们写某些具有破坏性的程序时就需要对进程进行遍历和提取ID 对于上述功能,我们 ...
- windows php5.4,5.6,7.X添加redis扩展
首先下载php5.4对应版本的php_igbinary.dll,php_redis.dll扩展. 下载地址:http://download.csdn.net/detail/gejinbao357/ ...
- Linux内核 网络数据接收流程图
各层主要函数以及位置功能说明: 1)sock_read:初始化msghdr{}的结构类型变量msg,并且将需要接收的数据存放的地址传给msg.msg_iov->iov_base. ...
- Python套接字
1.客户端/服务器架构 什么是客户端/服务器架构?对于不同的人来说,它意味着不同的东西,这取决于你问谁以及描述的是软件还是硬件系统.在这两种情况中的任何一种下,前提都很简单:服务器就是一系列硬件或软件 ...
- POP动画[1]
POP动画[1] pop动画是facebook扩展CoreAnimation的,使用及其方便:) 1:Spring系列的弹簧效果(两个动画kPOPLayerBounds与kPOPLayerCorner ...
- 乘风破浪:LeetCode真题_019_Remove Nth Node From End of List
乘风破浪:LeetCode真题_019_Remove Nth Node From End of List 一.前言 这次总算到了链表的操作了,之后肯定会有排序算法,二叉树,排序树,图等等的操作,现在我 ...
- 读 CSI讲义 费马小定理
费马小定理 最近在上计算机安全学选修课.. 读老师博客..现在当是写阅读笔记吧. 这里贴出老师的简书建议先看看链接先..毕竟我这些东西只是搞笑一下的.. 遵循一下这个原则… 观察 找规律 求证 首先是 ...
- Ubuntu 12.04中MyEclipse 10.6+下载+安装+破解
至于MyEclipse在Ubuntu的安装教程网上很多,那我为什么我还写这篇文章呢?这次重装Ubuntu之后, 在安装MyEclipse 10.6过程中遇到了一个问题,所以把MyEclipse的安装方 ...