{"id":104668,"date":"2025-01-02T22:52:46","date_gmt":"2025-01-02T22:52:46","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=104668"},"modified":"2025-01-03T19:36:08","modified_gmt":"2025-01-03T19:36:08","slug":"oracle-architecture-overview","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/oracle-architecture-overview\/","title":{"rendered":"Oracle Architecture Overview"},"content":{"rendered":"\n<p>I often fall back to the tried-and-true methods to understanding Oracle environments. Yes, sometimes the older ways are best, but understanding where Oracle has been and where it\u2019s going is essential to us building the best products to support this enterprise, robust RDBMS platform.<\/p>\n\n\n\n<p>I was disappointed by many of the documents out on the Oracle support site, etc., so this is an internal document to help understand how a seasoned Oracle DBA might navigate, learn and understand Oracle.<\/p>\n\n\n\n<p>In this document I will share an overview of Oracle\u2019s architecture that isn\u2019t complete, but it will give you a basic understanding of how the architecture works, especially if you are coming from other database platforms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-it-s-what-you-know\"><a id=\"post-104668-_Toc182478474\"><\/a>It\u2019s What You Know<\/h2>\n\n\n\n<p>Offer an Oracle Database Administrator a database host and say, \u201cHere, you figure out what databases are out there and the configuration. We don\u2019t know anything else about this server other than the Oracle password. You\u2019re on your own after that.\u201d There are some traditional methods most DBAs use, if left with just a terminal and a keyboard.<\/p>\n\n\n\n<p>Let\u2019s dive in on how it might likely go down\u2026<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-single-instance-identification\"><a id=\"post-104668-_Toc182478475\"><\/a>Single Instance Identification<\/h3>\n\n\n\n<p><strong>Prerequisite:<\/strong> Log into the server via a terminal session\/putty\/emulator<\/p>\n\n\n\n<p>How do you find out about the environment?<\/p>\n\n\n\n<p>Windows we can view the task manager and Windows services to identify everything, but Linux is going to be the environment most in question and most common:<\/p>\n\n\n\n<p>What is the name of the host I\u2019m running on?<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">hostname -a<\/pre>\n\n\n\n<p>What is the IP Address?<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ifconfig -a<\/pre>\n\n\n\n<p>View the<strong> \/etc\/hosts <\/strong>file, which will have the long name and short name of the Linux server, along with the IP address.<\/p>\n\n\n\n<p>What user are you logged in as?<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">whoami<\/pre>\n\n\n\n<p>What databases are running on the host?<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ps -ef | grep pmon<\/pre>\n\n\n\n<p>This command, (along with most others on Linux\/Unix) can be run inside of a SQLPlus command line session by adding a \u201c!\u201d before the Linux command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">!ps -ef | grep smon<\/pre>\n\n\n\n<p>We\u2019ll dig into this further on how we can capture more information inside the database, but if we have no access outside of the OS, this is a common way we can see what\u2019s going on.<\/p>\n\n\n\n<p>The SID is the last part of the process monitor (PMON) or System Monitor(SMON) process name:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">oracle   31   1 0 23:23 ?    00:00:00 db_pmon_ORADB1<\/pre>\n\n\n\n<p>View the <a href=\"https:\/\/www.orafaq.com\/wiki\/Oratab\">oratab<\/a> file for entries. All databases residing on the host or have run on the host are listed. It\u2019s not that all the databases ARE on the machine or running, but they at least existed at one time. This is why we trust the \u201cps -ef\u201d command, as it tells us what is currently RUNNING on the host.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">view \/etc\/oratab<\/pre>\n\n\n\n<p>Inspect the entry(entries) past the commented-out sections of the file, (those that begin with a # sign):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ORADB1:\/opt\/oracle\/product\/19.0.0\/dbhome1:N\n\nDWDB1:\/opt\/oracle\/product\/19.0.0\/dbhome2:Y<\/pre>\n\n\n\n<p>The entries also shows you the <code>ORACLE_HOME<\/code> directory, which is the Oracle software installation that this database is using, including the bin files. The \u201cN\u201d at the end signals on reboot to NOT start the database as part of the <code>autostart<\/code> script, where a \u201cY\u201d signals that it should be started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-it-s-linux-check-your-environment\"><a id=\"post-104668-_Toc182478476\"><\/a>It\u2019s Linux, Check Your Environment<\/h2>\n\n\n\n<p>You now know three things about the environment:<\/p>\n\n\n<div class=\"block-core-list\">\n<ol class=\"wp-block-list\">\n<li>The name of the database instance or instances.<\/li>\n\n\n\n<li>The <code>ORACLE_HOME<\/code> and from this, the <code>ORACLE_BASE<\/code> (\/opt\/oracle).<\/li>\n\n\n\n<li>If the database is running, (<code>PMON<\/code> is up, database background processes can be viewed.)<\/li>\n<\/ol>\n<\/div>\n\n\n<p>Now it\u2019s time to set up your environment. I\u2019m going to demonstrate the default way to do it and the manual way, too\u2026<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-environment-setup-using-oraenv-script\"><a id=\"post-104668-_Toc182478477\"><\/a>Environment Setup Using ORAENV Script<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">. oraenv\n\nORACLE_SID = [DB listed in ~\/.bashrc] &lt;enter SID here&gt;<\/pre>\n\n\n\n<p>Script sets the <code>ORACLE_BASE<\/code>, <code>ORACLE_HOME<\/code> and <code>LD_LIBRARY_PATH<\/code> if entry is in \/<code>etc\/oratab<\/code> file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-manual-setup\"><a id=\"post-104668-_Toc182478478\"><\/a>Manual Setup<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">export ORACLE_SID=ORADB1\n\nexport ORACLE_HOME=\/opt\/oracle\/product\/19.0.0\/dbhome1\n\nexport LD_LIBRARY_PATH=$ORACLE_HOME\/lib:\/usr\/lib:\/usr\/dt\/lib:\/usr\/openwin\/lib:\/usr\/ccs\/lib<\/pre>\n\n\n\n<p>Notice that I used the command \u201c<code>export<\/code>\u201d before each of the environment settings to ensure that I\u2019ve exported the variables for my session.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-checking-environment-settings\"><a id=\"post-104668-_Toc182478479\"><\/a>Checking Environment Settings<\/h3>\n\n\n\n<p>How to check if the environment is set up correctly:<\/p>\n\n\n\n<p>Use the ECHO command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo $ORACLE_SID\n\necho $ORACLE_HOME<\/pre>\n\n\n\n<p>These commands should return the values that were entered as part of the script or manual setup.<\/p>\n\n\n\n<p>Now that you\u2019ve verified the environment and may have required this to log into SQL Plus or other tool, (vs. verifying environment variables set) you can now log in:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sqlplus \/ as sysdba\n\nsqlplus user@service<\/pre>\n\n\n\n<p>The above two commands are using the <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/sqpug\/SQL-Plus-quick-start.html\">sqlplus<\/a> utility, which is the most common utility any DBA uses. It comes with Oracle and has been around for several decades. The other two most popular ways to log into an Oracle database is <a href=\"https:\/\/www.oracle.com\/database\/sqldeveloper\/technologies\/sqlcl\/\">SQLcl<\/a> which is new as Oracle 18c and is lighter weight if installed on a desktop. The other is <a href=\"https:\/\/www.oracle.com\/database\/sqldeveloper\/\">Oracle SQL Developer<\/a>, which is a UI, but has significant additional support packages and some monitoring capabilities for developers and DBAs.<\/p>\n\n\n\n<p>The first connection command is a bequeath connection. It uses the <code>ORACLE_SID<\/code> environment variable to fulfill the database name information. It is logging in as <code>SYSDBA<\/code> as the OS user, which must have OS level privileges, (<code>owner<\/code>\/<code>DBA<\/code>) to do so. As I\u2019m <code>ORACLE<\/code> on this container, I\u2019m able to do just that. The <code>WHOAMI<\/code> command earlier verified this for us as we were inspecting the environment.<\/p>\n\n\n\n<p>The second login command is for a user and uses a service name. It will not be a bequeath connection but will use a TNS names\/EZ Connect via the Oracle listener and will require this set up on the database. If the listener isn\u2019t running, then this type of connection, which is the most common for Oracle, will fail.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-main-architectures-for-oracle\"><a id=\"post-104668-_Toc182478480\"><\/a>Main Architectures for Oracle<\/h2>\n\n\n\n<p>Oracle has been around for over forty years. The first release was Oracle 2.0, which was released in the 1978. Claims of being the most widely used database begun during Oracle 7.34 days in the 1990\u2019s. Many databases you see today may have started out on this version and have been upgraded, patched and modernized throughout the decades. Due to this and the mission critical nature of these systems, the organizations and DBAs are quite risk averse and tend to not change anything unless it\u2019s absolutely necessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-versioning\"><a id=\"post-104668-_Toc182478481\"><\/a>Versioning<\/h2>\n\n\n\n<p>Oracle database versions have changed from release numbers to release years, starting with Oracle 18c. Terminal releases are the final release of that iteration and the ones that will be supported long-term. They are the release version targeted by organizations.<\/p>\n\n\n\n<p>Release numbers in italics are no longer supported by Oracle or require extended support.<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><em>10.2.0.4 (10g terminal)<\/em><\/li>\n\n\n\n<li><em>11.2.0.4 (11g terminal)<\/em><\/li>\n\n\n\n<li><em>12.1.0.2 (12c release 1)<\/em><\/li>\n\n\n\n<li><em>12.2.0.1 (12c terminal)<\/em><\/li>\n\n\n\n<li>13c (Oracle Enterprise Manager ONLY)<\/li>\n\n\n\n<li><em>18c<\/em><\/li>\n\n\n\n<li>19.24 and 19.3 (terminal)<\/li>\n\n\n\n<li>21c<\/li>\n\n\n\n<li>23ai (terminal)<\/li>\n<\/ul>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-architecture\"><a id=\"post-104668-_Toc182478482\"><\/a>Architecture<\/h2>\n\n\n\n<p>There are multiple variations in architecture to meet customer needs when architecting on-premises.<\/p>\n\n\n\n<p>The architecture options in italics are rarely seen in real-life scenarios and will be covered at a later date. The goal is to cover the most common scenarios and create diagrams for easy translations.<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Single Instance<\/li>\n\n\n\n<li>Real Application Clusters (RAC)<\/li>\n\n\n\n<li><em>Single-node RAC<\/em><\/li>\n\n\n\n<li>Multitenant, single pluggable database<\/li>\n\n\n\n<li>Multitenant, 2+ pluggable databases<\/li>\n\n\n\n<li><em>Globally Distributed Database<\/em><\/li>\n\n\n\n<li>Data Guard, passive or active configuration secondary<\/li>\n\n\n\n<li>Goldengate replication secondary<\/li>\n\n\n\n<li><em>Goldengate peer-to-peer active\/active configuration <\/em><\/li>\n\n\n\n<li>Exadata database, (along with Exadata engineered system monitoring)<\/li>\n\n\n\n<li>Oracle Database Appliance, (ODA) with or without RAC<\/li>\n<\/ul>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-database-terminology\"><a id=\"post-104668-_Toc182478483\"><\/a>Database Terminology<\/h2>\n\n\n\n<p>Oracle has unique terminology that may use term definitions that mean something different in other platforms. This is the correct definition for Oracle in the following statements.<\/p>\n\n\n\n<p><strong>SID:<\/strong> Site Identifier. This essential value can be set using the ORACLE_SID environment variable. Most DBAs set the SID to be the same as the instance name and\/or the service name, but the service name can be a unique name, too. To query this from SQLPlus:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select instance from v$thread;<\/pre>\n\n\n\n<p>The SID can be changed for the database and can be the same as other databases. There is also a unique identifier(GUID) for the database, called the DBID or in some views, DB_ID.<\/p>\n\n\n\n<p><strong>Database Name:<\/strong> As this can be different from the SID, you can query the database to verify:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select name from v$database;<\/pre>\n\n\n\n<p><strong>Service Name:<\/strong> Is often used to describe the alias used to connect to a RAC database, but it has become the standard for connecting to an Oracle database vs. using the SID. When viewing the TNSNAMES.ora file, the option to use SID= or SERVICE= will be seen in the file entries interchangeably.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select name from v$services;\n\nselect name from v$active_services;<\/pre>\n\n\n\n<p><strong>Oracle Instance:<\/strong> The service, memory allocation (aka SGA) and background processes for the database.<\/p>\n\n\n\n<p><strong>ASM:<\/strong> Automatic Storage Management \u2013 Oracle\u2019s own file manager, allowing the DBA to manage all file storage. ASM will have its own database instance, that is running and maintains all file management for the databases that reside on the database host. There are ASM utilities to manage storage, datafiles, etc. that are part of ASM.<\/p>\n\n\n\n<p><strong>Single Instance:<\/strong> Traditional architecture, where the Oracle database owns all background processes and files. There\u2019s no container database connected to the architecture. This architecture is obsolete in Oracle 23ai.<\/p>\n\n\n\n<p><strong>Multitenant:<\/strong> Oracle\u2019s container database architecture. Consists of a container database (CDB) and various pluggable databases (PDBs) which can easily be unplugged and plugged into a new CDB on a new host or cloned, etc. Any database with a CDB architecture is multitenant, but licensing doesn\u2019t go into effect until 4+ database are housed under one CDB.<\/p>\n\n\n\n<p><strong>RAC:<\/strong> Real Application Cluster for Oracle. A highly scalable and instance resilient architecture for Oracle databases with multiple nodes (database servers) sharing a single copy of the database with shared storage.<\/p>\n\n\n\n<p><strong>DG:<\/strong> Oracle Data Guard is a replication technology with a primary and a secondary, offering a passive or active, (read-only) configuration. Multiple secondaries can be configured for reporting, disaster recovery and backup, even high availability for cloud datacenters.<\/p>\n\n\n\n<p><strong>GG:<\/strong> Goldengate transactional\/log replication for Oracle. Very flexible and self-service type product that works on multiple platforms to Oracle, too.<\/p>\n\n\n\n<p><strong>RMAN:<\/strong> Oracle Recovery Manager, the go-to for all physical Oracle backups. Incredibly flexible, allowing for flashing back databases with flashback features, cold\/hot backup, incremental backup, transportable tablespace and other features.<\/p>\n\n\n\n<p><strong>Datapump:<\/strong> Oracle\u2019s import and export utility. As databases get larger, used less often due to slow performance. Import\/export tuning of datapump is commonplace these days, but the ability to create a logical export is attractive to many customers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-connecting-to-a-single-instance\"><a id=\"post-104668-_Toc182478484\"><\/a>Connecting to a Single Instance<\/h2>\n\n\n\n<p>Single instance Oracle databases were once the default architecture for Oracle. Each Oracle database owned all its own background processes, which means if you ran the following command on a Linux\/Unix server which housed multiple Oracle databases on it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ps -ef | grep pmon<\/pre>\n\n\n\n<p>You would receive something like the following as part of the results:<\/p>\n\n\n\n<p><code>oracle   31   1 0 23:23 ?    00:00:00 ora_pmon_ORADB1<\/code><br><code>oracle   47   1 0 12:11 ?    00:00:00 ora_pmon_DWDB1<\/code><br><code>oracle   89   1 0 04:18 ?    00:00:00 ora_pmon_PRDDB2<\/code><\/p>\n\n\n\n<p>The above results would mean that there are THREE Oracle single instance running on the host:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><code>ORADB1<\/code><\/li>\n\n\n\n<li><code>DWDB1<\/code><\/li>\n\n\n\n<li><code>PRDDB2<\/code><\/li>\n<\/ul>\n<\/div>\n\n\n<p>For each single database instance, there is a process where user sessions connect using various means, but most commonly use a connection string for TCP connections to the Oracle Listener, connect to the database, which has all it\u2019s own processes, redo logs, undo tablespace, schema tablespaces and temp tablespace. If the database is set up for point in time recovery (PIT), then it is in archive log mode and it will also write the redo logs to archive logs for retention required to perform PIT recoveries when needed.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1894\" height=\"954\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/11\/a-diagram-of-a-software-server-description-automa.png\" alt=\"A diagram of a software server\n\nDescription automatically generated\" class=\"wp-image-104669\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The architecture above is quite high level, but the focus is on the differences around database architecture in Oracle, while giving similarities to compare each diagram with as we proceed into the next architecture configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-connecting-to-multitenant\"><a id=\"post-104668-_Toc182478485\"><\/a>Connecting to Multitenant<\/h2>\n\n\n\n<p>As the DBA begins to understand the environment, the host and the databases they are going to be managing, a picture begins to develop. For a multitenant database, we can visualize users logging in with their username, password and service name, the listener picking up the request and then the session connecting to the database once it is authenticated.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1891\" height=\"960\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/11\/a-diagram-of-a-computer-hardware-system-descripti.png\" alt=\"A diagram of a computer hardware system\n\nDescription automatically generated with medium confidence\" class=\"wp-image-104670\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Once connected to a pluggable database (PDB), SQL statements are executed, returning results and\/or making changes to data, which are written to the undo if there is a need to roll back and also to the redo logs, in case we need to roll forward or back as part of any type of recovery step. Redo information is written to the archive logs for Point in Time recovery needs and stored along with our backups to create a complete recovery strategy.<\/p>\n\n\n\n<p>Notice that in multitenant architecture, the background processes are shared among the CDB and PDBs to save resources. Undo can be configured globally or PDB (this is a newer capability) level. The ability to archive and do point in time recovery is at a PDB level, but redo logs are owned by the Container Database (CDB) and must be configured at this higher level in the hierarchy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-connecting-to-a-rac-database\"><a id=\"post-104668-_Toc182478486\"><\/a>Connecting to a RAC Database<\/h2>\n\n\n\n<p>The second most common type of database for Oracle is Real Application Cluster, (RAC). This offers extensive scalability and instance resiliency, allowing the database to scale more than one host or virtual machine, while sharing storage between all hosts, referred to as nodes, of the RAC database. Each node of the RAC database has its own background processes, along with numerous others that are managing the connections and global cache processes that keep each node aware of what the other node or nodes are doing.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"2512\" height=\"1330\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/11\/a-diagram-of-a-computer-system-description-automa.png\" alt=\"A diagram of a computer system\n\nDescription automatically generated with medium confidence\" class=\"wp-image-104671\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>A RAC database via RMAN, can produce a single backup and perform point in time recoveries and if the application is \u201cRAC aware\u201d can even restart a process on an available node if one node fails. RAC is not a true high availability solution, as it does have shared storage and all nodes reside in the same data center, which means if there is a power outage, the database will still suffer downtime. Oracle DBAs still embrace RAC as part of their high availability solution for its ability to offer instance resiliency due to the ability to recover if there are one or more database node failures.<\/p>\n\n\n\n<p>User sessions connecting to a RAC instance, in single instance or multitenant, will connect via a scan listener, which will have multiple port configurations, directing the process to a dedicated node per service, or a round-robin availability choice. There are both automatic and resource managed isolation that can be configured as part of a scan listener administration.<\/p>\n\n\n\n<p>For true high availability, Oracle has two other solutions, Oracle Data Guard and Oracle Goldengate, which we\u2019ll dig into this farther into the documentation. For those in the SQL Server world, it\u2019s best to consider Oracle Data Guard as very similar to Always-on Availability Groups and Oracle Goldengate as similar to log replication, but again, we\u2019ll dig into that later on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-oracle-networking\"><a id=\"post-104668-_Toc182478487\"><\/a>Oracle Networking<\/h2>\n\n\n\n<p>In each of the architecture diagrams, user sessions have been clearly displayed as connecting via the Oracle Listener, but what is it?<\/p>\n\n\n\n<p>The Oracle listener is a separate utility and process in Oracle. It is configured as part of the NETCA, (Network Configuration Assistant) and is either done at the time of the installation, database creation or on its own. A listener can be 1:1 with a database or shared across databases.<\/p>\n\n\n\n<p>Configuration information is dynamic to the Listener, but in older versions, a listener.ora file contained the configuration information in a flat file format.<\/p>\n\n\n\n<p>Two of three common secondary files that are configured as part of the network configuration for the Listener are:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><code>sqlnet.ora<\/code><\/li>\n\n\n\n<li><code>tnsnames.ora<\/code><\/li>\n<\/ul>\n<\/div>\n\n\n<p>The <code>SQLNET.ora<\/code> file consists of connection configuration for timeouts, packet sizes, advanced security, wallet location, etc.<\/p>\n\n\n\n<p>The <code>TNSNAMES.ora<\/code> is the transparent network substrate file, which has connection information for each service, including databases. Each connection string will consist of the following for each of the databases:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Alias identifier, (can be anything, so multiple entries for the same database can exist in a single file)<\/li>\n\n\n\n<li>service name (SID for older databases)<\/li>\n\n\n\n<li>host name<\/li>\n\n\n\n<li>port<\/li>\n\n\n\n<li>type of connection (TCP, EZConnect, etc.)<\/li>\n<\/ul>\n<\/div>\n\n\n<p>These files are in the <code>$ORACLE_HOME\/network\/admin<\/code> directory. If not there, check for a global file that may be using a <code>$TNS_ADMIN<\/code> environment variable.<\/p>\n\n\n\n<p>The TNS file can be promoted from older installations, some back to Oracle 8, so older files hopefully have been cleaned up from the early days when this file was manually edited.<\/p>\n\n\n\n<p>There are other files that may be present in this the <code>$ORACLE_HOME\/network\/admin<\/code> directory:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><code>listener.ora<\/code><\/li>\n\n\n\n<li><code>cman.ora<\/code><\/li>\n<\/ul>\n<\/div>\n\n\n<p>The <code>LISTENER.ora<\/code> file was the predecessor to the dynamically configured listener and contained all configuration information for the Oracle Listener. The <code>CMAN.ora<\/code> is used for the Oracle connection manager for logging configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-managing-the-oracle-listener\"><a id=\"post-104668-_Toc182478488\"><\/a>Managing the Oracle Listener<\/h2>\n\n\n\n<p>To check of the listener is running, you can check its status with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lsnrctl status<\/pre>\n\n\n\n<p>To check what databases (services) are supported by the listener, the following command will return all information about each one the listener is managing:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lsnrctl services<\/pre>\n\n\n\n<p>to stop or to start a single listener:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lsnrctl stop\/start<\/pre>\n\n\n\n<p>If there are multiple listeners on an <code>ORACLE_HOME<\/code>, (software installation) then the listener name must be supplied as part of any command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lsnrctl &lt;listener name&gt; stop<\/pre>\n\n\n\n<p>Just as with other Oracle utilities, the environment must be set for the above command to complete successfully.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-oracle-s-next-level-globally-distributed-databases\"><a id=\"post-104668-_Toc182478489\"><\/a>Oracle\u2019s Next Level, Globally Distributed Databases<\/h2>\n\n\n\n<p>I touched on the limitations of Oracle single instance and RAC as part of this discussion. With the introduction of the cloud, Oracle needed to find a way to span across multiple datacenters and the globe, not just a single datacenter.<\/p>\n\n\n\n<p>As with MongoDB, CosmosDB and PostgreSQL hyperscale clustering, Oracle has its own globally distributed database, formerly known as Oracle Sharded Database. This architecture can shard data across multiple nodes and even replicate data one different nodes to offer high availability when one node is unavailable.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1945\" height=\"1321\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/11\/a-diagram-of-a-diagram-description-automatically.png\" alt=\"A diagram of a diagram\n\nDescription automatically generated\" class=\"wp-image-104672\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Unlike the other architectures demonstrated here, an Oracle globally distributed database doesn\u2019t use a dedicated Listener, but multiple listeners that are part of the Oracle Shard Director. It connects to the Global Service that directs user requests, along with the Shard catalog, to the correct node and shard or shards to satisfy the request.<\/p>\n\n\n\n<p>Per information over recent months, there is speculation that Globally Distributed Database architecture may very well replace both Oracle RAC and Oracle Data Guard as the defacto high availability solution for Oracle in tomorrow\u2019s world. It is infinitely scalable, has both high availability and disaster recovery architected into the solution, and along with Oracle\u2019s automatic process for sharding data, this could revolutionize this very resource heavy challenge to sharding existing Oracle databases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-high-level-checking-services-sids\"><a id=\"post-104668-_Toc182478490\"><\/a>High Level Checking Services\/SIDs<\/h2>\n\n\n\n<p>There\u2019s a high-level utility for TNS connections included with the Oracle Network products, called TNSPING.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tnsping &lt;service\/sid name&gt;<\/pre>\n\n\n\n<p>Example output is shown below. Notice that the utility identifies the sqlnet.ora\/tnsnames file location, (if used for the tnsnames) as part of the utility check.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> tnsping FREE<\/pre>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<p><code>TNS Ping Utility for Linux: Version 23.0.0.0.0 - Production on 12-NOV-2024 00:56:14<\/code><\/p>\n\n\n\n<p><code>Copyright (c) 1997, 2024, Oracle. All rights reserved.<\/code><\/p>\n\n\n\n<p><code>Used parameter files:<\/code><\/p>\n\n\n\n<p><code>\/opt\/oracle\/product\/23ai\/dbhomeFree\/network\/admin\/sqlnet.ora<\/code><\/p>\n\n\n\n<p><code>Used TNSNAMES adapter to resolve the alias<\/code><\/p>\n\n\n\n<p><code>Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = FREE)))<\/code><\/p>\n\n\n\n<p><code>OK (0 msec)<\/code><\/p>\n\n\n\n<p>The output clearly shows the host, port, service and configuration used. This doesn\u2019t mean you are guaranteed to connect. What this signifies is that there is a listener that is listening and can ping this service and it responds OK.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-v-views-and-environments\"><a id=\"post-104668-_Toc182478491\"><\/a>V$Views and Environments<\/h2>\n\n\n\n<p>There are considerable internal views that are accessible, residing over the data dictionary metadata providing detailed information about everything in Oracle. Some of these views are free, some require additional licensing.<\/p>\n\n\n\n<p>Reference Page: <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/21\/refrn\/static-data-dictionary-view-descriptions.html\">https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/21\/refrn\/static-data-dictionary-view-descriptions.html<\/a><\/p>\n\n\n\n<p><strong>Free views that can be used:<\/strong><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>DBA_*<\/strong> &#8211; DBA Data View<\/li>\n\n\n\n<li><strong>ALL_*<\/strong> &#8211; All Data View<\/li>\n\n\n\n<li><strong>USER_*<\/strong> &#8211; Schema Level\/User Level<\/li>\n\n\n\n<li><strong>V$_<\/strong> &#8211; Dynamic Performance, Single Instance Views<\/li>\n\n\n\n<li><strong>GV$_<\/strong> &#8211; RAC Database Global Views<\/li>\n\n\n\n<li><strong>CDB_*<\/strong> &#8211; CDB Views<\/li>\n\n\n\n<li><strong>PDB_*<\/strong> &#8211; PDB Views<\/li>\n\n\n\n<li><strong>RC_ *<\/strong> &#8211; RMAN backup views<\/li>\n<\/ul>\n<\/div>\n\n\n<p><strong>Additional Licensed views are:<\/strong><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>DBA_HIST*<\/strong> &#8211; AWR\/ASH history from V$ data<\/li>\n\n\n\n<li><strong>AWR_*<\/strong> &#8211; AWR specific Data<\/li>\n<\/ul>\n<\/div>\n\n\n<p>The above views require the diagnostic and tuning management pack to be licensed for each database, (not a global license, but per database.)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-understanding-oracle-internal-terminology\"><a id=\"post-104668-_Toc182478492\"><\/a>Understanding Oracle Internal Terminology<\/h2>\n\n\n\n<p>Understanding Oracle terminology and how it may not translate from other database platforms is important.<\/p>\n\n\n\n<p>A <code>SINGLE<\/code> Oracle instance (not Multitenant) is the:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Service<\/li>\n\n\n\n<li>Background processes<\/li>\n\n\n\n<li>Memory allocation for the database<\/li>\n<\/ul>\n<\/div>\n\n\n<p>At the command line, this is how to start an Oracle instance once the environment has been set:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">startup nomount;<\/pre>\n\n\n\n<p>In this command, we haven\u2019t started the database, and we haven\u2019t mounted any of the files connected to the database. Only the service, the initial background processes and the memory for the database have been started.<\/p>\n\n\n\n<p>We can then mount the Oracle database files:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">alter database mount;<\/pre>\n\n\n\n<p>This will initialize the <code>controlfiles<\/code>, the <code>datafiles<\/code> and <code>redo<\/code> logs. All must be present and synchronized with the <code>controlfiles<\/code>.<\/p>\n\n\n\n<p>At the last step, we can then choose to open the database or set it up as a secondary for disaster recovery or replication, etc., but for this example, we\u2019ll simply open the database:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">alter database open;<\/pre>\n\n\n\n<p>The database is now in an open state and is ready for receive process requests from directed from the listener or direct connections.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-background-processes\"><a id=\"post-104668-_Toc182478493\"><\/a>Background Processes<\/h3>\n\n\n\n<p>Reference Page: <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/21\/refrn\/background-processes.html\">https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/21\/refrn\/background-processes.html<\/a><\/p>\n\n\n\n<p>Oracle requires certain background processes to be up and running for an Oracle instance to run. These processes:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>PMON<\/strong> &#8211; Process Monitor<\/li>\n\n\n\n<li><strong>SMON<\/strong> &#8211; System Monitor<\/li>\n\n\n\n<li><strong>RECO<\/strong> &#8211; Recovery Monitor<\/li>\n\n\n\n<li><strong>LGWR<\/strong> &#8211; Log Writer<\/li>\n\n\n\n<li><strong>DBWR<\/strong> &#8211; DB Writer<\/li>\n<\/ul>\n<\/div>\n\n\n<p>There are significant number of other background processes, that if killed inadvertently or intentionally, will simply reinitiate and continue, but ones like the SMON or PMON, when killed, will crash the database.<\/p>\n\n\n\n<p>Performance data for the Automatic Workload Repository (AWR) and Active Session History (ASH) have their own background processes and memory allocation buffer. The processes:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>MMON<\/strong> &#8211; AWR Monitor<\/li>\n\n\n\n<li><strong>MMNL<\/strong> &#8211; MMON Lite for ASH<\/li>\n<\/ul>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-locating-processes-for-oracle-internally\"><a id=\"post-104668-_Toc182478494\"><\/a>Locating Processes for Oracle Internally<\/h3>\n\n\n\n<p>The following query can locate processes and the OS process from inside Oracle:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select pname, spid \nfrom v$process\nwhere pname like '%SMON%';<\/pre>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<p><code>PNAME SPID<br>----- ------------------------<br>SMON  87<\/code><\/p>\n\n\n\n<p>From the OS Level Command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ps -ef | grep 87<\/pre>\n\n\n\n<p><code>Example output:<\/code><\/p>\n\n\n\n<p><code>oracle   87   1 0 Nov11 ?    00:00:00 db_smon_FREE<\/code><\/p>\n\n\n\n<p>As you can see, the command from inside Oracle to locate the <code>SMON<\/code> process matches what is seen in the <code>ps<\/code> (process) command at the Linux command line. The master process for the Oracle database is 1, with the child process for the <code>SMON<\/code> for the <code>PDB<\/code> is #87, which matches both commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-memory-allocation-in-oracle\"><a id=\"post-104668-_Toc182478495\"><\/a>Memory Allocation in Oracle<\/h2>\n\n\n\n<p>There are two main memory areas in Oracle that are used to perform all memory tasks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-sga\"><a id=\"post-104668-_Toc182478496\"><\/a>The SGA<\/h3>\n\n\n\n<p>The System Global Area (SGA) is the main memory allocation for Oracle. It is comprised of segmented memory management to address the specific needs of the RDBMS.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1155\" height=\"616\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/11\/word-image-104668-5.png\" alt=\"\" class=\"wp-image-104673\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The database buffer cache, part of the system global area (SGA), is shared memory that stores data blocks read from data files to minimize disk I\/O and keep frequently accessed blocks accessible. When a user requests data, the system first searches the buffer cache; a cache hit allows direct memory access, while a cache miss loads the data from disk.<\/p>\n\n\n\n<p>Buffers in the cache are managed using an LRU algorithm to prioritize frequently accessed blocks, minimizing disk access. The buffer cache can be divided into pools:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>Default Pool:<\/strong> Stores blocks by default, with an 8 KB block size.<\/li>\n\n\n\n<li><strong>Keep Pool (Optional):<\/strong> Retains frequently accessed blocks to reduce I\/O operations.<\/li>\n\n\n\n<li><strong>Recycle Pool (Optional):<\/strong> Holds infrequently accessed blocks to conserve space.<\/li>\n\n\n\n<li><strong>Nondefault Pools (Optional):<\/strong> Accommodates blocks with non-standard sizes (e.g., 2 KB, 4 KB).<\/li>\n<\/ul>\n<\/div>\n\n\n<p>There is one more cache which isn\u2019t included in the diagram, called the<strong> Database Smart Flash Cache (Optional)<\/strong> extends the buffer cache using flash memory, which stores frequently accessed blocks for faster retrieval than disk. When enabled, the flash cache stores clean buffers evicted from main memory, using its own LRU chains (DEFAULT and KEEP) to manage these entries.<\/p>\n\n\n\n<p>Flash cache buffers are consistent across RAC nodes through Oracle RAC Cache Fusion, and dirty buffers are excluded from flash cache as they must undergo checkpointing in main memory.<\/p>\n\n\n\n<p>There are other areas of memory, aka pools that should be mentioned:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>Java Pool<\/strong> &#8211; Handles Java calls<\/li>\n\n\n\n<li><strong>Streams Pool<\/strong> &#8211; Oracle Streams<\/li>\n\n\n\n<li><strong>Fixed SGA<\/strong> &#8211; Fixed tables in Oracle<\/li>\n\n\n\n<li><strong>Large Pool<\/strong> &#8211; Response Queues<\/li>\n\n\n\n<li><strong>Shared Pool<\/strong><div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Library Cache<\/li>\n\n\n\n<li>Shared SQL Area<\/li>\n\n\n\n<li>Private SQL Area<\/li>\n\n\n\n<li>Data Dictionary Cache<\/li>\n\n\n\n<li>Server Result Cace<\/li>\n\n\n\n<li>Reserved Pool<\/li>\n<\/ul>\n<\/div><\/li>\n<\/ul>\n<\/div>\n\n\n<p>There is also the REDO Log Buffer that is part of the memory allocation in the database instance that is running as part of the Oracle database. These various memory areas each manage specific demands on the Oracle database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-pga\"><a id=\"post-104668-_Toc182478497\"><\/a>The PGA<\/h3>\n\n\n\n<p>The Program Global Area (PGA) is non-shared memory outside of the SGA. PGA is sized as a TARGET, with a max allocation that was only implemented in recent years.<\/p>\n\n\n\n<p>PGA handles sorting, hashing and PL\/SQL table work in Oracle. The Oracle optimizer can calculate the amount of sorting and hashing that is required of any step in an execution plan and due to poor statistics or other changes, the allocation isn\u2019t correct, the process will \u201cswap\u201d to the TEMP tablespace for anything over the memory in the PGA allocated. The goal is to perform as much sorting and hashing inside of the PGA, as memory is much faster than the TEMP tablespace, which is on disk and much slower.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1357\" height=\"621\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/11\/word-image-104668-6.png\" alt=\"\" class=\"wp-image-104674\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The PGA cache hit is based off how many times the PGA allocation was not enough to perform a task and had to go to TEMP to complete, (passes). DBAs use this cache hit percentage to determine if optimization is required of SQL, stats or PGA sizing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-uga\"><a id=\"post-104668-_Toc182478498\"><\/a>The UGA<\/h3>\n\n\n\n<p>The User Global Area (UGA) is memory allocated for session variable information, such as logons and database sessions, including session state. It handles the PL\/SQL session information and isolates it from other UGA processes, including OLAP page pools. It is only available during the life of a user session and is only part of the SGA when using a shared server connection configuration.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-datafiles-in-oracle\">Datafiles in Oracle<\/h4>\n\n\n\n<p>Now that we\u2019ve covered the database instance and memory, it\u2019s time to cover the physical files in Oracle. Oracle data is broken down by the following:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Byte<\/li>\n\n\n\n<li>Block<\/li>\n\n\n\n<li>Extent<\/li>\n\n\n\n<li>Segment<\/li>\n\n\n\n<li>Tablespace<\/li>\n\n\n\n<li>Datafile<\/li>\n<\/ul>\n<\/div>\n\n\n<p>Reversing this, you can then understand what you are viewing when you look at physical datafiles. Other physical files are:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>the <code>temp<\/code> tablespace (which is a workspace tablespace)<\/li>\n\n\n\n<li>the <code>UNDO<\/code> tablespace to retain undo processing<\/li>\n\n\n\n<li>the redo logs, multiple members as part of groups which holds the changes not yet written to the datafiles.<\/li>\n\n\n\n<li><code>Controlfiles<\/code>, which keep track of configurations, sequential change number (SCN) tracking the state of the database and all other pertinent data.<\/li>\n<\/ul>\n<\/div>\n\n\n<p>Secondary files that are important:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><code>SPFILE.ora<\/code>, has all configuration information and used to start the database instance. This file is retained in the <code>$ORACLE_HOME\/dbs<\/code> directory. It is backed up to a text version called the <code>init&lt;sid&gt;.ora<\/code> file.<\/li>\n\n\n\n<li><code>PWD&lt;sid&gt;.ora<\/code> file configures local and remote connections to the database and is created with the <code>orapwd<\/code> utility<\/li>\n<\/ul>\n<\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I often fall back to the tried-and-true methods to understanding Oracle environments. Yes, sometimes the older ways are best, but understanding where Oracle has been and where it\u2019s going is essential to us building the best products to support this enterprise, robust RDBMS platform. I was disappointed by many of the documents out on the&#8230;&hellip;<\/p>\n","protected":false},"author":316206,"featured_media":104675,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[53,143533],"tags":[4459],"coauthors":[48576],"class_list":["post-104668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-oracle-databases","tag-oracle"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/104668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/316206"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=104668"}],"version-history":[{"count":12,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/104668\/revisions"}],"predecessor-version":[{"id":105044,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/104668\/revisions\/105044"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media\/104675"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=104668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=104668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=104668"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=104668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}