Home >Database >Oracle >How to modify the instance name in Oracle

How to modify the instance name in Oracle

WBOY
WBOYOriginal
2022-04-07 10:42:419104browse

Method: 1. Use "shutdown immediate" to close the database; 2. Use "vim .bash_profile" to modify the value of the environment variable "ORACLE_SID" to the new instance name; 3. Use "vim /etc/oratab" Just modify the name of the password and parameter file.

How to modify the instance name in Oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to modify the instance name of Oracle

Modifying the name of the Oracle instance is relatively simple. You only need to modify the environment variable ORACLE_ID, the name of the password file and parameter file. The steps are as follows:

1. Close the database

Stop the instance

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

2. Modify the environment variable ORACLE_SID

[oracle@wgx ~]$ vim .bash_profile
export ORACLE_BASE=/usr/local/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
##############################################################
#####   修改环境变量ORACLE_SID的取值为book
export ORACLE_SID=book
##############################################################
export ORACLE_OWNER=oracle
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
[oracle@wgx ~]$ source .bash_profile

3 , modify the names of the password file and parameter file

[oracle@wgx dbs]$ ls
hc_DBUA0.dat  hc_orcl.dat  init.ora  lkBOOK  lkBOOKS  lkMYDB  lkORCL  orapworcl  spfileorcl.ora
[oracle@wgx dbs]$ pwd
/usr/local/oracle/product/11.2.0/db_1/dbs
[oracle@wgx dbs]$ mv orapworcl orapwbook
[oracle@wgx dbs]$ mv spfileorcl.ora spfilebook.ora
[oracle@wgx dbs]$ ls
hc_DBUA0.dat  hc_orcl.dat  init.ora  lkBOOK  lkBOOKS  lkMYDB  lkORCL  orapwbook  spfilebook.ora

After the modification is completed, start the instance and check the instance name:

How to modify the instance name in Oracle

How to modify the instance name in Oracle

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to modify the instance name in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn