Rename DB with NID

Rename Database 9i and above

Check the Db name

SQL> select name from v$database;

NAME
---------
SUN

START :

1.shutdown immediate
2.startup mount
3.$nid target=sys as sysdba dbname=orcl setname=yes
OUTPUT :

[oracle@Sunshine dbs]$ nid target=sys as sysdba dbname=orcl setname=yes
DBNEWID: Release 10.1.0.3.0 - Production
Copyright (c) 2001, 2004, Oracle. All rights reserved.

Password:
Connected to database SUN (DBID=1134261166)

Connected to server version 10.1.0

Control Files in database:
/home/oracle/product/10.1.0/oradata/orcl/control01.ctl
/home/oracle/product/10.1.0/oradata/orcl/control02.ctl
/home/oracle/product/10.1.0/oradata/orcl/control03.ctl

Change database name of database SUN to ORCL? (Y/[N]) => Y

Proceeding with operation
Changing database name from SUN to ORCL
Control File /home/oracle/product/10.1.0/oradata/orcl/control01.ctl - modified
Control File /home/oracle/product/10.1.0/oradata/orcl/control02.ctl - modified
Control File /home/oracle/product/10.1.0/oradata/orcl/control03.ctl - modified
Datafile /home/oracle/product/10.1.0/oradata/orcl/system01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/undotbs01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/sysaux01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/users01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/example01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/temp01.dbf - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control01.ctl - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control02.ctl - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control03.ctl - wrote new name
Instance shut down

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

5.mv spfilesun.ora spfileorcl.ora
6.rm orapwsun
7.orapwd file=orapworcl password=orcl
8.EXPORT ORACLE_SID=orcl
9.sqlplus / as sysdba
10.startup force nomount quiet
11.alter system set db_name='orcl' scope=spfile
12.startup force;
13.SQL> select name from v$database;

NAME
---------
ORCL


DB name changed succesfully 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值