Search code examples
oracle-databaseoracle12cliquibase

liquibase update showing "ORA-12514, TNS:listener does not currently know of service requested in connect descriptor" Error


I am trying to Creating New Liquibase Projects with Oracle 12c database.My oracle database is located on a remote server.This is my changelog for my project and it is saved as dbchangelog.xml on my machine where Liquibase is running

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

    <changeSet id="1" author="bob">
        <createTable tableName="department">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
        <column name="active" type="boolean"                     
            defaultValueBoolean="true"/>
        </createTable>
   </changeSet>
</databaseChangeLog>

The liquibase.properties file is saved as follows

changeLogFile: /home/dbchangelog.xml
url : jdbc:oracle:thin:@<oracle_db_ip>:1521/ORCLDB
username : <user>
password : <password>
driver: oracle.jdbc.OracleDriver
classpath: /home/ojdbc6.jar

Do i need to keep tnsname.ora on my machine where liquibase is running? if yes where should i keep it ??


Solution

  • Liquibase uses jdbc API, so you don't need tnsname.ora, neither oracle client on your machine. ORA-12514 means that ORCLDB is probably wrong.

    You can find the SID using this query:

    select instance from v$thread