Saturday, January 13, 2018

DBWR (Database Writer)

dbwr

Database writer writes the content from buffer to datafiles .
The database writer process are responsible for writing modified (dirty buffers) in the database buffer cache to datafiles (disks).


DBWR1

The default is to have one database writer process, but large databases can have multiple DBWR processes.Before DBWn can write a modified buffer, all redo records associated with the changes to the buffer must be written to disk (the write-ahead protocol). If DBWn finds that some redo records have not been written, it signals LGWR to write the redo records to disk and waits for LGWR to complete writing the redo log buffer before it can write out the data buffers.
The purpose of DBWn is to improve system performance by caching writes of database blocks from the Database Buffer Cache back to datafiles. Blocks that have been modified and that need to be written back to disk are termed "dirty blocks."
The DBWn also ensures that there are enough free buffers in the Database Buffer Cache to service Server Processes that may be reading data from datafiles into the Database Buffer Cache.
Performance improves because by delaying writing changed database blocks back to disk, a Server Process may find the data that is needed to meet a User Process request already residing in memory!

How DBWn Works:

When a buffer in the database buffer cache is modified, it is marked dirty.A cold buffer is a buffer that has not been recently used according to the least recently used (LRU) algorithm. The DBWn process writes cold, dirty buffers to disk so that user processes are able to find cold, clean buffers that can be used to read new blocks into the cache. As buffers are dirtied by user processes, the number of free buffers diminishes. If the number of free buffers drops too low, user processes that must read blocks from disk into the cache are not able to find free buffers. DBWn manages the buffer cache so that user processes can always find free buffers.By writing cold, dirty buffers to disk, DBWn improves the performance of finding free buffers while keeping recently used buffers resident in memory.

For example,
blocks that are part of frequently accessed small tables or indexes are kept in the cache so that they do not need to be read in again from disk. The LRU algorithm keeps more frequently accessed blocks in the buffer cache so that when a buffer is written to disk, it is unlikely to contain data that will be useful soon.The initialization parameter DB_WRITER_PROCESSES specifies the number of DBWn processes. The maximum number of DBWn processes is depend upon oracle version . its vary from version to version . If it is not specified by the user during startup, Oracle determines how to set DB_BLOCK_PROCESSES based on the number of CPUs and processor groups.
The DBWn process writes dirty buffers to disk under the following conditions:
When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes dirty buffers to disk asynchronously while performing other processing.

PMON (Process Monitor)

PMON

The Process Monitor (PMON) monitors other background processes
It is a cleanup type of process that cleans up after failed processes.
Examples include the dropping of a user connection due to a network failure or the abnormal termination (ABEND) of a user application program.
It cleans up the database buffer cache and releases resources that were used by a failed user process.
PMON constantly checks the status of user and database processes. In some cases, failed database processes can be restarted by PMON.
PMON resets the status of the active transaction table, releases locks that are no longer required, and removes the process ID from the list of active processes.
PMON also registers information about the instance and dispatcher processes with the network listener (see "The Oracle Net Listener"). When an instance starts, PMON polls the listener to determine whether it is running. If the listener is running, then PMON passes it relevant parameters. If it is not running, then PMON periodically attempts to contact it.

Like SMON, PMON checks regularly to see whether it is needed; it can be called if another
process detects the need for it.

SMON (System Monitor)

SMON

The System Monitor process (SMON) performs recovery at instance startup if necessary. SMON
is also responsible for cleaning up temporary segments that are no longer in use. If any
terminated transactions were skipped during instance recovery because of file-read or offline
errors, SMON recovers them when the tablespace or file is brought back online.
SMON checks regularly to see whether the process is needed. Other processes can call SMON if
they detect a need for it.
 Instance recovery consists of the following steps:
  1. Rolling forward to recover data that has not been recorded in the data files but that has been recorded in the online redo log. This data has not been written to disk because of the loss of the SGA during instance failure. During this process, SMON reads the redo log files and applies the changes recorded in the redo log to the data blocks. Because all committed transactions have been written to the redo logs, this process completely recovers these transactions. its also perform crash recovery
  2. Opening the database so that users can log on. Any data that is not locked by un recovered transactions is immediately available.
  3. Rolling back uncommitted transactions. They are rolled back by SMON or by the individual server processes as they access locked data.
SMON also performs some space maintenance functions:
  • It combines, or coalesces, adjacent areas of free space in the data files.
  • It deallocates temporary segments to return them as free space in data files. Temporary segments are used to store data during SQL statement processing.
  • In  RAC environment the SMON process of one instance can perform instance recovery for other instances that have failed.
  • SMON wakes up about every 5 minutes to perform housekeeping activities

Oracle Background Process

To maximize the performance and accommodate many users, a multiprocessing oracle system use some additional database process called background process.
The relationship between the physical and memory structures is maintained and enforced by Oracle’s background processes.

Mandatory background process :
  • System monitor (SMON)
  • Process monitor (PMON)
  • Database writer (DBWR)
  • Log writer (LGWR)
  • Checkpoint (CKPT)
Optional process:
  • Archival  (ARCn)

What is Oracle Database

Oracle database is a collection of data treated as a unit. The purpose of a database is to store and retrieve related information.
A database server is the key to solving the problems of information management which can be to efficiently retrieved, updated and analyzed and authenticated .
A database is a collection of information that is organized so that it can be easily accessed, managed and updated.
Oracle Database Architecture consists of following three main structures:
  • Storage Structure
  • Memory Structure
  • Process Structure
When a database is created, database files are created. These files include Control files, Data files, online redo log files, parameter file and password file. All these files
formulate “Storage Structure”.

DB_stru

When oracle Database is started on Database Server, oracle software allocates shared memory area and also starts several processes to run database. The shared memory area is called System Global Area (SGA).The combination of System Global Area and background Processes is known as Oracle Instance. Oracle Instance formulates Memory Structure and Process Structure.Each instance in oracle server is associated with a specific database. The process of assigning an instance to a database is called Mounting. After mounting, database is opened and becomes accessible for users. Multiple instances can run on single computer.

In RAC (Real Application Cluster)  more than one  instance point to single database.

                                  Instance=SGA + Background process


DB

Wednesday, December 27, 2017

Resolving TNS – Message 3511 not found

C:\Users\Administrator.ANURAG-PC>tnsping ducat

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 27-DEC-2017 21:46:23

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Message 3511 not found; No message file for product=NETWORK, facility=TNSTNS-03505: Message 3505 not found; No message file for product=NETWORK, facility=TNS

C:\Users\Administrator.ANURAG-PC>set ORACLE_BASE=D:\app\ANURAG

C:\Users\Administrator.ANURAG-PC>tnsping ducat

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 27-DEC-2017 21:53:16

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Message 3511 not found; No message file for product=NETWORK, facility=TNSTNS-03505: Message 3505 not found; No message file for product=NETWORK, facility=TNS

C:\Users\Administrator.ANURAG-PC>set ORACLE_HOME=D:\app\ANURAG\product\11.2.0\client_1

C:\Users\Administrator.ANURAG-PC>
C:\Users\Administrator.ANURAG-PC>


Solution
=============

C:\Users\Administrator.ANURAG-PC>set ORACLE_BASE=D:\app\ANURAG

C:\Users\Administrator.ANURAG-PC>tnsping ducat

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 27-DEC-2017 21:53:16

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Message 3511 not found; No message file for product=NETWORK, facility=TNSTNS-03505: Message 3505 not found; No message file for product=NETWORK, facility=TNS

C:\Users\Administrator.ANURAG-PC>set ORACLE_HOME=D:\app\ANURAG\product\11.2.0\client_1

C:\Users\Administrator.ANURAG-PC>
C:\Users\Administrator.ANURAG-PC>
C:\Users\Administrator.ANURAG-PC>tnsping ducat

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 27-DEC-2017 21:53:44

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Used parameter files:
D:\app\ANURAG\product\11.2.0\client_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.48)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ducat)))
OK (0 msec)

C:\Users\Administrator.ANURAG-PC>

Tuesday, December 19, 2017

Connecting to an Oracle Instance

Connecting to an Oracle Instance


Before users can submit SQL statements to an Oracle database, they must connect to an instance.





• The user starts a tool such as SQL*Plus,sql developer,toad or runs an application developed using a tool such as Oracle Forms. This application or tool is executed as a user process.

• In the most basic configuration, when a user logs on to the Oracle server, a process is created on the computer running the Oracle server. This process is called a server process. The server process communicates with the Oracle instance on behalf of the user process that runs on the client. The server process executes SQL statements on behalf of the user.

User Process is started at the time a database user request  a connection to the oracle server .
Server Process connect to the oracle instance and started when a user establish a session .

user process & server process are used to manage the execution of sql/plsql statements .

one-to-one correspondence between the User and Server Processes. This is called a Dedicated Server connection. An alternative configuration is to use a Shared Server where more than one User Process shares a Server Process.

Server Process is the go-between for a Client Process and the Oracle Instance.

Dedicated Server environment – there is a single Server Process to serve each Client Process.

Shared Server environment – a Server Process can serve several User Processes, although with some performance reduction


Connection
A connection is a communication pathway between a user process and an Oracle server. A database user can connect to an Oracle server using tool, sqlplus etc.

Sessions
A session is a specific connection of a user to an Oracle server. The session starts when the user is validated by the Oracle server, and it ends when the user logs out or when there is an abnormal termination. For a given database user, many concurrent sessions are possible if the user logs on from many tools, applications, or terminals at the same time.




How to create Nano Banana 3D figurine step-by-step?

1. Launch Google Gemini or open Google AI Studio. 2. Select and upload the photo you want to convert. 3. Enter the following nanao banana 3...