Oracle vs. Session vs. Process: What's the Difference?
In the vast landscape of database systems, Oracle is a prominent name that often sets the stage for discussions about server processes, user sessions, and instance processes. These terms are fundamental to understanding how Oracle databases operate. Let's delve into Oracle's processing components, starting with the Oracle instance, sessions, and processes.
A running Oracle instance consists of a set of shared memory structures and background processes. These processes work together to manage database operations and ensure data integrity. But what are these processes, and how do they interact with user sessions?
Understanding Oracle Processes
Oracle databases use processes to perform various tasks. These processes can be categorized as background processes or user processes, also known as sessions.
Background processes in Oracle are normally started automatically by the database when it's first opened. They run continuously until the database is shut down. These processes include tasks such as writing dirty buffers to disk, managing checkpoints, and handling database writers.
Background Processes
The Database Writer (DBWn) is one of the key background processes. It's responsible for writing dirty buffers (data that needs to be flushed to disk) from the buffer cache to disk. This ensures data is always up-to-date and won't be lost in case of a system crash.
Another crucial process is the Checkpoint (CKPT) process. It's responsible for pinning dirty buffers, initiating the commit of non-active transactions, and writing dirty buffers to disk. This process ensures that commitments made before the checkpoint are permanent and won't roll back.
Oracle Database Sessions
On the other hand, user processes, or sessions, are those initiated by users or applications to interact with the database. Each session has its own private memory area, is associated with a specific user, and has its own set of database locks.
Each Oracle session runs as an independent thread of control. It can connect to, or disconnect from, the database independently of other sessions. Multiple users can log in at the same time, each with their own session, allowing parallel processing and concurrency in a multi-user environment.
Understanding Oracle Sessions in Detail
Sessions in Oracle are further characterized by their mode of operation - read-only or read-write. The session creates a logical connection between a user and the database, enabling the user to run SQL statements, define schema objects, and perform other database-related tasks.
A read-only session can read all the data that is not marked as VIEW WITH CHECK OPTION, cannot modify (write) data, and does not create any private temporary tablespace tables. Conversely, a read-write session can both read and write data.
Read-Only Sessions
Read-only sessions and read-write sessions are subject to different types of initialization parameters and are supported by different processes. For instance, a read-only session does not require an online redo log, whereas a read-write session does.
In a defaults settings scenario, Oracle Database sends several background jobs per hooked session. These jobs include jobs for refreshing the library cache, the data dictionary cache, and other aggressive jobs for managing the extent allocation of temporary tablespace and baracade extension.
Read-Write Sessions
Oracle Database dedicates a separate background process for each read-write session. The session-associated process communicates with the Database Writer (DBWn) process that writes the dirty blocks to disk, and the Buffer Cache Log process that logs the buffer changes.
The conception of private memory for each session is extremely useful in multi-user environments where users often have different roles and privileges. This compartmentalization prevents users from interfering with each other's operations.
From an operational standpoint, understanding the intricacies of Oracle sessions and processes enables database administrators to optimize operations, swiftly diagnose and fix problems, and maintain the overall health of the database. Looking ahead, keeping a pulse on these fundamental concepts will remain crucial as Oracle continues to innovate and advance its solutions.