我正在使用Liquibase来更新现有的clob数据字段,但它无法正常工作。
这里我提到了Liquibase changelog文件。
<?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"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="clob.type" value="clob" dbms="oracle"/>
<changeSet author="kuprasad" id="002_UPDATE_TERMS_WITH_INFOSEC_DOC_FOR_REQUEST_SPACE">
<update tableName="TEMPLATE">
<column name="ID" type="${clob.type}" value="Some 2000 html char text like <p>A wiki space improves sharing,
searching, and navigating pages, but also adds load on the server, cost, and may complicate
collaboration.</p>" />
<where>id ='space_request_terms_conditions'</where>
</update>
</changeSet>
<changeSet id="tag_v2_3_3" author="kuprasad">
<tagDatabase tag="v2.3.3"/>
</changeSet>
</databaseChangeLog>
上面提到的代码是第一种方式。我也试过删除插入,但这种方式也无效。
在此提及守则:
<?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"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="001_UPDATE_TERMS_WITH_INFOSEC_DOC_FOR_REQUEST_SPACE" author="kuprasad">
<delete tableName="TEMPLATE" >
<where>id='space_request_terms_conditions'</where>
</delete>
<insert tableName="TEMPLATE" >
<column name="id">space_request_terms_conditions</column>
<column name="content" valueClob=" Some 2000 html char text like <p>A wiki space improves sharing, searching, and navigating pages, but also adds load on the server, cost, and may complicate collaboration.</p>" type="CLOB" />
</insert>
</changeSet>
<changeSet id="tag_v2_3_3" author="kuprasad">
<tagDatabase tag="v2.3.3"/>
</changeSet>
</databaseChangeLog>
我正在运行像这样的Liquibase命令
liquibase --driver = oracle.jdbc.OracleDriver --url =“jdbc:oracle:thin:@dbname”--classpath =“C:\ oracle \ product \ 11.2.0 \ client_1 \ jdbc \ lib \ ojdbc6 .jar“ - changeLogFile = db.changelog-2.3.3.xml --username = abc - password = bcd update
例外: ORA-12899:对于“WIKIMETA”列而言值太大。“模板”。“ID”(实际:1994年,最大值:200)
请检查我的方法并告诉我这里的问题。
嗨,问题已经解决了。将Liquibase xml内容放在此处,以便在通过Liquibase进行数据更新时正常工作。
修正:
完整的XML内容:
<?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"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org
/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog
/dbchangelog-ext.xsd">
<property name="clob.type" value="clob" dbms="oracle"/>
<changeSet author="kuprasad" id="006_UPDATE">
<update tableName="TEMPLATE">
<column name="CONTENT" type="${clob.type}"
valueClobFile="clob/templates_space_request_terms_conditions.txt" />
<where>id ='space_request_terms_conditions'</where>
</update>
</changeSet>
<changeSet id="tag_v2_3_3" author="kuprasad">
<tagDatabase tag="v2.3.3"/>
</changeSet>
</databaseChangeLog>