As Oracle Database 23c Free Developer-Release for Linux x64, we can create a database just with the name “FREE”, but we can change the database name with the tool “NID”, and in our tutorial, we are going to change the database name from free to db23c.
- Step 1: Startup Mount
- Step 2: Run the NID tool
- Step 3: Open database and update db_name parameter
- Step 4: Check the new Name
- Step 5: Check the Listener
Step 1: Startup Mount
$ sqlplus / as sysdba
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Tue Apr 25 01:39:06 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.
Total System Global Area 534333272 bytes
Fixed Size 10045272 bytes
Variable Size 364904448 bytes
Database Buffers 155189248 bytes
Redo Buffers 4194304 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
[oracle@ol19u18 ~]$
Step 2: Run the NID tool
$ nid TARGET=sys/XXXXXX DBNAME=db23c
DBNEWID: Release 23.0.0.0.0 - Developer's Release on Tue Apr 25 01:40:01 2023
Copyright (c) 1982, 2023, Oracle and/or its affiliates. All rights reserved.
Connected to database FREE (DBID=1405890330)
Connected to server version 23.2.0
Control Files in database:
/opt/oracle/oradata/FREE/control01.ctl
/opt/oracle/oradata/FREE/control02.ctl
Change database ID and database name FREE to DB23C? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1405890330 to 3329817265
Changing database name from FREE to DB23C
Control File /opt/oracle/oradata/FREE/control01.ctl - modified
Control File /opt/oracle/oradata/FREE/control02.ctl - modified
Datafile /opt/oracle/oradata/FREE/system01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/pdbseed/system01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/sysaux01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/pdbseed/sysaux01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/users01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/pdbseed/undotbs01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/undotbs01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/oranux/system01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/oranux/sysaux01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/oranux/undotbs01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/oranux/users01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/temp01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/pdbseed/temp01.db - dbid changed, wrote new name
Datafile /opt/oracle/oradata/FREE/oranux/temp01.db - dbid changed, wrote new name
Control File /opt/oracle/oradata/FREE/control01.ctl - dbid changed, wrote new name
Control File /opt/oracle/oradata/FREE/control02.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to DB23C.
Modify parameter file and generate a new password file before restarting.
Database ID for database DB23C changed to 3329817265.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
$
Step 3: Open database
After the startup, we need to change the parameter db_name in the spfile file, if not we will have this error:
sqlplus / as sysdba
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Tue Apr 25 01:41:41 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 534333272 bytes
Fixed Size 10045272 bytes
Variable Size 364904448 bytes
Database Buffers 155189248 bytes
Redo Buffers 4194304 bytes
ORA-01103: control file database name 'DB23C' does not match parameter file
DB_NAME 'FREE'
Update the spfile and open RESETLOGS
SQL> alter system set db_name='DB23C' scope=spfile;
System altered.
SQL> shut abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 534333272 bytes
Fixed Size 10045272 bytes
Variable Size 364904448 bytes
Database Buffers 155189248 bytes
Redo Buffers 4194304 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open RESETLOGS;
Database altered.
Step 4: Check the database name
SQL> select d.name, d.open_mode,v.banner from v$database d join v$version v on d.con_id = v.con_id;
NAME OPEN_MODE
BANNER
DB23C READ WRITE
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
SQL>
Step 5: Check the listener status
$ lsnrctl status
LSNRCTL for Linux: Version 23.0.0.0.0 - Developer-Release on 25-APR-2023 01:55:18
Copyright (c) 1991, 2023, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ol19u18)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 23.0.0.0.0 - Developer-Release
Start Date 25-APR-2023 01:54:27
Uptime 0 days 0 hr. 0 min. 51 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service FREE
Listener Parameter File /opt/oracle/product/23c/dbhomeFree/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/ol19u18/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ol19u18)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary…
Service "DB23C" has 1 instance(s).
Instance "free", status READY, has 1 handler(s) for this service…
Service "f92ebcdb3a1a0dafe055d73cc1d28352" has 1 instance(s).
Instance "free", status READY, has 1 handler(s) for this service…
Service "f92ec5c6ad490f45e055d73cc1d28352" has 1 instance(s).
Instance "free", status READY, has 1 handler(s) for this service…
Service "freeXDB" has 1 instance(s).
Instance "free", status READY, has 1 handler(s) for this service…
Service "oranux" has 1 instance(s).
Instance "free", status READY, has 1 handler(s) for this service…
The command completed successfull
Note: When we want to change the instance name, we have this error
ORA-00441: Oracle Free Edition SID violation. Expected:free vs Actual:db23c
Enjoy !