天天看點

DBNEWID工具使用二:修改DBNAME

二、使用DBNEWID修改DBNAME

1、檢視目前的DBNAME

SQL> select name from v$database;

 NAME

 ---------

 WWL

2、建立參數檔案

SQL> create pfile from spfile;

File created.                

3、關閉資料庫

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount pfile='/orasoft/product/10.2.0/db_1/dbs/initwwl.ora';

ORACLE instance started.

Total System Global Area  285212672 bytes

Fixed Size                  1218992 bytes

Variable Size              62916176 bytes

Database Buffers          218103808 bytes

Redo Buffers                2973696 bytes

Database mounted.

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

4、使用NID指令更改資料庫名稱,将原來的WWL更改為WWL01:

[oracle@ora10g dbs]$ nid target = sys/oracle DBNAME = WWL01 SETNAME=YES;

DBNEWID: Release 10.2.0.1.0 - Production on Wed Dec 7 00:28:17 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to database WWL (DBID=4286252909)

Connected to server version 10.2.0

Control Files in database:

    /oradata/wwl/control01.ctl

    /oradata/wwl/control02.ctl

    /oradata/wwl/control03.ctl

Change database name of database WWL to WWL01? (Y/[N]) => Y

Proceeding with operation

Changing database name from WWL to WWL01

    Control File /oradata/wwl/control01.ctl - modified

    Control File /oradata/wwl/control02.ctl - modified

    Control File /oradata/wwl/control03.ctl - modified

    Datafile /oradata/wwl/system01.dbf - wrote new name

    Datafile /data2/test_local_01.dbf - wrote new name

    Datafile /oradata/wwl/sysaux01.dbf - wrote new name

    Datafile /oradata/wwl/users01.dbf - wrote new name

    Datafile /oradata/wwl/test01_01.dbf - wrote new name

    Datafile /data2/test001_01.dbf - wrote new name

    Datafile /data2/test001_02.dbf - wrote new name

    Datafile /data2/test002_01.dbf - wrote new name

    Datafile /data2/bigfile001.dbf - wrote new name

    Datafile /data2/undotbs2_01.dbf - wrote new name

    Datafile /oradata/wwl/temp01.dbf - wrote new name

    Datafile /data2/temp01_01.dbf - wrote new name

    Control File /oradata/wwl/control01.ctl - wrote new name

    Control File /oradata/wwl/control02.ctl - wrote new name

    Control File /oradata/wwl/control03.ctl - wrote new name

    Instance shut down

Database name changed to WWL01.

Modify parameter file and generate a new password file before restarting.

Succesfully changed database name.

DBNEWID - Completed succesfully.

5、登陸到資料庫檢查,發現DBNAME已經由原來的WWL修改為現在的WWL01

[oracle@ora10g dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 7 00:26:44 2011

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

SQL> select dbid,name from v$database;

      DBID NAME

---------- ---------

4286252909 WWL01