中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 数据库开发 > 数据库综合
9I中如何修改Ddid和Dbname方法测试小结
作者:未知 时间:2004-10-08 12:12 出处:Blog 责编:chinaitpower
              摘要:暂无
测试环境:Windows2000 + Oracle 9.2.0.1
具体操作如下:
一、NID工具使用:(oracle工具,数据库安装完成后,就自动安装了),具体用法如看;
C:\>nid
DBNEWID: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  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

用法举例:
Changing Only the DBID
The following example connects with operating system authentication and changes only the DBID:

% nid TARGET=/

Changing the DBID and Database Name
The following example connects as user SYS and changes the DBID and also changes the database name to test2:

% nid TARGET=SYS/oracle@test1 DBNAME=test2

Changing Only the Database Name
The following example connects as user SYSTEM and changes only the database name, and also specifies a log file for the output:

% nid TARGET=SYSTEM/manager@test2 DBNAME=test3 SETNAME=YES LOGFILE=dbid.out

二、修改步骤如下:

1)、SQL> conn sys/admin@test as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area  101784276 bytes
Fixed Size                   453332 bytes
Variable Size              75497472 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> host nid target=sys/admin@test dbname=testdb
DBNEWID: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

Connected to database TEST (DBID=1835076349)

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

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

Proceeding with operation
Changing database ID from 1835076349 to 2321050327
Changing database name from TEST to TESTDB
    Control File C:\ORACLE\ORADATA\TEST\CONTROL01.CTL - modified
    Control File C:\ORACLE\ORADATA\TEST\CONTROL02.CTL - modified
    Control File C:\ORACLE\ORADATA\TEST\CONTROL03.CTL - modified
    Datafile C:\ORACLE\ORADATA\TEST\SYSTEM01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\TEST\UNDOTBS01.DBF - dbid changed, wrote new nam

    Datafile C:\ORACLE\ORADATA\TEST\INDX01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\TEST\TOOLS01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\TEST\USERS01.DBF - dbid changed, wrote new name
    Datafile D:\DATAFILE\PORMALS_SPA.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\TEST\OEM_REPOSITORY.DBF - dbid changed, wrote ne
name
    Datafile D:\DATAFILE\PORMALS_SPA_01.DBF - dbid changed, wrote new name
    Datafile C:\ORACLE\ORADATA\TEST\TEMP01.DBF - dbid changed, wrote new name
    Control File C:\ORACLE\ORADATA\TEST\CONTROL01.CTL - dbid changed, wrote new
name
    Control File C:\ORACLE\ORADATA\TEST\CONTROL02.CTL - dbid changed, wrote new
name
    Control File C:\ORACLE\ORADATA\TEST\CONTROL03.CTL - dbid changed, wrote new
name

Database name changed to TESTDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database TESTDB changed to 2321050327.
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.
2)立即关闭数据库,修改db_name参数
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

在spfile文件里作相应修改,数据库db_name
SQL>startup mount;
SQL>alter system set db_name=testdb scope=spfile;

System altered.
注:如果是pfile文件,需手工修改db_name参数值
3)重新创建密码文件
SQL>host orapwd file=c:\oracle\ora92\database\pwwdtestdb.ora password=admin entries=8
SQL> conn sys/admin@test as sysdba
Connected to an idle instance.

4)、以Resetlogs选项打开数据库
SQL> startup mount
ORACLE 例程已经启动。

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
数据库装载完毕。
SQL> alter database open resetlogs;

数据库已更改。
5)、查看修改是构成功
SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
2321050327 TESTDB

SQL>

注意:2、3不能颠倒,否则,重建口令文件是不可用的

参考文档:http://download-west.oracle.com/ ... 52/ch14.htm#1004918

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有