ORACLE 使用nid修改数据库名称
2017-06-12 13:39
337 查看
1.数据库当前设置:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL>
------------------------------------------------------------------------------------------
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string prdhtjc
db_unique_name string prdhtjc
global_names boolean FALSE
instance_name string prdhtjc
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string prdhtjc
SQL>
------------------------------------------------------------------------------------------
2.Shutdown数据库:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
------------------------------------------------------------------------------------------
3.Startup mount :
SQL> startup mount
ORACLE instance started.
Total System Global Area 196681728 bytes
Fixed Size 1343864 bytes
Variable Size 88084104 bytes
Database Buffers 104857600 bytes
Redo Buffers 2396160 bytes
Database mounted.
------------------------------------------------------------------------------------------
4. 使用NID更改:
SQL> host
nid target=sys/oracle@prdhtjc dbname=htjc01
oracle@prdhtjc1:/backup/rmanbackdir$nid target=sys/oracle@prdhtjc dbname=htjc01
DBNEWID: Release 11.2.0.4.0 - Production on Sun Jan 12 13:41:28 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database PRDHTJC (DBID=4253573492)
Connected to server version 11.2.0
Control Files in database:
/dbfile/oradata/prdhtjc/control01.ctl
/dbfile/oradata/prdhtjc/control02.ctl
/dbfile/oradata/prdhtjc/control03.ctl
Change database ID and database name PRDHTJC to HTJC01? (Y/
) => Y
Proceeding with operation
Changing database ID from 4253573492 to 1038336969
Changing database name from PRDHTJC to HTJC01
Control File /dbfile/oradata/prdhtjc/control01.ctl - modified
Control File /dbfile/oradata/prdhtjc/control02.ctl - modified
Control File /dbfile/oradata/prdhtjc/control03.ctl - modified
Datafile /dbfile/oradata/prdhtjc/system01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/sysaux01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/undotbs01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/users01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc02.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc03.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc04.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc05.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc06.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc07.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc08.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc09.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc10.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/zuhe01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/ptrd01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/ptrd02.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/temp01.db - dbid changed
aced
, wrote new name
Control File /dbfile/oradata/prdhtjc/control01.ctl - dbid changed, wrote new name
Control File /dbfile/oradata/prdhtjc/control02.ctl - dbid changed, wrote new name
Control File /dbfile/oradata/prdhtjc/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to HTJC01.
Modify parameter file and generate a new password file before restarting.
Database ID for database HTJC01 changed to 1038336969.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
------------------------------------------------------------------------------------------
5.Shutdown database:
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
------------------------------------------------------------------------------------------
6.修改初始化参数文件、spfile文件(init.ora/spfile):
instance_name=newchen
#instance_name=chen
db_domain=""
db_name=newchen
#db_name=chen
------------------------------------------------------------------------------------------
7.Startup mount,resetlogs打开:
[oracle@localhost dbs]$ export ORACLE_SID=htjc01
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 2 04:59:39 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 196681728 bytes
Fixed Size 1343864 bytes
Variable Size 83889800 bytes
Database Buffers 109051904 bytes
Redo Buffers 2396160 bytes
Database mounted.
------------------------------------------------------------------------------------------
Step8、修改数据库相关文件的路径名称:
select name from V$datafile;
select member from V$logfile;
select name from V$tempfile;
For exp:
alter database rename file '...' to '...';
SQL> alter database open resetlogs;
Database altered.
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
db_file_name_convert string
db_name string newchen
db_unique_name string newchen
global_names boolean FALSE
instance_name string newchen
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string newchen
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL>
------------------------------------------------------------------------------------------
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string prdhtjc
db_unique_name string prdhtjc
global_names boolean FALSE
instance_name string prdhtjc
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string prdhtjc
SQL>
------------------------------------------------------------------------------------------
2.Shutdown数据库:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
------------------------------------------------------------------------------------------
3.Startup mount :
SQL> startup mount
ORACLE instance started.
Total System Global Area 196681728 bytes
Fixed Size 1343864 bytes
Variable Size 88084104 bytes
Database Buffers 104857600 bytes
Redo Buffers 2396160 bytes
Database mounted.
------------------------------------------------------------------------------------------
4. 使用NID更改:
SQL> host
nid target=sys/oracle@prdhtjc dbname=htjc01
oracle@prdhtjc1:/backup/rmanbackdir$nid target=sys/oracle@prdhtjc dbname=htjc01
DBNEWID: Release 11.2.0.4.0 - Production on Sun Jan 12 13:41:28 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database PRDHTJC (DBID=4253573492)
Connected to server version 11.2.0
Control Files in database:
/dbfile/oradata/prdhtjc/control01.ctl
/dbfile/oradata/prdhtjc/control02.ctl
/dbfile/oradata/prdhtjc/control03.ctl
Change database ID and database name PRDHTJC to HTJC01? (Y/
) => Y
Proceeding with operation
Changing database ID from 4253573492 to 1038336969
Changing database name from PRDHTJC to HTJC01
Control File /dbfile/oradata/prdhtjc/control01.ctl - modified
Control File /dbfile/oradata/prdhtjc/control02.ctl - modified
Control File /dbfile/oradata/prdhtjc/control03.ctl - modified
Datafile /dbfile/oradata/prdhtjc/system01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/sysaux01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/undotbs01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/users01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc02.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc03.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc04.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc05.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc06.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc07.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc08.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc09.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/htjc10.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/zuhe01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/ptrd01.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/ptrd02.db - dbid changed, wrote new name
Datafile /dbfile/oradata/prdhtjc/temp01.db - dbid changed
aced
, wrote new name
Control File /dbfile/oradata/prdhtjc/control01.ctl - dbid changed, wrote new name
Control File /dbfile/oradata/prdhtjc/control02.ctl - dbid changed, wrote new name
Control File /dbfile/oradata/prdhtjc/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to HTJC01.
Modify parameter file and generate a new password file before restarting.
Database ID for database HTJC01 changed to 1038336969.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
------------------------------------------------------------------------------------------
5.Shutdown database:
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
------------------------------------------------------------------------------------------
6.修改初始化参数文件、spfile文件(init.ora/spfile):
instance_name=newchen
#instance_name=chen
db_domain=""
db_name=newchen
#db_name=chen
------------------------------------------------------------------------------------------
7.Startup mount,resetlogs打开:
[oracle@localhost dbs]$ export ORACLE_SID=htjc01
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 2 04:59:39 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 196681728 bytes
Fixed Size 1343864 bytes
Variable Size 83889800 bytes
Database Buffers 109051904 bytes
Redo Buffers 2396160 bytes
Database mounted.
------------------------------------------------------------------------------------------
Step8、修改数据库相关文件的路径名称:
select name from V$datafile;
select member from V$logfile;
select name from V$tempfile;
For exp:
alter database rename file '...' to '...';
SQL> alter database open resetlogs;
Database altered.
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
db_file_name_convert string
db_name string newchen
db_unique_name string newchen
global_names boolean FALSE
instance_name string newchen
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string newchen
相关文章推荐
- 在Oracle12.1中使用NID 修改数据库的DBID和DBName【实战】
- Oracle NID工具修改数据库DBID和数据库名称
- Oracle NID工具修改数据库DBID、数据库名称、数据库实例名
- Oracle NID工具修改数据库DBID和数据库名称
- oracle 修改全局数据库名称 & the account is locked
- 单元测试日期使用ibatis将数据库从oracle迁移到mysql的几个修改点
- Oracle查看数据库状态和修改全局名称
- Oracle修改数据库名称
- 使用ibatis将数据库从oracle迁移到mysql的几个修改点
- Oracl数据库管理方面的资料(查询sga,查看oracle数据库名称sid,查看oracle数据库名称,查看表空间,修改表空间名称)
- 恢复目录数据库发生 ORACLE 错误: ORA-00955: 名称已由现有对象使用
- 使用ibatis将数据库从oracle迁移到mysql的几个修改点
- 在RAC中用NID修改数据库名称
- oracle 修改全局数据库名称
- 使用MySQL Workbench进行数据库设计——修改MySQL Schema的名称
- 在Oracle中使用sql获取数据库名称
- Oracl数据库管理方面的资料(查询sga,查看oracle数据库名称sid,查看oracle数据库名称,查看表空间,修改表空间名称,数据库管理,sqlPlus数据显示)
- Oracle 使用set修改数据库运行参数
- 使用internal_convert修改oracle 10g 数据库字符集
- 使用phpMyAdmin修改数据库名称