Renaming Database Name in 12c (12.1.0.2)

So in this post we are planning to change the Database Name from cdb2 to cdb3. Just see how it goes:

First of all find out the Old Database Location for which we are planning to change the name:

[oracle@oracle12c ~]$ du -sh /u01/app/oracle/oradata/CDB2/
3.8G /u01/app/oracle/oradata/CDB2/
[oracle@oracle12c ~]$

Connect to the database and find out the status of PDBs which are part of the Root Container and shutdown the database:

[oracle@oracle12c ~]$ . oraenv
ORACLE_SID = [cdb2] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$ echo $ORACLE_SID
cdb2
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 16:54:37 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
SQL> select name,OPEN_MODE from v$pdbs;

NAME OPEN_MODE
—————————— ———-
PDB$SEED READ ONLY
PDB1 READ WRITE

SQL>

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@oracle12c ~]$

So database is down now:

[oracle@oracle12c ~]$ ps -eaf|grep ora_
oracle 4942 2371 0 16:58 pts/1 00:00:00 grep ora_
[oracle@oracle12c ~]$

Take a backup of the Database using OS Command:

[oracle@oracle12c ~]$ cd /u01/app/oracle/oradata/
[oracle@oracle12c oradata]$ ls -lrt
total 16
drwxr-x— 4 oracle oinstall 4096 Mar 10 19:32 cdb1
drwxr-x— 6 oracle oinstall 4096 Mar 14 16:55 CDB2
[oracle@oracle12c oradata]$
[oracle@oracle12c oradata]$ tar -zcvf CDB2.tgz CDB2
CDB2/
CDB2/onlinelog/
CDB2/onlinelog/o1_mf_1_cgf7hk1t_.log
CDB2/onlinelog/o1_mf_2_cgf7hmvc_.log
CDB2/onlinelog/o1_mf_3_cgf7hpvy_.log
CDB2/controlfile/
CDB2/controlfile/o1_mf_cgf7hgn8_.ctl
CDB2/datafile/
CDB2/datafile/o1_mf_system_cgf7f5n4_.dbf
CDB2/datafile/o1_mf_system_cgf7hxkp_.dbf
CDB2/datafile/o1_mf_sysaux_cgf7cr9q_.dbf
CDB2/datafile/o1_mf_sysaux_cgf7hxkl_.dbf
CDB2/datafile/o1_mf_temp_cgf7hvo1_.tmp
CDB2/datafile/o1_mf_users_cgf7glr4_.dbf
CDB2/datafile/o1_mf_undotbs1_cgf7gmtn_.dbf
CDB2/datafile/pdbseed_temp012016-03-14_04-48-59-PM.dbf
CDB2/2E01889CD630125FE0530F00A8C039AD/
CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/
CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_system_cgf7wwc3_.dbf
CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_sysaux_cgf7wwc8_.dbf
CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_users_cgf7xmkc_.dbf
CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_temp_cgf7wwc9_.dbf
[oracle@oracle12c oradata]$
[oracle@oracle12c oradata]$ du -sh *
3.6G cdb1
3.8G CDB2
685M CDB2.tgz
[oracle@oracle12c oradata]$

Take a backup of SPFILE and Password File that belong to Old Database which is going to be renamed:

[oracle@oracle12c oradata]$ cp /u01/app/oracle/product/12.1.0.2/db_1/dbs/spfilecdb2.ora /u01/app/oracle/product/12.1.0.2/db_1/dbs/spfilecdb2.ora_moved
[oracle@oracle12c oradata]$

[oracle@oracle12c oradata]$ cp /u01/app/oracle/product/12.1.0.2/db_1/dbs/orapwcdb2 /u01/app/oracle/product/12.1.0.2/db_1/dbs/orapwcdb2_moved
[oracle@oracle12c oradata]$

Now connect to the database and startup in mount state:

[oracle@oracle12c ~]$ . oraenv
ORACLE_SID = [cdb2] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 17:15:39 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size 2927528 bytes
Variable Size 671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers 13848576 bytes
Database mounted.
SQL>

Find out the Current DB Name along with the DBID:

SQL> SELECT DBID,NAME from V$DATABASE;

DBID NAME
———- ———
653529927 CDB2

SQL>
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$

Check out the nid utility is being called from the correct location:

[oracle@oracle12c ~]$ which nid
/u01/app/oracle/product/12.1.0.2/db_1/bin/nid
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$ nid target=sys@cdb2 dbname=cdb3 setname=YES

DBNEWID: Release 12.1.0.2.0 – Production on Mon Mar 28 17:16:44 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

Password:

NID-00106: LOGIN to target database failed with Oracle error:
ORA-12541: TNS:no listener

Change of database name failed during validation – database is intact.
DBNEWID – Completed with validation errors.

[oracle@oracle12c ~]$

As per the above message it shows Listener is down, start the listener:

[oracle@oracle12c ~]$ lsnrctl start

LSNRCTL for Linux: Version 12.1.0.2.0 – Production on 28-MAR-2016 17:16:57

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Starting /u01/app/oracle/product/12.1.0.2/db_1/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 12.1.0.2.0 – Production
System parameter file is /u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/oracle12c/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle12c.oragyan.com)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12c)(PORT=1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 – Production
Start Date 28-MAR-2016 17:16:59
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle12c/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle12c.oragyan.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary…
Service “pdb1.oragyan.com” has 1 instance(s).
Instance “pdb1”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully
[oracle@oracle12c ~]$

Check the status of listener:

[oracle@oracle12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 – Production on 28-MAR-2016 17:17:06

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12c)(PORT=1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 – Production
Start Date 28-MAR-2016 17:16:59
Uptime 0 days 0 hr. 0 min. 6 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle12c/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle12c.oragyan.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary…
Service “pdb1.oragyan.com” has 1 instance(s).
Instance “pdb1”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully
[oracle@oracle12c ~]$

Start the nid utility, it will ask for the SYS Password so make sure you have it with you or else change it and keep it with you before going ahead:

[oracle@oracle12c ~]$ nid target=sys@cdb2 dbname=cdb3 setname=YES

DBNEWID: Release 12.1.0.2.0 – Production on Mon Mar 28 17:20:48 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

Password:
Connected to database CDB2 (DBID=653529927)

Connected to server version 12.1.0

Control Files in database:
/u01/app/oracle/oradata/CDB2/controlfile/o1_mf_cgf7hgn8_.ctl
/u01/app/oracle/fast_recovery_area/CDB2/controlfile/o1_mf_cgf7hgq2_.ctl

Change database name of database CDB2 to CDB3? (Y/[N]) => Y

Proceeding with operation
Changing database name from CDB2 to CDB3
Control File /u01/app/oracle/oradata/CDB2/controlfile/o1_mf_cgf7hgn8_.ctl – modified
Control File /u01/app/oracle/fast_recovery_area/CDB2/controlfile/o1_mf_cgf7hgq2_.ctl – modified
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_system_cgf7f5n4_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_sysaux_cgf7cr9q_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_undotbs1_cgf7gmtn_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_system_cgf7hxkp_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_users_cgf7glr4_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_sysaux_cgf7hxkl_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_system_cgf7wwc3_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_sysaux_cgf7wwc8_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_users_cgf7xmkc_.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/o1_mf_temp_cgf7hvo1_.tm – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/datafile/pdbseed_temp012016-03-14_04-48-59-PM.db – wrote new name
Datafile /u01/app/oracle/oradata/CDB2/2E01889CD630125FE0530F00A8C039AD/datafile/o1_mf_temp_cgf7wwc9_.db – wrote new name
Control File /u01/app/oracle/oradata/CDB2/controlfile/o1_mf_cgf7hgn8_.ctl – wrote new name
Control File /u01/app/oracle/fast_recovery_area/CDB2/controlfile/o1_mf_cgf7hgq2_.ctl – wrote new name
Instance shut down

Database name changed to CDB3.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID – Completed succesfully.

[oracle@oracle12c ~]$

If you go through the last message displayed by the utility to change the DB_NAME Parameter in Parameter File and Create a New Password File for the newly Created Name:

Before we do that let us just check what DATABASE has name in it:

[oracle@oracle12c ~]$ ps -eaf|grep ora_
oracle 5406 2371 0 17:22 pts/1 00:00:00 grep ora_
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$ . oraenv
ORACLE_SID = [cdb2] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$
[oracle@oracle12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 17:22:36 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size 2927528 bytes
Variable Size 671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers 13848576 bytes
ORA-01103: database name ‘CDB3’ in control file is not ‘CDB2’

SQL>
SQL> shutdown immediate
ORA-01507: database not mounted

ORACLE instance shut down.
SQL>
SQL>
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@oracle12c ~]$

So above we can see its still picking up CDB2 from the parameter file, just confirm from the parameter file too using show parameter command:

[oracle@oracle12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 17:23:25 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> show parameter db_name
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size 2927528 bytes
Variable Size 671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers 13848576 bytes
SQL>
SQL> show parameter db_name

NAME TYPE VALUE
———————————— ———– ——————————
db_name string cdb2
SQL>

Change the name of the Database in SPFILE too:

SQL> alter system set db_name=cdb3 scope=spfile;

System altered.

SQL>
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@oracle12c ~]$

Create a new password file for the new name CDB3 in the default location:

[oracle@oracle12c ~]$ orapwd file=/u01/app/oracle/product/12.1.0.2/db_1/dbs/orapwcdb3 password=Oracle1234
[oracle@oracle12c ~]$

Restart the database to pick up the value we changed for DB_NAME above, it will pick the name from parameter file this time, as we have changed it above:

[oracle@oracle12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 17:25:36 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
SQL> show parameter db_name

NAME TYPE VALUE
———————————— ———– ——————————
db_name string cdb2
SQL>
SQL>
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL>
SQL> startup mount;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size 2927528 bytes
Variable Size 671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers 13848576 bytes
Database mounted.
SQL>
SQL>
SQL> show parameter db_name

NAME TYPE VALUE
———————————— ———– ——————————
db_name string CDB3
SQL>

Open the database and check the new name has been configured for this Database:

SQL> alter database open;

Database altered.

SQL>
SQL> SELECT DBID,NAME from V$DATABASE;

DBID NAME
———- ———
653529927 CDB3

SQL>

So this part is done.

Now there is something need to be noticed that we have the spfile for this database (cdb3) with name spfilecdb2.ora with DB_NAME cdb3, which is bit confusing for the other DBAs if they will get to check this and if they are not aware about this name change.

So how can we get this done, let’s do it now:

First of all make an entry in /etc/oratab file so that we can all this name from oraenv utility.

I edited my file and put the entry in there:

[oracle@oracle12c dbs]$ cat /etc/oratab | tail -3
cdb1:/u01/app/oracle/product/12.1.0.2/db_1:N
cdb2:/u01/app/oracle/product/12.1.0.2/db_1:N
cdb3:/u01/app/oracle/product/12.1.0.2/db_1:N
[oracle@oracle12c dbs]$

Check now if oraenv works fine with that:

[oracle@oracle12c dbs]$ . oraenv
ORACLE_SID = [cdb3] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oracle12c dbs]$

Now copy the spfilecdb2.ora to spfilecdb3.ora and connect to the database and create a pfile:

[oracle@oracle12c dbs]$ cp spfilecdb2.ora spfilecdb3.ora
[oracle@oracle12c dbs]$
[oracle@oracle12c dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 18:05:40 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL>
SQL> create pfile from spfile;

File created.

SQL>

Now check the file and change cdb2 to cdb3 everywhere in the file:

[oracle@oracle12c dbs]$ ls -lrt init*
-rw-r–r– 1 oracle oinstall 2992 Feb 3 2012 init.ora
-rw-r–r– 1 oracle oinstall 1008 Mar 13 18:54 initcdb1.ora
-rw-r–r– 1 oracle oinstall 1081 Mar 20 14:41 initcdb2.ora
-rw-r–r– 1 oracle oinstall 1081 Mar 28 18:05 initcdb3.ora
[oracle@oracle12c dbs]$
[oracle@oracle12c dbs]$ vi initcdb3.ora
[oracle@oracle12c dbs]$
[oracle@oracle12c dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 18:06:50 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup pfile=’$ORACLE_HOME/dbs/initcdb3.ora’;
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
SQL>
SQL> Disconnected
[oracle@oracle12c dbs]$

So it is failing on some directory which is not there, may be we did not create it before starting the database, just find out which directory it is:

[oracle@oracle12c dbs]$ cat initcdb3.ora
cdb3.__data_transfer_cache_size=0
cdb3.__db_cache_size=1828716544
cdb3.__java_pool_size=16777216
cdb3.__large_pool_size=33554432
cdb3.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
cdb3.__pga_aggregate_target=838860800
cdb3.__sga_target=2516582400
cdb3.__shared_io_pool_size=117440512
cdb3.__shared_pool_size=503316480
cdb3.__streams_pool_size=0
*.audit_file_dest=’/u01/app/oracle/admin/cdb3/adump
*.audit_trail=’db’
*.compatible=’12.1.0.2.0′
*.control_files=’/u01/app/oracle/oradata/CDB2/controlfile/o1_mf_cgf7hgn8_.ctl’,’/u01/app/oracle/fast_recovery_area/CDB2/controlfile/o1_mf_cgf7hgq2_.ctl’
*.db_block_size=8192
*.db_create_file_dest=’/u01/app/oracle/oradata’
*.db_domain=”
*.db_name=’CDB3′
*.db_recovery_file_dest=’/u01/app/oracle/fast_recovery_area’
*.db_recovery_file_dest_size=4560m
*.diagnostic_dest=’/u01/app/oracle’
*.dispatchers='(PROTOCOL=TCP) (SERVICE=cdb3XDB)’
*.enable_pluggable_database=true
*.open_cursors=300
*.pga_aggregate_target=798m
*.processes=300
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_target=2394m
*.undo_tablespace=’UNDOTBS1′
[oracle@oracle12c dbs]$

Now Create a Directory based on the error and start the database again using pfile:

[oracle@oracle12c dbs]$ mkdir -p /u01/app/oracle/admin/cdb3/adump
[oracle@oracle12c dbs]$
[oracle@oracle12c dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 18:08:16 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL>
SQL> startup pfile=’$ORACLE_HOME/dbs/initcdb3.ora’;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size 2927528 bytes
Variable Size 671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers 13848576 bytes
Database mounted.
Database opened.
SQL>
SQL> create spfile from pfile;

File created.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

Check the content of spfilecdb3.ora and verify that we are good to start our database with that file:

[oracle@oracle12c dbs]$ strings spfilecdb3.ora | grep -i cdb3
cdb3.__data_transfer_cache_size=0
cdb3.__db_cache_size=1828716544
cdb3.__java_pool_size=16777216
cdb3.__large_pool_size=33554432
cdb3.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
cdb3.__pga_aggregate_target=838860800
cdb3.__sga_target=2516582400
cdb3.__shared_io_pool_size=117440512
cdb3.__shared_pool_size=503316480
cdb3.__streams_pool_size=0
*.audit_file_dest=’/u01/app/oracle/admin/cdb3/adump’
*.db_name=’CDB3′
*.dispatchers='(PROTOCOL=TCP) (SERVICE=cdb3XDB)’
[oracle@oracle12c dbs]$

Now start the database and check its starting from spfile or not:

[oracle@oracle12c dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 28 18:12:39 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL>
SQL> startup
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size 2927528 bytes
Variable Size 671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers 13848576 bytes
Database mounted.
Database opened.
SQL>
SQL> show parameter pfile

NAME TYPE VALUE
———————————— ———– ——————————
spfile string /u01/app/oracle/product/12.1.0
.2/db_1/dbs/spfilecdb3.ora
SQL>

Last things is to update the tnsnames.ora file which must have the name for this new database which we just changed.

I kept the below entry in tnsnames.ora file, just copy cdb2 entry and paste it and change it to cdb3.

CDB3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cdb3)
)
)

Make sure you confirm with tnsping utility:

[oracle@oracle12c admin]$ tnsping cdb3

TNS Ping Utility for Linux: Version 12.1.0.2.0 – Production on 29-MAR-2016 17:59:52

Copyright (c) 1997, 2014, Oracle. All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdb3)))
OK (0 msec)
[oracle@oracle12c admin]$

Cool we are good here.

Thanks for watching guys, let me know if there in any question.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s