下面修改数据库的SID和db_name
[[email protected] ~]# su - ora11g
[email protected] /home/ora11g$
[email protected] /home/ora11g$ sqlplus /as sysdba
SQL*Plus:Release11.2.0.4.0Production on MonMar3007:39:362015
Copyright(c)1982,2013,Oracle.All rights reserved.
Connected to:
OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
SQL>select name, dbid,log_mode,open_mode from v$database;
NAME DBID LOG_MODE OPEN_MODE
---------------------------------------------------
DB11 1400765095 ARCHIVELOG READ WRITE
启动到mount状态
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
TotalSystemGlobalArea835104768 bytes
FixedSize2257840 bytes
VariableSize507513936 bytes
DatabaseBuffers322961408 bytes
RedoBuffers2371584 bytes
Database mounted.
SQL>exit
DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
执行命令
[email protected] /home/ora11g$ nid target=sys/oracle dbname=newdb11 setname=yes
DBNEWID:Release11.2.0.4.0-Production on MonMar3007:44:262015
Copyright(c)1982,2011,Oracleand/or its affiliates.All rights reserved.
Connected to database DB11 (DBID=1400765095)
Connected to server version 11.2.0
ControlFilesin database:
/u01/app/oracle11g/oradata/DB11/controlfile/o1_mf_bcc2h7dx_.ctl
Change database name of database DB11 to NEWDB11?(Y/[N])=> Y
Proceedingwith operation
Changing database name from DB11 to NEWDB11
ControlFile/u01/app/oracle11g/oradata/DB11/controlfile/o1_mf_bcc2h7dx_.ctl - modified
Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_system_bcc2dp1d_.db - wrote new name
Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_sysaux_bcc2dp2c_.db - wrote new name
Datafile/u01/app/oracle11g/oradata/DB11/datafile/fdstore.db - wrote new name
Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_users_bcc2dp33_.db - wrote new name
Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_new_user_bcp23qgn_.db - wrote new name
Datafile/u01/app/oracle11g/oradata/DB11/datafile/undotbs2.db - wrote new name
Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_temp_bcc2hld2_.tm - wrote new name
ControlFile/u01/app/oracle11g/oradata/DB11/controlfile/o1_mf_bcc2h7dx_.ctl - wrote new name
Instance shut down
Database name changed to NEWDB11.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID -Completed succesfully.
数据库中修改db_name
[email protected] /u01/app/oracle11g/product/11.2.0/dbhome_1/dbs$ sqlplus /as sysdba
SQL*Plus:Release11.2.0.4.0Production on MonMar3007:58:332015
Copyright(c)1982,2013,Oracle.All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
TotalSystemGlobalArea835104768 bytes
FixedSize2257840 bytes
VariableSize507513936 bytes
DatabaseBuffers322961408 bytes
RedoBuffers2371584 bytes
SQL>set line 200
SQL> show parameter db_name
SQL> show parameter db_name
NAME TYPE VALUE
----------------------------------------------------------------------------------------
db_name string db11
SQL> alter system set db_name=newdb11 scope=spfile;
System altered.
SQL> startup mount force
ORACLE instance started.
TotalSystemGlobalArea835104768 bytes
FixedSize2257840 bytes
VariableSize507513936 bytes
DatabaseBuffers322961408 bytes
RedoBuffers2371584 bytes
Database mounted.
SQL>exit
DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
创建新的密码文件
[email protected] /home/ora11g$
[email protected] /home/ora11g$ orapwd file=$ORACLE_HOME/dbs/orapwnewdb11 password=oracle entries=10
创建参数文件
[email protected] /home/ora11g$ export ORACLE_SID=newdb11
SQL> create spfile from pfile;
File created.
SQL>exit
DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
根据原参数文件,修改成新的参数文件,具体操作略
启动新的数据库名的数据库
[email protected] /home/ora11g$ export ORACLE_SID=newdb11
[email protected] /home/ora11g$ sqlplus /as sysdba
SQL*Plus:Release11.2.0.4.0Production on MonMar3008:16:162015
Copyright(c)1982,2013,Oracle.All rights reserved.
Connected to:
OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
SQL> startup
ORACLE instance started.
TotalSystemGlobalArea835104768 bytes
FixedSize2257840 bytes
VariableSize507513936 bytes
DatabaseBuffers322961408 bytes
RedoBuffers2371584 bytes
Database mounted.
Database opened.
SQL>
SQL>select instance_name,status from v$instance;
INSTANCE_NAME STATUS
----------------------------
newdb11 OPEN
OK。。。启动成功
时间: 2024-10-28 14:15:15