Docs/Engines/Oracle

Oracle

Oracle ends the transaction on every DDL statement and needs a service name or SID to connect. Identifiers you do not quote arrive upper-cased in the data dictionary.

type
oracle
Driver
python-oracledb
DDL
Auto-commits
Identifiers
Upper-cased

Install

pip install "dblift[oracle]"

Connection URL

oracle+oracledb://user:password@localhost:1521/?service_name=XEPDB1

A plain oracle:// URL is normalised to oracle+oracledb. Without a URL, DBLift builds one from host, port — 1521 unless you set it — and service_name or sid.

dblift.yaml

database:
  type: oracle
  host: db.internal
  port: 1521
  service_name: "XEPDB1"
  schema: "APP"

Engine settings

KeyDefaultEffect
service_name—Required unless sid or a full URL is given. Added to the URL query.
sid—Alternative to service_name. The two are mutually exclusive — whichever you set wins and the other is dropped.
port1521Oracle's default, applied when no port is given.
schema—Unquoted names are uppercased (myschema becomes MYSCHEMA) when DBLift connects, creates the user, writes history, and looks the name up. A double-quoted value keeps that exact case. In YAML the quotes are part of the value: schema: '"myschema"', because schema: "myschema" is the unquoted name. If ALL_USERS already contains that exact unquoted spelling and it is not uppercase, DBLift stops before creating any object or history row, including on migrate --dry-run, and tells you to quote the schema. Other engines reject a quoted schema. ${dblift_schema} expands to the catalog spelling without quotes.

Behaviour notes

DDL auto-commits, and DBLift commits explicitly after it.

The commit is not left to the driver or the session.

Unquoted identifiers are upper-cased.

my_table is stored as MY_TABLE. Quote to keep case, and quote consistently between migrations and undo scripts.

An unquoted schema is uppercased.

OSS 4.9.0 folds an unquoted schema to uppercase everywhere DBLift uses it. 4.8.0 kept the configured spelling, so a lowercase schema really did target a lowercase user. Quote the value to keep a lowercase user that already exists. To use the uppercase user, set schema to that uppercase name.

Dropping a table drops its constraints.

DBLift generates DROP TABLE … CASCADE CONSTRAINTS, so dependent foreign keys go with the table.

SQL*Plus directives are handled.

Migration files written for SQL*Plus are preprocessed rather than rejected as syntax errors.

The session is not put in autocommit.

Transactions are opened and committed by DBLift.