Oracle modify SID (instance name)

Oracle modify SID (instance name)

 

Modify ORACLE instance name

System environment: CentOS 6.5

ORACLE version: 10.2

1, check the original database instance name

$ echo $ORACLE_SID

orcl

$ sqlplus / as sysdba

> select instance from v$thread;

INSTANCE

--------------------------------------------------------------------------------

orcl

2, close the database

> shutdown immediate;

> exit;

3, modify user oracle ORACLE_SID environment variables, such as modified by orcl doiido

$ We /home/oracle/.bash_profile

export ORACLE_SID=doiido

$ source /home/oracle/.bash_profile

4, modify the / etc / oratab file, modified by the sid name is orcl doiido

$ vi /etc/oratab

doiido:/u01/app/oracle/11.2/db_1:Y

5, into the $ ORACLE_HOME / dbs directory

Modify all the files contain the original name for the new sid sid corresponding

$ cd $ORACLE_HOME/dbs

$ Mv hc_zf.dat hc_doiido.dat

$ Mv lkZF lkDOIIDO

$ Mv orapwzf orapwdoiido

$ mv spfilezf.ora spfiledoiido.ora

6, rebuild the password file

Because you can not use in the new instance renamed after the password file, so reconstruction

$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=123456 entries=5 force=y

7, start the database

$ sqlplus / as sysdba

> startup

8, check the database instance name

By the following statement to check the database instance name, instance name has become discovered by the orcl doiido

> select instance from v$thread;

INSTANCE

--------------------------------------------------------------------------------

doiido

This time though the names have been changed instance doiido, but the database name (dbname) still orcl, and therefore still can not connect on the client, such as the need to connect, you need to modify the dbname

Reprinted to: http://www.2cto.com/database/201503/379460.html



Author: i pile
link: https: //www.jianshu.com/p/ab5d1add9832
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.

Guess you like

Origin blog.csdn.net/Aria_Miazzy/article/details/93239078