liquibase 更新显示 "ORA-12514, TNS:listener does not currently know of service requested in connect descriptor" 错误

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

我正在尝试使用 Oracle 12c 创建新的 Liquibase 项目 database.My oracle 数据库位于远程 server.This 是我的项目更新日志,它保存为 dbchangelog.xml我的机器,其中 Liquibase 运行

<?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>

liquibase.properties文件保存如下

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

我是否需要在 liquibase 运行 所在的机器上保留 tnsname.ora?如果是,我应该把它放在哪里??

Liquibase 使用 jdbc API,因此您不需要 tnsname.ora,您的计算机上也不需要 oracle 客户端。 ORA-12514 表示 ORCLDB 可能是错误的。

您可以使用此查询找到 SID:

select instance from v$thread