日期:2013-05-25  浏览次数:20487 次

测试环境: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 YSTEM01.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
&nbs