• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

9I中如何修改Ddid和Dbname方法测试小结_sqlserver

sqlserver 搞代码 3年前 (2018-06-16) 94次浏览 已收录 0个评论

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

http://www.gaodaima.com/35836.html9I中如何修改Ddid和Dbname方法测试小结_sqlserver

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 [email protected] 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 [email protected] DBNAME=test3 SETNAME=YES LOGFILE=dbid.out

二、修改步骤如下:

1)、SQL> conn [email protected] 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 [email protected] 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
    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 [email protected] 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

欢迎大家阅读《9I中如何修改Ddid和Dbname方法测试小结_sqlserver,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址