修改数据库名称, 方法适用于Oracle9iR2以后版本.
2009-02-23 16:31
435 查看
参考metalink: DOC ID 224266.1, 方法适用于Oracle9iR2以后版本.
1. Backup the database
2. SHUTDOWN IMMEDIATE of the database
3. STARTUP MOUNT
4. Open one session and run NID with sysdba privileges
% nid TARGET=SYS/password@test_db DBNAME=test_db2 SETNAME=Y
- the value of DBNAME is the new dbname of the database
- SETNAME must be set to Y. The default is N and causes the DBID to be changed also.
5. shutdown IMMEDIATE of the database
6. Set the DB_NAME initialization parameter in the initialization parameter file to the new database name
7. Create a new password file
8. Startup of the database(without resetlogs)
举例:
$ sqlplus / as sysdba
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string WENDING
SQL> create pfile='/orahome/init.ora' from spfile;
SQL> shutdown immediate
SQL> startup mount
SQL> exit;
$ nid target=/ dbname=ESUITE setname=y
DBNEWID: Release 10.2.0.1.0 - Production on Wed Dec 31 16:07:11 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database WENDING (DBID=270220430)
Connected to server version 10.2.0
Control Files in database:
/orahome/oradata/WENDING/control1.ctl
/orahome/oradata/WENDING/control2.ctl
/orahome/oradata/WENDING/control3.ctl
Change database name of database WENDING to ESUITE? (Y/
) => y
Proceeding with operation
Changing database name from WENDING to ESUITE
Control File /orahome/oradata/WENDING/control1.ctl - modified
Control File /orahome/oradata/WENDING/control2.ctl - modified
Control File /orahome/oradata/WENDING/control3.ctl - modified
Datafile /orahome/oradata/WENDING/system.dbf - wrote new name
Datafile /orahome/oradata/WENDING/undotbs1.dbf - wrote new name
Datafile /orahome/oradata/WENDING/sysaux.dbf - wrote new name
...
Datafile /orahome/oradata/WENDING/EUNITE_USER01.dbf - wrote new name
Datafile /orahome/oradata/WENDING/EUNITE_INDEX01.dbf - wrote new name
Datafile /orahome/oradata/WENDING/temp01.dbf - wrote new name
Control File /orahome/oradata/WENDING/control1.ctl - wrote new name
Control File /orahome/oradata/WENDING/control2.ctl - wrote new name
Control File /orahome/oradata/WENDING/control3.ctl - wrote new name
Instance shut down
Database name changed to ESUITE.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
$ vi /orahome/init.ora (修改db_name='ESUITE')
$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=iamwangnc force=y
$ sqlplus / as sysdba
SQL> startup pfile='/orahome/init.ora';
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string ESUITE
SQL> create spfile from pfile='/orahome/init.ora';
1. Backup the database
2. SHUTDOWN IMMEDIATE of the database
3. STARTUP MOUNT
4. Open one session and run NID with sysdba privileges
% nid TARGET=SYS/password@test_db DBNAME=test_db2 SETNAME=Y
- the value of DBNAME is the new dbname of the database
- SETNAME must be set to Y. The default is N and causes the DBID to be changed also.
5. shutdown IMMEDIATE of the database
6. Set the DB_NAME initialization parameter in the initialization parameter file to the new database name
7. Create a new password file
8. Startup of the database(without resetlogs)
举例:
$ sqlplus / as sysdba
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string WENDING
SQL> create pfile='/orahome/init.ora' from spfile;
SQL> shutdown immediate
SQL> startup mount
SQL> exit;
$ nid target=/ dbname=ESUITE setname=y
DBNEWID: Release 10.2.0.1.0 - Production on Wed Dec 31 16:07:11 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database WENDING (DBID=270220430)
Connected to server version 10.2.0
Control Files in database:
/orahome/oradata/WENDING/control1.ctl
/orahome/oradata/WENDING/control2.ctl
/orahome/oradata/WENDING/control3.ctl
Change database name of database WENDING to ESUITE? (Y/
) => y
Proceeding with operation
Changing database name from WENDING to ESUITE
Control File /orahome/oradata/WENDING/control1.ctl - modified
Control File /orahome/oradata/WENDING/control2.ctl - modified
Control File /orahome/oradata/WENDING/control3.ctl - modified
Datafile /orahome/oradata/WENDING/system.dbf - wrote new name
Datafile /orahome/oradata/WENDING/undotbs1.dbf - wrote new name
Datafile /orahome/oradata/WENDING/sysaux.dbf - wrote new name
...
Datafile /orahome/oradata/WENDING/EUNITE_USER01.dbf - wrote new name
Datafile /orahome/oradata/WENDING/EUNITE_INDEX01.dbf - wrote new name
Datafile /orahome/oradata/WENDING/temp01.dbf - wrote new name
Control File /orahome/oradata/WENDING/control1.ctl - wrote new name
Control File /orahome/oradata/WENDING/control2.ctl - wrote new name
Control File /orahome/oradata/WENDING/control3.ctl - wrote new name
Instance shut down
Database name changed to ESUITE.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
$ vi /orahome/init.ora (修改db_name='ESUITE')
$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=iamwangnc force=y
$ sqlplus / as sysdba
SQL> startup pfile='/orahome/init.ora';
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string ESUITE
SQL> create spfile from pfile='/orahome/init.ora';
相关文章推荐
- MySQL 修改数据库名称的一个新奇方法
- web项目中不适用于java.sql.DriverManager描述的JDBC 4.0 Drivers及以后版本连接数据库是不需要用forName()?
- ubuntu 修改shell分辨率(适用于桌面和Server版本),非menulist方法
- MySQL 修改数据库名称的一个新奇方法
- 如何修改SQL Server 2000的数据库逻辑与物理名称
- Android 修改app图标和名称的方法
- Oracle NID工具修改数据库DBID、数据库名称、数据库实例名
- mysql修改数据库编码(数据库字符集)和表的字符编码的方法
- 数据库修改相同属性的数据的方法
- DEDE修改取消或者替换子栏目列表名称中"/"符号的方法
- 【mysql】新方法修改数据库密码以及解决--ERROR 1045 (28000)的问题
- Oracle 11g 参数修改错误导致数据库无法启动的处理方法.[ORA-01034,ORA-27101]
- entity framework不查数据库修改或排除指定字段集合通用方法
- 如何修改Win8.1系统网络名称?修改Win8.1系统网络名称的方法
- Win10借助修改注册表删除网络及修改网络名称方法图解
- 使用ef code first模式,在部署后服务器端把数据库同步到最新版本的方法
- VS2008中使用JSONCPP方法修改版本能运行显示结果
- 在VB.NET中 用代码 利用SQL语句创建数据库、表、存储过程、视图、索引、规则、修改表、查看数据等的方法
- ORACLE 使用nid修改数据库名称
- Java实现ping功能的三种方法--windows(版本)---linux下请自行修改 【ping】参数 跟 正则验证