Oracle Database basics: understand instances, CDBs/PDBs, and transactions
Oracle Database stores and processes shared application data. Its database is the set of data files on disk; its instance is the memory structures and processes that manage those files. In the multitenant architecture, one container database (CDB) can contain several pluggable databases (PDBs), and a transaction defines which changes become permanent together or are undone. This guide focuses on the CDB model used in Oracle Database 21c and later and draws on Oracle documentation checked on November 23, 2026.
How are an Oracle Database and an instance different?
In everyday speech, “Oracle database” can refer to the whole server, but it helps to distinguish the files from the running instance. A database is a set of files on disk that stores user data. An instance consists of the System Global Area (SGA), shared memory, the Program Global Areas (PGAs) used privately by server and background processes, and the processes that manage database files. Server processes receive client requests, run SQL, and return results. The instance exists in memory and disappears when shut down; the database files remain on disk. Oracle Database instance · Memory architecture · Oracle Database concepts
In a typical single-instance configuration, one instance manages one database. Oracle Real Application Clusters (RAC) can use multiple instances to manage one shared set of database files. So “one instance = one computer = one set of database files” is not a universal rule. RAC is a separate high-availability and scaling configuration whose setup is outside this introduction. Database and instance
It is also useful to distinguish physical files from logical storage. Data files hold data blocks; tablespaces are logical storage units for database objects. Control files record database structure and state, while online redo logs record changes for recovery. Application developers do not directly edit these files to save table rows; file layout and recovery operations are normally DBA responsibilities. Oracle Database storage structures
How are CDBs and PDBs related?
In the multitenant architecture, a container database (CDB) contains pluggable databases (PDBs). A PDB is a portable collection of schemas and database objects that appears to an application as a separate database. Oracle documents CDB as the only supported architecture beginning with Oracle Database 21c; older releases also supported non-container databases. Do not apply an old non-CDB setup guide to a newer release without checking the target version’s documentation. Multitenant architecture · Oracle Database 23c concepts
A newly created CDB has CDB$ROOT, which contains Oracle-maintained metadata and common users, and PDB$SEED, a template used to create PDBs. Administrators then create user PDBs for applications. For example, an organization could put the order application’s schemas in SALES_PDB and HR schemas in HR_PDB. Clients access a root or PDB through database services; a PDB’s service identifies the container context for a connection. Common users can have privileges across containers, while a local user belongs to a particular PDB. CDB containers · Services and container access
PDBs look logically separate, but PDBs plugged into one CDB share the instance’s background processes and SGA. Each PDB has its own data files, while memory, CPU, and I/O may still draw on shared physical infrastructure. This operational implication follows from Oracle’s description of shared instance resources: creating PDBs alone does not establish separate-server performance or failure isolation. To control resource use, consider Oracle Resource Manager and operational policies at the CDB level. CDB/PDB files and resources · Database instance
| Component | What it represents | What to remember |
|---|---|---|
| Instance | Running memory structures and processes | Handles requests and manages database files |
| CDB | Database files and containers managed by an instance | Part of the database server together with the instance |
CDB$ROOT | Oracle-maintained metadata and common-user container | Not the ordinary home for application data |
PDB$SEED | System template for cloning new PDBs | Not an application database |
| PDB | User container that appears as a separate DB to an application | Has its own data files but shares CDB instance resources |
The hierarchy can be simplified as follows: the instance manages the CDB, and the CDB contains system containers and application PDBs. A PDB is not a separate running instance; PDBs in the same CDB share instance resources.
Instance (SGA + background processes)
└─ manages CDB (control, online redo, and data files)
├─ CDB$ROOT : Oracle-maintained metadata
├─ PDB$SEED : template for cloning PDBs
├─ SALES_PDB : example order application
└─ HR_PDB : example HR applicationA real CDB can have zero or more user-created PDBs; the tree is a simplified explanatory diagram, not a complete depiction of services, permissions, or file layouts.
How does a transaction make changes permanent?
A transaction groups SQL changes that belong to one unit of work. For an order, reducing stock and inserting the order record should take effect together. COMMIT makes the current transaction’s changes permanent and releases its locks. ROLLBACK undoes changes since the last commit. A SAVEPOINT lets a program undo only later changes and continue the transaction. Oracle transactions · COMMIT · DML and transactions
An Oracle transaction begins when the first executable SQL statement is encountered. For data-changing work, the first DML statement—such as INSERT, UPDATE, DELETE, or MERGE—is usually where changes begin; SET TRANSACTION can specify transaction characteristics. The example below is illustrative and was not run against a real schema. It records an order only if exactly one inventory row was adjusted.
DECLARE
l_rows PLS_INTEGER;
e_inventory_unavailable EXCEPTION;
BEGIN
UPDATE inventory
SET quantity = quantity - 1
WHERE product_id = 42
AND quantity > 0;
l_rows := SQL%ROWCOUNT;
IF l_rows <> 1 THEN
RAISE e_inventory_unavailable;
END IF;
INSERT INTO orders (product_id, quantity)
VALUES (42, 1);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE;
END;
/SQL%ROWCOUNT reports how many rows the immediately preceding SQL statement affected. If the update did not affect exactly one row, the block raises an exception; the handler rolls back the current uncommitted transaction and re-raises the error. The example assumes this unit of work owns the transaction. A full ROLLBACK can also undo earlier uncommitted work in the same session, so a real application must agree on transaction ownership and avoid rolling back unrelated work. After COMMIT, this transaction’s changes cannot be undone with ROLLBACK. PL/SQL cursor and SQL%ROWCOUNT · Transaction processing in PL/SQL · COMMIT behavior
Success of one SQL statement is not the same as commit of the whole transaction. A statement is atomic: it succeeds as a unit or fails as a unit. If a statement fails, its own work is rolled back, but earlier successful statements in the same transaction can remain uncommitted. An application is still responsible for ending its transaction explicitly. Tools can differ in what they commit on normal exit, so application code should issue COMMIT or ROLLBACK intentionally. Transaction and statement atomicity · DML and transaction control
Be especially careful with DDL. Oracle implicitly commits before every syntactically valid DDL statement and after a DDL statement completes successfully. If you update business data and then run CREATE TABLE in the same session, the implicit commit before DDL can commit the earlier update. Do not mix schema changes and business-data changes on the assumption that one later rollback will undo everything. Review the transaction effect first and generally manage schema deployment separately. Implicit DDL commits · COMMIT notes
What happens when users read and write at the same time?
Oracle uses multiversion read consistency so a query sees a consistent view of committed data at a point in time. If one session changes a salary but has not committed, another session’s query does not see that uncommitted value. Oracle uses undo data to reconstruct the earlier version needed by a reader. This means ordinary reads do not always have to block behind a writer. Data concurrency and read consistency
With the default READ COMMITTED isolation level, each SQL statement sees committed data as of the time that statement began. If several queries in one transaction must all use one shared point-in-time snapshot, SERIALIZABLE or a read-only transaction may be more appropriate. That choice can affect concurrent writes and performance, so choose it for the application’s consistency requirement. Two sessions trying to update the same row can still make one wait until the other commits or rolls back. Read consistency does not eliminate every conflict. Statement-level and transaction-level consistency · Isolation levels
For example, imagine a report queries orders and inventory while an order transaction changes both. Under ordinary statement-level consistency, each query returns a result based on its own start-time snapshot. If the report needs both results to represent the same point in time, consider whether transaction-level consistency is required. If each screen query needs only its own current result, the default READ COMMITTED level may fit. This is an illustrative decision scenario, not a universal recommendation.
What should you verify when connecting?
For a first Oracle connection, verify more than whether the server accepted the login: determine which CDB/PDB and user context you reached. Clients connect to a root or PDB through database services, and a CDB can contain multiple PDBs. SQL run in the wrong container may affect a different schema or data set than intended. The account’s privileges and whether it is a common user or local PDB user also define its administrative reach. Connecting to a container through services
Check the installed release, deployment type, and whether the database is a CDB. CDB is the supported architecture starting with 21c.
Verify the connection service and target PDB, along with the account’s required privileges.
Distinguish queries from changes, and define a transaction boundary for each unit of work that needs several changes together.
Review the application’s success path for `COMMIT`, its error path for an appropriate `ROLLBACK`, and any tool’s auto-commit option.
Before DDL, consider whether its implicit commit would finalize earlier changes; follow the DBA’s deployment process for production changes.
Judge success by more than a connection message: check the intended service/PDB and schema, whether the number of changed rows matches expectations, and whether an error leaves partial work behind. Validate with safe test data and privileges rather than modifying production data casually. The PL/SQL example in this article is illustrative and was not executed.
Scope and sources
This introduction focuses on the multitenant architecture used in Oracle Database 21c and later. Oracle AI Database 26 documentation and Oracle Database 23c concepts material were checked on November 23, 2026. It does not cover release support status, RAC setup, backup/recovery configuration, patching, upgrades, privilege-grant procedures, or performance tuning. Management responsibilities also vary between a managed service and an on-premises installation. The SQL/PLSQL example is hypothetical and untested.
[Oracle Database 23c Concepts: architecture and storage](https://docs.oracle.com/en/database/oracle/oracle-database/23/cncpt/database-concepts.pdf)
[Database Instance](https://docs.oracle.com/en/database/oracle/oracle-database/26/dbiad/db_dbinstance.html)
[Memory Architecture](https://docs.oracle.com/en/database/oracle/oracle-database/26/cncpt/memory-architecture.html)
[Introduction to Multitenant Administration](https://docs.oracle.com/en/database/oracle/oracle-database/26/multi/introduction-to-the-multitenant-architecture.html)
[Multitenant Container Database (CDB)](https://docs.oracle.com/en/database/oracle/oracle-database/26/dbiad/db_cdb.html)
[Transactions](https://docs.oracle.com/en/database/oracle/oracle-database/26/cncpt/transactions.html)
[COMMIT](https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/COMMIT.html)
[DML Statements and Transactions](https://docs.oracle.com/en/database/oracle/oracle-database/26/tdddg/dml-and-transactions.html)
[Transaction Processing and Control](https://docs.oracle.com/en/database/oracle/oracle-database/26/lnpls/transaction-processing-and-control.html)
[Data Concurrency and Consistency](https://docs.oracle.com/en/database/oracle/oracle-database/26/cncpt/data-concurrency-and-consistency.html)
[Cursors Overview](https://docs.oracle.com/en/database/oracle/oracle-database/26/lnpls/cursors-overview.html)
[Administering a CDB: Services and container access](https://docs.oracle.com/en/database/oracle/oracle-database/26/multi/administering-a-cdb-with-sql-plus.html)