Knowledge Base : ODA: oakcli 12 cannot delete database

Problem

oakcli „delete database“ fails on Oracle Database Appliance

[root@oda1 ~]# oakcli delete database -db dbx
2016-02-20 19:12:55: Will be running following sql statements as user: oracle:
                  export oracle_home=/u01/app/oracle/product/12.1.0.2/dbhome_2,
                  export sid= dbx,
                  /u01/app/oracle/product/12.1.0.2/dbhome_2/bin/sqlplus -L sys/password@/dbx as sysdba
                  set heading off
set echo off
select name from  v$datafile
2016-02-20 19:12:55: Removing file /tmp/filenoqI0r
2016-02-20 19:12:55: Successfully removed file: /tmp/filenoqI0r
2016-02-20 19:12:55: /bin/su exited with rc=1
2016-02-20 19:12:55: ERROR:  Failed to connect to the database  
ERROR: 
ORA-12154: TNS:could not resolve the connect identifier specified 
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus 
Died at /opt/oracle/oak/lib/oakutilslib/SqlUtils.pm line 91. 
[root@oda1 ~]# less /opt/oracle/oak/log/oda1/tools/12.1.2.5.0/deletedatabase_dbx_43801.log 
/u01/app/oracle/product/12.1.0.2/dbhome_2/bin/sqlplus -L sys/password@/dbx as sysdba 
[root@oda1 ~]# /u01/app/oracle/product/12.1.0.2/dbhome_2/bin/sqlplus -L sys/welcome1@/dbx as sysdba 
ERROR: 
ORA-12154: TNS:could not resolve the connect identifier specified 

[root@oda1 ~]# /u01/app/oracle/product/12.1.0.2/dbhome_2/bin/sqlplus -L sys/welcome1@dbx as sysdba 
SQL*Plus: Release 12.1.0.2.0 Production on Sat Feb 20 19:16:08 2016 
Copyright (c) 1982, 2014, Oracle. All rights reserved. 
Connected to: 
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 

Solution

The problem is the additionsl slash „/“ in the connect descriptor oakcli produces when calling SQLPlus.

This is an Oracle bug, see also: ODA: Running „oakcli delete database -db <dbname>“ Fails With Error ORA-12514 (Doc ID 2034612.1)

The solution is to reset the db_domain database parameter:

SQL> alter system reset db_domain scope=spfile;

And restart the database

[oracle@oda1:dbx1 ]$ /u01/app/oracle/product/12.1.0.2/dbhome_2/bin/srvctl stop database -d dbx
[oracle@oda1:dbx1 ]$ /u01/app/oracle/product/12.1.0.2/dbhome_2/bin/srvctl start database -d dbx

The solution is also valid if the parameter is not set:

SQL> show parameter domain 
NAME TYPE VALUE 
------------------------------------ ----------- ------------------------------ 
db_domain string