oracle nid修改dbname
修改name的目的只是为了日后管理清晰点,不重复。我比较懒、记性又差,所以就整理记下
1、检查当前name
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string test141
db_unique_name string test141
global_names boolean FALSE
instance_name string test141
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string test141
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
4003894062 TEST141
2、检查监听
[oracle@DBDATA ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-9月 -2017 19:23:58
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.5.233)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 01-9月 -2017 23:46:38
Uptime 2 days 19 hr. 37 min. 20 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/db/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.5.233)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "test141" has 1 instance(s).
Instance "test141", status READY, has 1 handler(s) for this service...
The command completed successfully
--上面的检查其实都可以省略
--开始nid修改name
大致步骤:关闭DB、mount DB、nid dbname、修改init*.ora、修改环境变量并open DB、重建(s)pfile、修改tnsname.ora和listener.ora中对应名字并启动
关闭DB之前必须要知道sys密码,不知道的话就改下
SQL> alter user sys identified by qwer1234;
User altered.
1、关闭数据库,启动至mount模式
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT
ORACLE instance started.
Total System Global Area 2087780352 bytes
Fixed Size 2229944 bytes
Variable Size 687868232 bytes
Database Buffers 1392508928 bytes
Redo Buffers 5173248 bytes
Database mounted.
2、NI修改DB_NAME
[oracle@DBDATA admin]$ nid target=sys/qwer1234 dbname=test233
DBNEWID: Release 11.2.0.3.0 - Production on 星期一 9月 4 19:26:25 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database TEST141 (DBID=4003894062)
Connected to server version 11.2.0
Control Files in database:
/u01/app/oracle/oradata/dbdata/control01.ctl
/u01/app/oracle/fast_recovery_area/dbdata/control02.ctl
Change database ID and database name TEST141 to TEST233? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 4003894062 to 3120964513
Changing database name from TEST141 to TEST233
Control File /u01/app/oracle/oradata/dbdata/control01.ctl - modified
Control File /u01/app/oracle/fast_recovery_area/dbdata/control02.ctl - modified
Datafile /u01/app/oracle/oradata/dbdata/system01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/sysaux01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/undotbs01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/users01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_member.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_member.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_account.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_account.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_sysdb.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_sysdb.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_risk.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_risk.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_tppaml.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_tppaml.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_test.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/DAT_MS_ORDERS.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/pftp01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_cashreserve_01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_orders.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_orders.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/DAT_SSCARD.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/IDX_SSCARD.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/DAT_GDXT.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/IDX_GDXT.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/DAT_DINPAYPOS.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/IDX_DINPAYPOS.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/DAT_ERCON.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/IDX_ERCON.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/dat_bill01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/idx_bill01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/temp01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata/dbdata/TEMP_PFPT.db - dbid changed, wrote new name
Control File /u01/app/oracle/oradata/dbdata/control01.ctl - dbid changed, wrote new name
Control File /u01/app/oracle/fast_recovery_area/dbdata/control02.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to TEST233.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST233 changed to 3120964513.
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.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
3、修改参数文件
cd $ORACLE_HOME/dbs/init***.ora
vi /u01/app/oracle/product/11.2.0/db/dbs/inittest141.ora
#*.db_name='test141' 注释了
*.db_name='test233' 新增为想要修改的名字
vi .bash_profile
#export ORACLE_HOSTNAME=test141
export ORACLE_HOSTNAME=test233
#export ORACLE_SID=test141
export ORACLE_SID=test233
#export ORACLE_UNQNAME=test141
export ORACLE_UNQNAME=test233
4、重新生效环境变量,并启动数据库
[oracle@DBDATA ~]$ source .bash_profile
[oracle@DBDATA ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 星期一 9月 4 19:33:40 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile ='/u01/app/oracle/product/11.2.0/db/dbs/inittest141.ora';
ORACLE instance started.
Total System Global Area 2087780352 bytes
Fixed Size 2229944 bytes
Variable Size 486541640 bytes
Database Buffers 1593835520 bytes
Redo Buffers 5173248 bytes
Database mounted.
ORA-01589: 要打开数据库则必须使用 RESETLOGS 或 NORESETLOGS 选项
SQL> alter database open resetlogs;
Database altered.
5、重新生成pfile文件
SQL> create spfile from pfile='/u01/app/oracle/product/11.2.0/db/dbs/inittest141.ora';
File created.
Elapsed: 00:00:00.06
SQL> create pfile from spfile;
File created.
6、修改监听配置
cd $ORACLE_HOME/network/admin
vi tnsname.ora
test233 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.233)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
#(SERVICE_NAME = test141)
(SERVICE_NAME = test233)
)
)
vi listener.ora
有SERVICE_NAME的话也修改为test233
重新加载或启动
[oracle@DBDATA admin]$ lsnrctl reload/start
oracle nid修改dbname的更多相关文章
- Oracle NID工具修改数据库DBID、数据库名称、数据库实例名
DBID是数据库的唯一标识符,在一些特殊场合会涉及到DBID的相关内容,本篇文章的目的是演示将DB_NAME的值从ORCL修改为ORCL1. 一.查看当前的环境 [oracle@oracledb ad ...
- Oracle 增加修改删除字段
Oracle 增加修改删除字段 添加字段的语法:alter table tablename add (column datatype [default value][null/not null],…. ...
- Oracle 批量修改字段长度
Oracle 批量修改字段长度 SELECT 'alter table '||a.table_name||' MODIFY '||A.COLUMN_NAME||' VARCHAR2(100);' ...
- Oracle参数修改是否需要重启等
Oracle参数修改小结Oracle中有些参数是可以在session级别修改,有些则必须在system级别修改,有些参数不需要重启就能马上生效,有些参数必须重启才能生效,那么如何知道这些信息呢?可以从 ...
- 安装Oracle后修改IP总结(转载)
转载自:http://blog.csdn.net/bleibo/article/details/5447198 安装Oracle后修改IP总结(转载) 针对ORACLE 10G 在安装完后,修改IP ...
- oracle手动修改listener.ora和tnsnames.ora之后竟然无效
oracle手动修改listener.ora和tnsnames.ora之后竟然无效 花式重启都没有生效,需要使用Net Configuration Assistant来进行刷一下,重新生成的监听还是一 ...
- Oracle删除修改字段
Oracle 增加修改删除字段 添加字段的语法:alter table tablename add (column datatype [default value][null/not null],…. ...
- oracle rac 修改dbid和dbname
=======================修改数据库dbid====================== 1.查看目前数据库dbid以及dbname [root@rac01 ~]# su - or ...
- Oracle 使用Nid 修改数据库的DBID 和 Database Name
How to Change the DBID, DBNAME Using NID Utility (Doc ID 863800.1) Changing the DBID and Database Na ...
随机推荐
- jms中activemq事务探讨
http://blog.csdn.net/dly1580854879/article/details/68945997
- golang项目中使用条件编译
golang项目中使用条件编译 C语言中的条件编译 golang中没有类似C语言中条件编译的写法,比如在C代码中可以使用如下语法做一些条件编译,结合宏定义来使用可以实现诸如按需编译release和de ...
- Python基本类常用方法
数学函数 abs(x) 返回数字的绝对值,如abs(-10) 返回 10 ceil(x) 返回数字的上入整数,如math.ceil(4.1) 返回 5 cmp(x, y)如果 x < y 返回 ...
- 俗话:MySQL索引
MySQL凭借着出色的性能.低廉的成本.丰富的资源,已经成为绝大多数互联网公司的首选关系型数据库.虽然性能出色,但所谓“好马配好鞍”,如何能够更好的使用它,已经成为开发工程师的必修课,我们经常会从职位 ...
- Windows上使用Git托管代码到Coding
作者:荒原之梦 Git简介: Git是一款分布式版本控制系统,可用于项目的版本管理.Git可以管理本地代码仓库与远程代码仓库间的连接以及进行版本控制,使得我们可以在本地离线进行修改等操作,之后再将代码 ...
- SQL查询中用到的函数
数据库表 students id name sex age address 101 张汉 男 14 杭州 102 欧阳钦 男 13 杭州 103 吴昊 男 14 北京 104 钱进进 男 ...
- 今天读一读七天学会NodeJS
七天学会NODEJS NodeJS基础 小结 本章介绍了有关NodeJS的基本概念和使用方法,总结起来有以下知识点: NodeJS是一个JS脚本解析器,任何操作系统下安装NodeJS本质上做的事情都是 ...
- javascript执行上的一点总结
今天在为软件工程的的作业准备的时候发现代码执行上的一些问题,暴露了我的一些缺陷,先上代码 <html> <head> <script type="text/ja ...
- ASP.Net MVC 在控制器中获取View中的form表单值的方法
在网站开发中,我们常常需要用到表单提交的方式,那么在MVC中是如何获取到表单中的数据呢?下面我们来介绍以下几种方式 首先我们先看看View前台页面 添加一个控制器 我们再看看前台页面的代码 @{ La ...
- IE下获取XPATH小工具,支持32/64位
背景是曾经友情支持了测试组一小段时间,发现他们使用selenium做页面的自动化测试,需要用到XPath,但IE下没有获取XPath的工具,只能在Firefox和chrome下获取,步骤还比较麻烦.而 ...