Back to changelog
New
3 minute read

Oracle: Physical Attributes and Storage Clause

Atlas now inspects, diffs, and migrates the physical attributes and storage clause of Oracle tables, including PCTFREE, PCTUSED, and INITRANS, plus segment storage options such as INITIAL, NEXT, extents, and the buffer and flash cache pools.

Atlas's Oracle support models tables, columns, constraints, indexes, sequences, views, and more. This release adds the physical properties that control how a table's segment is laid out on disk to the list, so they can be declared in your desired state and kept in sync like any other attribute.

Physical Attributes

Use a physical block to set the physical attributes clause of a table. Only the values you declare are managed; anything you omit is left as-is on the database.

schema.hcl
table "T1" {  schema = schema.app  column "A" {    null = true    type = NUMBER  }  physical {    pctfree  = 5    initrans = 2  }}

Atlas emits them as part of the CREATE TABLE statement, and skips any value that is already Oracle's default (for example pctfree 10 or initrans 1):

atlas migrate diff
CREATE TABLE "T1" ("A" NUMBER) PCTFREE 5 INITRANS 2;

Storage Clause

Nest a storage block for the segment's storage clause. Sizes are given in bytes, and the cache pools (buffer_pool, flash_cache, cell_flash_cache) accept KEEP, RECYCLE/NONE, or DEFAULT.

schema.hcl
physical {  pctfree  = 5  initrans = 2  storage {    initial     = 131072    buffer_pool = KEEP  }}

Values that merely echo Oracle's or the tablespace's defaults (such as the unlimited max_extents, the DEFAULT pools, and the Oracle-managed next under an AUTOALLOCATE tablespace) are dropped, so the generated clause stays minimal:

atlas migrate diff
CREATE TABLE "T1" ("A" NUMBER) PCTFREE 5 INITRANS 2 STORAGE (INITIAL 131072 BUFFER_POOL KEEP);

Generated SQL

Most physical and storage options can be changed on an existing table, and Atlas emits an ALTER TABLE for them. Changing pctfree from 5 to 7 and initrans from 2 to 3:

atlas migrate diff
ALTER TABLE "T1" PCTFREE 7 INITRANS 3;

Switching the buffer pool from KEEP to RECYCLE:

atlas migrate diff
ALTER TABLE "T1" STORAGE (BUFFER_POOL RECYCLE);

INITIAL and MINEXTENTS are fixed at segment creation and cannot be altered, so changing one is planned as a drop and recreate of the table:

atlas migrate diff
DROP TABLE "T3";CREATE TABLE "T3" ("A" NUMBER) INITRANS 4 STORAGE (INITIAL 524288);

Getting Started

Oracle support is part of Atlas Pro. Log in and point an environment at your schema and an Oracle dev database, then declare physical blocks on the tables you want to manage:

atlas.hcl
env "local" {  dev = "oracle://system:pass@localhost:1521/FREEPDB1"  schema {    src = "file://schema.hcl"  }  migration {    dir = "file://migrations"  }}

Run atlas migrate diff to generate the migration, or atlas schema apply to sync it directly. Tables without a physical block, including Atlas's own revisions table, are left untouched, so you can adopt the feature incrementally.

featureoraclestoragephysical-attributesddl