如何重命名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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值