`
wsql
  • 浏览: 12101483 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

Use Nid to Change dbname

阅读更多

原文链接:

http://www.eygle.com/faq/Use.Nid.to.Change.Your.dbname.htm


Nid是Oracle从9iR2开始提供的工具,可以用来更改数据库名称,而无需通过之前重建控制文件等繁琐方式.
需要说明的是,虽然这个工具来自9iR2,但是仍然可以被用于Oracle8i.

先看一下帮助:

C:\>nid -help
DBNEWID: Release 10.1.0.2.0 - Production
Copyright (c) 2001, 2004, Oracle.  All rights reserved.

关键字      说明                    (默认值)
----------------------------------------------------
TARGET      用户名/口令              (无)
DBNAME      新的数据库名             (无)
LOGFILE     输出日志                     (无)
REVERT      还原失败的更改            否
SETNAME     仅设置新的数据库名        否
APPEND      附加至输出日志            否
HELP        显示这些消息              否

                      

我们通过范例来看一下用法:

1.数据库当前设置

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE    9.2.0.1.0       Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      eyglev
global_names                         boolean     FALSE
instance_name                        string      eyglev
lock_name_space                      string
log_file_name_convert                string
oracle_trace_collection_name         string
oracle_trace_facility_name           string      oracled
plsql_native_make_file_name          string
service_names                        string      eyglev
					  

2.Shutdown数据库

SQL> connect sys/orasys as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

3.Startup mount

SQL> startup mount
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.

4. 使用NID更改

SQL> host
Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.

C:\>nid target=sys/orasys dbname=eyglen
DBNEWID: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

Connected to database EYGLEV (DBID=677189177)

Control Files in database:
    E:\ORACLE\ORADATA\EYGLEN\CONTROL01.CTL
    E:\ORACLE\ORADATA\EYGLEN\CONTROL02.CTL
    E:\ORACLE\ORADATA\EYGLEN\CONTROL03.CTL

Change database ID and database name EYGLEV to EYGLEN? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 677189177 to 3955758099
Changing database name from EYGLEV to EYGLEN
    Control File E:\ORACLE\ORADATA\EYGLEN\CONTROL01.CTL - modified
    Control File E:\ORACLE\ORADATA\EYGLEN\CONTROL02.CTL - modified
    Control File E:\ORACLE\ORADATA\EYGLEN\CONTROL03.CTL - modified
    Datafile E:\ORACLE\ORADATA\EYGLEN\SYSTEM01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\UNDOTBS01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\CWMLITE01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\DRSYS01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\INDX01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\ODM01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\TOOLS01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\USERS01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\XDB01.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\EYGLE.DBF - dbid changed, wrote new name
    Datafile E:\ORACLE\ORADATA\EYGLEN\TEMP01.DBF - dbid changed, wrote new name
    Control File E:\ORACLE\ORADATA\EYGLEN\CONTROL01.CTL - dbid changed, wrote new name
    Control File E:\ORACLE\ORADATA\EYGLEN\CONTROL02.CTL - dbid changed, wrote new name
    Control File E:\ORACLE\ORADATA\EYGLEN\CONTROL03.CTL - dbid changed, wrote new name

Database name changed to EYGLEN.
Modify parameter file and generate a new password file before restarting.
Database ID for database EYGLEN changed to 3955758099.
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.
						

5.Shutdown database

SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

6.修改初始化参数文件、spfile文件(init.ora/spfile)

###########################################
instance_name=eyglen
#instance_name=eyglev

###########################################
db_domain=""
db_name=eyglen
# db_name=eyglev
###########################################

7.重建spfile文件
如果你没有使用spfile,当然无需重建,跳至8

SQL> startup pfile=E:\Oracle\admin\eyglen\pfile\init.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
ORA-01991: invalid password file 'e:\oracle\Ora9iR2\DATABASE\PWDeyglen.ORA'


SQL> CREATE SPFILE='E:\Oracle\Ora9iR2\database\SPFILEEYGLEN.ORA' FROM
  2  PFILE='E:\Oracle\admin\eyglen\pfile\init.ora';

File created.
						

8.重建口令文件

SQL> host
Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.

C:\>orapwd file=E:\Oracle\Ora9iR2\database\PWDeyglen.ORA password=oracle entries=5

9.shutdown数据库
如果不使用spfile,则可以跳至10

SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

10.Startup mount,resetlogs打开

SQL> startup mount
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> alter database open resetlogs
  2  /

Database altered.

SQL>

11.修改后的参数

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      eyglen
global_names                         boolean     FALSE
instance_name                        string      eyglen
lock_name_space                      string
log_file_name_convert                string
oracle_trace_collection_name         string
oracle_trace_facility_name           string      oracled
plsql_native_make_file_name          string
service_names                        string      eyglen

12.对数据库做个全备份

附:使用nid更改817的数据库

1. 更改前

SVRMGR> startup mount
已启动 ORACLE 实例。
系统全局区域合计有                         61970460个字节
Fixed Size                                          75804个字节
Variable Size                                    17645568个字节
Database Buffers                                 44171264个字节
Redo Buffers                                        77824个字节
已装入数据库。
SVRMGR> show parameter name
NAME                                TYPE    VALUE
----------------------------------- ------- ------------------------------
db_file_name_convert                字符串
db_name                             字符串  vilen
global_names                        布尔值  TRUE
instance_name                       字符串  vilen
lock_name_space                     字符串
log_file_name_convert               字符串
oracle_trace_collection_name        字符串
oracle_trace_facility_name          字符串  oracled
service_names                       字符串  vilen
SVRMGR>

2. 修改

C:\>nid target=sys/orasys@vilen dbname=vilene
DBNEWID: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

Connected to database VILEN (DBID=1535443189)

Control Files in database:
    C:\ORACLE\ORADATA\VILEN\CONTROL01.CTL
    C:\ORACLE\ORADATA\VILEN\CONTROL02.CTL
    C:\ORACLE\ORADATA\VILEN\CONTROL03.CTL

Change database ID and database name VILEN to VILENE? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1535443189 to 681857412
Changing database name from VILEN to VILENE
    Control File C:\ORACLE\ORADATA\VILEN\CONTROL01.CTL - modified
    Control File C:\ORACLE\ORADATA\VILEN\CONTROL02.CTL - modified
    Control File C:\ORACLE\ORADATA\VILEN\CONTROL03.CTL - modified
    Datafile C:\ORACLE\ORADATA\VILEN\SYSTEM01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\RBS01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\USERS01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\TEMP01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\TOOLS01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\INDX01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\EQSP01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\VILEN\PERFSTAT.DBF - dbid changed, wrote new name
    Control File C:\ORACLE\ORADATA\VILEN\CONTROL01.CTL - dbid changed, wrote new name
    Control File C:\ORACLE\ORADATA\VILEN\CONTROL02.CTL - dbid changed, wrote new name
    Control File C:\ORACLE\ORADATA\VILEN\CONTROL03.CTL - dbid changed, wrote new name

Database name changed to VILENE.
Modify parameter file and generate a new password file before restarting.
Database ID for database VILENE changed to 681857412.
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.

3. 关闭数据库

SVRMGR> shutdown immediate
ORA-01109: 数据库未打开
已卸下数据库。
已关闭 ORACLE 实例。

4. 修改参数文件

db_name = "vilene"
#db_name = "vilen"

instance_name = vilene
#instance_name = vilen

5. 重建口令文件

C:\oracle\database>orapwd file=PWDvilen.ORA password=oracle entries=5

C:\oracle\database>

6. mount数据库

SVRMGR> startup mount
ORACLE instance started.
Total System Global Area                         61970460 bytes
Fixed Size                                          75804 bytes
Variable Size                                    17645568 bytes
Database Buffers                                 44171264 bytes
Redo Buffers                                        77824 bytes
Database mounted.

7. 打开数据库

SVRMGR> alter database open resetlogs
2> /
Statement processed.

8. 修改后的参数

SVRMGR> show parameter name
NAME                                TYPE    VALUE
----------------------------------- ------- ------------------------------
db_file_name_convert                string
db_name                             string  vilene
global_names                        boolean TRUE
instance_name                       string  vilene
lock_name_space                     string
log_file_name_convert               string
oracle_trace_collection_name        string
oracle_trace_facility_name          string  oracled
service_names                       string  vilen

分享到:
评论

相关推荐

    中国电信CDMA-全国SID_NID分配对应参照表

    ### 中国电信CDMA全国SID_NID分配对应参照表解析 #### 一、基础知识:SID与NID 在深入了解中国电信CDMA网络的SID_NID分配前,我们先来明确一下何为SID与NID。 **SID (System Identification)**:系统识别码,是...

    NID6002NT4G-VB一款N沟道TO252封装MOSFET应用分析

    N沟道,60V,18A,RDS(ON),73mΩ@10V,85mΩ@4.5V,20Vgs(±V);2Vth(V);TO252

    明纬电源NID30系列12.5~30W DC-DC非绝缘型单组输出转换器.PDF

    明纬电源NID30系列12.5~30W DC-DC非绝缘型单组输出转换器PDF,

    smith2016--Na-Ion Desalination (NID) Enabled by

    针对这一背景,本文提出了一项创新技术——钠离子脱盐(NID),并在《电化学学会期刊》上发表,旨在提供一种能耗更低、效率更高的脱盐解决方案。 钠离子脱盐(NID)技术的关键在于钠阻挡膜和对称钠嵌入多孔电极的...

    新型一体化脱硫技术--NID技术.docx

    NID技术,全称为No-Intermediate Drying,是一种由瑞典ABB公司开发的新型一体化脱硫技术,结合了干法和湿法脱硫的优点。这项技术主要用于处理含有硫氧化物(SOx)的烟气,尤其适用于垃圾焚烧、煤粉炉以及各种工业炉...

    NID - Network ID-开源

    **NID - 网络标识符:一种开源的个人信息组织工具** NID,全称为Network ID,是一个开源项目,旨在帮助用户在互联网上创建和管理个人信息的签名,实现信息的有效分组和检索。这一工具的核心理念是利用个性化的标签...

    Python库 | test_nid-1.0.0-py2-none-any.whl

    标题中的“Python库 | test_nid-1.0.0-py2-none-any.whl”表明这是一个名为`test_nid`的Python库,版本号为1.0.0。`.whl`文件是Python的Wheel格式,它是预编译的Python软件包,用于简化安装过程。这种格式使得开发者...

    Vcap2820 sdk摄像头SDK

    LONG APIENTRY devwdm_InitCard(int nID, HWND hWnd, int nWidth, int nHeight); /*devwdm_CloseCard: 函数功能: 关闭设备 nID: 设备ID号 */ LONG APIENTRY devwdm_CloseCard(int nID); /*devwdm_...

    Nonlinear interaction decomposition (NID)-A method for separation of cross-frequency coupled sources in human brain.pdf

    ### 非线性交互分解(NID):一种用于分离人脑内跨频率耦合源的方法 #### 概述 非线性交互分解(Nonlinear Interaction Decomposition, NID)是一种新近提出的用于检测磁脑电图(Magnetoencephalography, MEG)与...

    Oracle9个_name介绍

    - 使用`nid`工具进行更改。 - **限制**:在创建数据库时,`db_name`的长度被限制为最多8个字符,尽管在Oracle 10g中创建时不会出现错误提示,但实际存储的字符长度仍然会被截断。 - **用途**:`db_name`对于动态...

    Replacing "RICHEDIT" control with "RichEdit20A"

    The first thing to do it change the window class name of the rich edit controls from "RICHEDIT" to "RichEdit20A" in the *.rc file. Next, we create a class derived from CRichEditCtrl called ...

    NID6002NT4G的技术参数

    产品型号:NID6002NT4G源漏极间雪崩电压VBR(V):60源漏极最大导通电阻rDS(on)(mΩ):210最大漏极电流Id(on)(A):6.500通道极性:N沟道封装/温度(℃):DPAK 4/-55~150描述:65 V, 6.5 A, 带过温和过流保护,N沟道FET价格/1片...

    NID脱硫逻辑说明[参考].pdf

    《NID脱硫逻辑说明》涉及的是一个复杂的自动化控制系统,主要应用于燃煤发电厂的脱硫工艺,以确保环保标准的达成。系统通过一系列的逻辑条件和保护措施来控制设备的启停,保证脱硫过程的安全高效。 首先,系统的...

    好用的去噪代码matlab-NID:神经元图像降噪器

    NID:神经图像去噪器 一个使用经过训练的机器学习模型对嘈杂的神经图像进行去噪的软件包。 支持的模型总结如下: 名称 细节 Python Matlab的 nn 用于图像降噪的训练有素的神经网络[1] √ √ Python 在/ python /...

    NID9N05CLT4G的技术参数

    产品型号:NID9N05CLT4G源漏极间雪崩电压VBR(V):55源漏极最大导通电阻rDS(on)(mΩ):181最大漏极电流Id(on)(A):-通道极性:N沟道封装/温度(℃):DPAK/-55~175描述:9 A, 52带ESD保护功率MOSFET价格/1片(套):¥2.10 

    PyPI 官网下载 | test_nid-1.0.0-py2-none-any.whl

    资源来自pypi官网。 资源全名:test_nid-1.0.0-py2-none-any.whl

    明纬电源NID60系列20~60W DC-DC非绝缘型单组输出转换器.PDF

    明纬电源NID60系列20~60W DC-DC非绝缘型单组输出转换器PDF,

    vc++ADOX创建数据库

    // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CADOXCreateDatabaseDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void ...

    任务栏托盘弹出菜单 源码

    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, wc.hInstance, NULL); ShowWindow(hWnd, SW_HIDE); ``` 然后,我们使用`Shell_NotifyIcon`函数添加托盘图标,并设置其右键菜单。这...

Global site tag (gtag.js) - Google Analytics