Instance and database
A running instance provides access to the database. The database files hold persistent information on disk.
- Instance
- The system global area (SGA) and background processes. The SGA is shared memory used by Oracle processes.
- Data files
- Store database data, including the blocks that hold tables and indexes.
- Control files
- Record essential physical database structure, including file information.
- Online redo logs
- Record changes needed for recovery.
These three memory areas are in the SGA.
Example
A query needs a block from a table. When Oracle reads that block into the database buffer cache, it places a copy in the SGA. The block also remains in the data file on disk.
The database buffer cache, redo log buffer and shared pool belong to the SGA. Private process work areas belong to the program global area (PGA). Physical RAM provides the memory for these areas.
Connections and sessions
A connection carries requests between a client and the database server. A session holds the user’s identity and transaction state, and a server process handles the requests.
Session: the user's current database context, including identity and transaction state.
SQL request
- The application connects using a configured database service.
- After successful authentication, a session provides the user context.
- The client submits a SQL request through its connection.
- A server process performs the requested database work and returns a result.
A session can handle many SQL statements. Finishing one query does not end the session; its user context remains available for later requests.
Does one session always mean one server process?
A dedicated server configuration uses a server process for a client connection. Shared server configurations allow server processes to serve multiple sessions. Each session retains its own context even when server processes are shared.
Single instance and RAC
A single-instance database uses one instance. Oracle Real Application Clusters (RAC) uses multiple coordinated instances to access the same database. Each RAC instance has its own SGA and background processes.
Single-instance configuration
Oracle Real Application Clusters
Example
A server hosts two independent databases, each with its own instance and database files. These remain two separate databases even though they use the same server.
A surviving RAC instance can provide database access when the required services and shared infrastructure remain available. An existing connection to the failed instance may be interrupted; seamless application continuity requires appropriate configuration.
Shared infrastructure
Pluggable databases can use common instance resources while keeping application data logically separate.
Example
A large billing job runs in BILLING_PDB while customers place orders in ORDERS_PDB. Both workloads use shared computing resources, so the billing job can affect order response times. Their application tables remain separate. Resource controls can allocate capacity between PDBs.
Container structure
A container database (CDB) contains the root, the seed and user-created pluggable databases (PDBs). Each session works in a current container.
Container database (CDB)
CDB$ROOTSystem metadataPDB$SEEDTemplate for new PDBsORDERS_PDBApplication dataThe root supports the CDB's administration. The supplied seed is a template, and a user-created PDB can hold application schemas and data. The current container is the container in which a particular session is working.
Example
A new TEST_PDB is created using PDB$SEED as its template. TEST_PDB becomes a separate PDB with its own application data. PDB$SEED remains available as the template for later PDBs.
Session context in SQL*Plus
Use SQL*Plus to identify your user and current container.
Use an available training CDB and an account permitted to connect to its service. Run these commands in an authenticated SQL*Plus session:
SHOW USER
SHOW CON_NAME
SHOW CON_ID
SHOW USER- Displays the connected username.
SHOW CON_NAME- Displays the current container name.
SHOW CON_ID- Displays the current container's numeric identifier.
These are SQL*Plus client commands. Each reports session information without changing the current container.
Example
If a session returns the following values, the connected user is APP_READER and its current container is ORDERS_PDB:
USER is "APP_READER"
CON_NAME
------------------------------
ORDERS_PDBObject access also depends on the user’s privileges.
Exercises
Where does each item belong?
Choose the most precise category for each item.
Order the steps in a client request
Assign positions 1–4. Start with a client that has not connected yet.
Questions
Choose one answer for each question.
Answers are saved in this browser.
References
Oracle Database 19c documentation for the relationships and commands used in this revision.
- Oracle Database Instance — instance components, configurations and shutdown.
- Memory Architecture — SGA, PGA and session memory.
- Process Architecture — clients, server processes and connections.
- Physical Storage Structures — data files, control files and online redo logs.
- Overview of the Multitenant Architecture — PDB boundaries, services, shared resources, root and seed.
- SQL*Plus SHOW — USER, CON_NAME and CON_ID.
No comments:
Post a Comment