DBNEWID工具使用二:修改DBNAME

来源:互联网 发布:如何利用大数据炒股 编辑:程序博客网 时间:2024/05/23 14:57

DBNEWID工具使用二:修改DBNAME

分类: 技术博文 305人阅读 评论(0)收藏举报
工具databasefileoracle数据库sql

二、使用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

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
4286252909 WWL01

SQL> exit