如何强制flyway清理我的docker oracle数据库? [英] How can I force flyway to clean my docker oracle database?
问题描述
我已经下载了Oracle Database EE的官方oracle docker映像.我有一个flyway配置,并且经常对本地安装的XE版本的数据库运行 flyway:clean
.但是flyway告诉我不允许清理docker映像中的数据库,但可以迁移它.
I've downloaded the official oracle docker image for Oracle Database EE. I've got a flyway configuration and often run flyway:clean
against the locally installed XE version of the database. However flyway tells me it is not allowed to clean the database in the docker image, but it can migrate it.
有没有办法强制飞路清理Oracle数据库?
Is there a way to force flyway to clean the oracle db?
要回答评论中的问题:
这是在通过Maven飞行时出现的错误消息:
Here's the error message when running flyway through maven:
org.flywaydb.core.api.FlywayException: Clean not supported on Oracle for system schema "SCHEMA_OWNER"! It must not be changed in any way except by running an Oracle-supplied script! -> [Help 1]
我连接的用户是使用 alter session set"_ORACLE_SCRIPT" = true;
推荐答案
Flyway将
如果在 A schema is considered to be a system schema if it in a list of known default schemas or has 使用 Creating the user with Oracle 12c中有两种数据库:容器数据库(CDB)和可插拔数据库(PDB).这是为了支持多租户. There are two kinds of database in Oracle 12c: a Container Database (CDB) and a Pluggable Database (PDB). This is to support Multitenancy. 您当前正在CDB中创建用户,该用户将是所有PDB中的普通用户.在这种情况下,您必须在用户名前加上 You are currently creating the user in the CDB, which would be a common user across all PDBs. In that case, you must either prefix the user name with 或使用 or use the 另一种方法是连接到PDB并在那里创建本地用户(不需要前缀,该用户仅存在于该PDB中),例如: The alternative is to connect to a PDB and create a local user there (no prefix required and the user will only exists in that PDB), e.g.: 更新Flyway网址以该用户身份连接到该PDB: The update the Flyway url to connect to that PDB as that user: 这篇关于如何强制flyway清理我的docker oracle数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! ORACLE_MAINTAINED ='Y'
.ORACLE_MAINTAINED = 'Y'
. alter会话集"_ORACLE_SCRIPT" = true;
创建用户,为用户/模式设置 ORACLE_MAINTAINED ='Y'
.alter session set "_ORACLE_SCRIPT"=true;
sets ORACLE_MAINTAINED = 'Y'
for the user / schema. c ##
:c##
:create user c##scott identified by tiger;
alter会话集"_ORACLE_SCRIPT" = true;
,否则会出现错误:alter session set "_ORACLE_SCRIPT"=true;
, otherwise you will get the error:ORA-65096: invalid common user or role name in oracle
sqlplus sys/Oradoc_db1@ORCLPDB1 as sysdba
create user scott identified by tiger;
-url=jdbc:oracle:thin:@oracle-ee:1521/orclpdb1.localdomain -user="scott" -password=tiger