如何重命名DB- How to Rename DB_NAME with NID?

如何如何重命名DB- How to Rename DB_NAME with NID?  一般可以Follow 下面的过程:

 

 

rename database 重命名db,原DB_NAME=MACLEANS 需要修改为MACSH

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

 

 

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 956304728 bytes
Database Buffers 687865856 bytes
Redo Buffers 7118848 bytes
Database mounted.

 

 
[oracle@mlab1 ~]$ nid target=system/oracle DBNAME=MACSH SETNAME=Y

DBNEWID: Release 11.2.0.3.0 – Production on Tue May 28 12:00:16 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to database MACLEANS (DBID=639200705)

Connected to server version 11.2.0

Control Files in database:
+DATA/macleansh/controlfile/current.272.816564929
+FRA/macleansh/controlfile/current.256.816564929

Change database name of database MACLEANS to MACSH? (Y/[N]) => Y

Proceeding with operation
Changing database name from MACLEANS to MACSH
Control File +DATA/macleansh/controlfile/current.272.816564929 – modified
Control File +FRA/macleansh/controlfile/current.256.816564929 – modified
Datafile +DATA/macleansh/datafile/system.260.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/sysaux.266.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/undotbs1.264.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/users.273.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/example.263.81656499 – wrote new name
Datafile +DATA/macleansh/tempfile/temp.262.81656497 – wrote new name
Control File +DATA/macleansh/controlfile/current.272.816564929 – wrote new name
Control File +FRA/macleansh/controlfile/current.256.816564929 – wrote new name
Instance shut down

Database name changed to MACSH.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID – Completed succesfully.

 
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 956304728 bytes
Database Buffers 687865856 bytes
Redo Buffers 7118848 bytes

SQL> alter system set db_name=’MACSH’ scope=spfile;

System altered.

 

SQL> startup force;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 956304728 bytes
Database Buffers 687865856 bytes
Redo Buffers 7118848 bytes
Database mounted.
Database opened.

 

SQL> show parameter db_name

NAME TYPE VALUE
———————————— ———– ——————————
db_name string MACSH
SQL> 
SQL> 
SQL> select name from v$database;

NAME
———
MACSH


你可能感兴趣的:(如何重命名DB- How to Rename DB_NAME with NID?)