기존 환경 확인
[oracle@oel6 ~]$ env | grep SID
ORACLE_SID=DB11G
[oracle@oel6 ~]$
SQL> select NAME from v$database;
NAME
---------
DB11G
SQL> select INSTANCE from v$thread;
INSTANCE
------------
DB11G
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string DB11G
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string DB11G
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string DB11G
instance_name 파리미터 변경
pfile 생성 및 instance_name=DB11로 변경
SQL> create pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initDB11.ora' from spfile;
File created.
SQL> !ls -al /u01/app/oracle/product/11.2.0/db_1/dbs/initDB11.ora
-rw-r--r--. 1 oracle dba 809 May 20 09:06 /u01/app/oracle/product/11.2.0/db_1/dbs/initDB11.ora
변경된 InitParameter File로 DB 기동
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11G
[oracle@oel6 dbs]$ export ORACLE_SID=DB11
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11
[oracle@oel6 dbs]$ sqlplus "/as sysdba"
SQL> startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initDB11.ora';
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 1006636072 bytes
Database Buffers 637534208 bytes
Redo Buffers 7094272 bytes
Database mounted.
Database opened.
SQL>
DB 기동 후 확인
[oracle@oel6 trace]$ ps -ef | grep pmon
oracle 2856 1 0 09:10 ? 00:00:00 ora_pmon_DB11
oracle 2934 2809 0 09:11 pts/1 00:00:00 grep pmon
[oracle@oel6 trace]$
SQL> select NAME from v$database;
NAME
---------
DB11G
SQL> select INSTANCE from v$thread;
INSTANCE
--------------------------------------------------------------------------------
DB11
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string DB11G
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string DB11G
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string DB11
SQL>
NID로 변경
변경전 환경 확인 및 DB Shutdown & startup mount
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11G
[oracle@oel6 dbs]$ ps -ef | grep pmon
oracle 3299 1 0 09:26 ? 00:00:00 ora_pmon_DB11G
oracle 3596 3264 0 09:59 pts/0 00:00:00 grep pmon
[oracle@oel6 dbs]$ sqlplus "/as sysdba"
SQL> shutdown immediate
[oracle@oel6 dbs]$ sqlplus "/as sysdba"
SQL> startup mount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initDB11G.ora'
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 1006636072 bytes
Database Buffers 637534208 bytes
Redo Buffers 7094272 bytes
Database mounted.
SQL>
NID 실행
[oracle@oel6 ~]$ env | grep SID
ORACLE_SID=DB11G
[oracle@oel6 ~]$ which nid
/u01/app/oracle/product/11.2.0/db_1/bin/nid
[oracle@oel6 ~]$ nid target=sys/welcome1 DBNAME=DB11 SETNAME=yes
DBNEWID: Release 11.2.0.4.0 - Production on Wed May 20 10:20:28 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database DB11G (DBID=510499496)
Connected to server version 11.2.0
Control Files in database:
/u01/app/oracle/oradata/DB11G/control01.ctl
/u01/app/oracle/oradata/DB11G/control02.ctl
Change database name of database DB11G to DB11? (Y/[N]) => Y
Proceeding with operation
Changing database name from DB11G to DB11
Control File /u01/app/oracle/oradata/DB11G/control01.ctl - modified
Control File /u01/app/oracle/oradata/DB11G/control02.ctl - modified
Datafile /u01/app/oracle/oradata/DB11G/system01.db - wrote new name
Datafile /u01/app/oracle/oradata/DB11G/sysaux01.db - wrote new name
Datafile /u01/app/oracle/oradata/DB11G/undotbs01.db - wrote new name
Datafile /u01/app/oracle/oradata/DB11G/users01.db - wrote new name
Datafile /u01/app/oracle/oradata/DB11G/temp01.db - wrote new name
Control File /u01/app/oracle/oradata/DB11G/control01.ctl - wrote new name
Control File /u01/app/oracle/oradata/DB11G/control02.ctl - wrote new name
Instance shut down
Database name changed to DB11.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
[oracle@oel6 ~]$
[oracle@oel6 dbs]$ ps -ef | grep pmon
oracle 3822 3264 0 10:22 pts/0 00:00:00 grep pmon
NID를 실행하면 startup mount한 DB가 shutdown 된다.
OS 환경 변수 변경 및 DB 기동
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11G
[oracle@oel6 dbs]$ export ORACLE_SID=DB11
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11
[oracle@oel6 dbs]$ ps -ef | grep pmon
oracle 3822 3264 0 10:22 pts/0 00:00:00 grep pmon
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11G
[oracle@oel6 dbs]$ export ORACLE_SID=DB11
[oracle@oel6 dbs]$ env | grep SID
ORACLE_SID=DB11
[oracle@oel6 dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 20 10:23:49 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initDB11.ora';
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 1006636072 bytes
Database Buffers 637534208 bytes
Redo Buffers 7094272 bytes
Database mounted.
SQL> alter database open;
Database altered.
DB 기동 후 변경사항 확인
SQL> select INSTANCE from v$thread;
INSTANCE
--------------------------------------------------------------------------------
DB11
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string DB11
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string DB11
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string DB11