Managing Oracle Database Processes

  • Published on

  • View

  • Download


Managing Oracle Database Processes. By Lecturer / Aisha Dawood. Altering the Number of Dispatchers. You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of dispatchers does not change automatically. - PowerPoint PPT Presentation


Overview of Administering an Oracle Database

Managing Oracle Database ProcessesByLecturer / Aisha Dawood1Altering the Number of DispatchersYou can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of dispatchers does not change automatically.

You change the number of dispatchers explicitly with the ALTER SYSTEM statement.

Monitor the following views to determine the load on the dispatcher processes: V$QUEUE V$DISPATCHER V$DISPATCHER_RATE

What should determine the number of dispatchers?If these views indicate that the load on the dispatcher processes is consistently high, then performance may be improved by starting additional dispatcher processes to route user requests. In contrast, if the load on dispatchers is consistently low, reducing the number of dispatchers may improve performance.2Altering the Number of DispatchersTo dynamically alter the number of dispatchers when the instance is running, use the ALTER SYSTEM statement to modify the DISPATCHERS attribute setting for an existing dispatcher configuration. You can also add new dispatcher configurations to start dispatchers with different network attributes.For example, suppose the instance was started with this DISPATCHERS setting in the initialization parameter file:DISPATCHERS='(PROT=tcp)(DISP=2)', '(PROT=tcps)(DISP=2)'To increase the number of dispatchers for the TCP/IP protocol from 2 to 3, anddecrease the number of dispatchers for the TCP/IP with SSL protocol from 2 to 1, you can issue the following statement:ALTER SYSTEM SET DISPATCHERS = '(INDEX=0)(DISP=3)', '(INDEX=1)(DISP=1)';orALTER SYSTEM SET DISPATCHERS = '(PROT=tcp)(DISP=3)', '(PROT-tcps)(DISP=1)';Note: You need not specify (DISP=1). It is optional because 1 is the default value for the DISPATCHERS parameter.3Managing Oracle Database ProcessesIf fewer than three dispatcher processes currently exist for TCP/IP, the database creates new ones. If more than one dispatcher process currently exists for TCP/IP with SSL, then the database terminates the extra ones as the connected users disconnect.Suppose that instead of changing the number of dispatcher processes for the TCP/IP protocol, you want to add another TCP/IP dispatcher that supports connection pooling. You can do so by entering the following statement:ALTER SYSTEM SET DISPATCHERS = '(INDEX=2)(PROT=tcp)(POOL=on)';4Notes on Altering DispatchersThe INDEX keyword can be used to identify which dispatcher configuration to modify. If you do not specify INDEX, then the first dispatcher configuration matching the DESCRIPTION, ADDRESS, or PROTOCOL specified will be modified. If no match is found among the existing dispatcher configurations, then a new dispatcher will be added.The INDEX value can range from 0 to n-1, where n is the current number of dispatcher configurations. If your ALTER SYSTEM statement specifies an INDEX value equal to n, where n is the current number of dispatcher configurations, a new dispatcher configuration will be added.To see the values of the current dispatcher configurations--that is, the number of dispatchers, whether connection pooling is on, and so forth--query the V$DISPATCHER_CONFIG dynamic performance view. To see which dispatcher configuration a dispatcher is associated with, query the CONF_INDX column of the V$DISPATCHER view.When you change the DESCRIPTION, ADDRESS, PROTOCOL, CONNECTIONS, TICKS, MULTIPLEX, and POOL attributes of a dispatcher configuration, the change does not take effect for existing dispatchers but only for new dispatchers. Therefore, in order for the change to be effective for all dispatchers associated with a configuration, you must forcibly kill existing dispatchers after altering the DISPATCHERS parameter, and let the database start new ones in their place with the newly specified properties. The attributes LISTENER and SERVICES are not subject to the same constraint. They apply to existing dispatchers associated with the modified configuration. Attribute SESSIONS applies to existing dispatchers only if its value is reduced. However, if its value is increased, it is applied only to newly started dispatchers.5Shutting Down Specific Dispatcher ProcessesWith the ALTER SYSTEM statement, you leave it up to the database to determine which dispatchers to shut down to reduce the number of dispatchers. Alternatively, it is possible to shut down specific dispatcher processes. To identify the name of the specific dispatcher process to shut down, use the V$DISPATCHER dynamic performance view.SELECT NAME, NETWORK FROM V$DISPATCHER;Each dispatcher is uniquely identified by a name of the form Dnnn. To shut down dispatcher D002, issue the following statement:ALTER SYSTEM SHUTDOWN IMMEDIATE 'D002';The IMMEDIATE keyword stops the dispatcher from accepting new connections and the database immediately terminates all existing connections through that dispatcher, After all sessions are cleaned up, the dispatcher process shuts down. If IMMEDIATE were not specified, the dispatcher would wait until all of its users disconnected and all of its connections terminated before shutting down.6Disabling Shared ServersYou disable shared server by setting SHARED_SERVERS to 0. No new client can connect in shared mode. However, when you set SHARED_SERVERS to 0, Oracle Database retains some shared servers until all shared server connections are closed.

The number of shared servers retained is either the number specified by the preceding setting of SHARED_SERVERS or the value of the MAX_SHARED_SERVERS parameter, whichever is smaller. If both SHARED_SERVERS and MAX_SHARED_SERVERS are set to 0, then all shared servers will terminate and requests from remaining shared server clients will be queued until the value of SHARED_SERVERS or MAX_SHARED_SERVERS is raised again.

To terminate dispatchers once all shared server clients disconnect, enter this statement:ALTER SYSTEM SET DISPATCHERS = '';Return to Monitoring Shared Server for views which are useful for obtaining information about your shared server configuration and for monitoring performance. Chapter 47About Oracle Database Background ProcessesTo maximize performance and accommodate many users, a multiprocess Oracle Database system uses background processes.

Background processes consolidate functions that would otherwise be handled by multiple database programs running for each user process.

Background processes asynchronously perform I/O and monitor other Oracle Database processes to provide increased parallelism for better performance and reliability.8Oracle Database Background ProcessesDatabase writer (DBWn) The database writer writes modified blocks from the database buffer cache to the data files.Log writer (LGWR) The log writer process writes redo log entries to disk. Redo log entries are generated in the redo log buffer of the system global area (SGA). LGWR writes the redo log entries sequentially into a redo log file.Checkpoint (CKPT) At specific times, all modified database buffers in the system global area are written to the datafiles by DBWn. This event is called a checkpoint. The checkpoint process is responsible for signalling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint.System monitor (SMON) The system monitor performs recovery when a failed instance starts up again. In a Real Application Clusters database, the SMON process of one instance can perform instance recovery for other instances that have failed. Process monitor (PMON) The process monitor performs process recovery when a user process fails. PMON is responsible for cleaning up the cache and freeing resources that the process was using. 9Oracle Database Background ProcessesArchiver (ARCn) One or more archive processes copy the redo log files to archival storage when they are full or a log switch occurs.Recoverer (RECO) The recoverer process is used to resolve distributed transactions that are pending because of a network or system failure in a distributed database. At timed intervals, the local RECO attempts to connect to remote databases and automatically complete the commit or rollback of the local portion of any pending distributed transactions.Dispatcher (Dnnn) Dispatchers are optional background processes, present only when the shared server configuration is used. Global Cache Service (LMS)In a Real Application Clusters environment, this process manages resources and provides inter-instance resource control.10Managing Processes for Parallel SQL ExecutionThe execution of many SQL statements can be parallelized. The degree of parallelism is the number of parallel execution servers that can be associated with a single operation. The degree of parallelism is determined by any of the following: A PARALLEL clause in a statement For objects referred to in a query, the PARALLEL clause that was used when the object was created or altered A parallel hint inserted into the statement A default determined by the databaseIf you parallelize the creation of a table, that table then has a parallel declaration (the PARALLEL clause) associated with it. Any subsequent DML or queries on the table, for which parallelization is possible, will attempt to use parallel execution.The following simple statement parallelizes the creation of a table and stores the result in a compressed format, using table compression:CREATE TABLE hr.admin_emp_deptPARALLEL COMPRESSAS SELECT * FROM hr.employeesWHERE department_id = 10;In this case, the PARALLEL clause tells the database to select an optimum number of parallel execution servers when creating the table.11About Parallel Execution ServersWhen an instance starts up, Oracle Database creates a pool of parallel execution servers which are available for any parallel operation. A process called the parallel execution coordinator dispatches the execution of a pool of parallel execution servers and coordinates the sending of results from all of these parallel execution servers back to the user.

The parallel execution servers are enabled by default, because by default the value for PARALLEL_MAX_SERVERS initialization parameter is set >0.

Parallelism can be used by a number of features, including transaction recovery, replication, and SQL execution.12Altering Parallel Execution for a SessionDisabling Parallel SQL ExecutionYou disable parallel SQL execution with an ALTER SESSION DISABLE PARALLEL DML|DDL|QUERY statement. All subsequent DML (INSERT, UPDATE, DELETE), DDL (CREATE, ALTER), or query (SELECT) operations are executed serially after such a statement is issued. They will be executed serially regardless of any PARALLEL clause associated with the statement or parallel attribute associated with the table or indexes involved.

The following statement disables parallel DDL operations:ALTER SESSION DISABLE PARALLEL DDL;13Altering Parallel Execution for a SessionEnabling Parallel SQL Execution

You enable parallel SQL execution with an ALTER SESSION ENABLE PARALLEL DML|DDL|QUERY statement. Subsequently, when a PARALLEL clause or parallel hint is associated with a statement, those DML, DDL, or query statements will execute in parallel. By default, parallel execution is enabled for DDL and query statements.

A DML statement can be parallelized only if you specifically issue an ALTER SESSION statement to enable parallel DML: ALTER SESSION ENABLE PARALLEL DML;14Altering Parallel Execution for a SessionForcing Parallel SQL ExecutionYou can force parallel execution of all subsequent DML, DDL, or query statements for which parallelization is possible with the ALTER SESSION FORCE PARALLEL DML|DDL|QUERY statement. Additionally you can force a specific degree of parallelism to be in effect, overriding any PARALLEL clause associated with subsequent statements. If you do not specify a degree of parallelism in this statement, the default degree of parallelism is used. However, a degree of parallelism specified in a statement through a hint will override the degree being forced.

The following statement forces parallel execution of subsequent statements and sets the overriding degree of parallelism to 5:ALTER SESSION FORCE PARALLEL DDL PARALLEL 5;15


View more >