在本例中,假设原来的数据库名为test,要改成testdb,原实例名(service_name,instance_name)test,要改成testdb.
nid是自带的工具,在oracle_home/bin目录中.以下方法假设登陆到数据库本机做。
1.1 sqlplus "sys/password as sysdba"
1.2 sql>shutdown immediate --先停掉数据库
1.3 sql>startup mount --nid需要在mount状态下才能做。
1.4sql>host nid target=sys/password dbname=new_dbname --nid是一个在操作系统下执行的命令,在sqlplus环境中用host 去调用操作系统环境下的命令。命令中,当你想将数据库名字改为TESTDB时,应写成dbname=testdb
1.5执行后程序会询问:
Change database ID and database name TEST to TESTDB? (Y/[N]) =>y
敲y确定。
之后程序会对控制文件,数据文件进行修改:
Control File C:ORACLEORADATATESTCONTROL01.CTL - modified
Control File C:ORACLEORADATATESTCONTROL02.CTL - modified
Control File C:ORACLEORADATATESTCONTROL03.CTL - modified
Datafile C:ORACLEORADATATEST YSTEM01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTUNDOTBS01.DBF - dbid changed, wrote new nam
Datafile C:ORACLEORADATATESTINDX01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTTOOLS01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTUSERS01.DBF - dbid changed, wrote new name
Datafile D:DATAFILEPORMALS_SPA.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTOEM_REPOSITORY.DBF - dbid changed, wrote ne
name
Datafile D:DATAFILEPORMALS_SPA_01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTTEMP01.DBF - dbid changed, wrote new name
Control File C:ORACLEORADATATESTCONTROL01.CTL - dbid changed, wrote new
name
Control File C:ORACLEORADATATESTCONTROL02.CTL - dbid changed, wrote new
name
Control File C:ORACLEORADATATESTCONTROL03.CTL - dbid changed, wrote new
name
Database name changed to TESTDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database TESTDB changed to 2321050327.
All previous backups and archived redo logs for this database are unusable.
Shut down database and open with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
关键词标签:oracle,数据库
相关阅读
热门文章 Oracle中使用alter table来增加,删除,修改列的语法 oracle中使用SQL语句修改字段类型-oracle修改SQL语句案例 误删Oracle数据库实例的控制文件 为UNIX服务器设置Oracle全文检索
人气排行 oracle中使用SQL语句修改字段类型-oracle修改SQL语句案例 Oracle中使用alter table来增加,删除,修改列的语法 ORACLE SQL 判断字符串是否为数字的语句 ORACLE和SQL语法区别归纳(1) oracle grant 授权语句 ORACLE修改IP地址后如何能够使用 如何加速Oracle大批量数据处理 Oracle删除表的几种方法
查看所有0条评论>>