Warning: The magic method GW_GoPricing_Elementor::__wakeup() must have public visibility in /home1/stepf0sq/public_html/wp-content/plugins/go_pricing/includes/vendors/elementor/class-elementor.php on line 46

Warning: Cannot modify header information - headers already sent by (output started at /home1/stepf0sq/public_html/wp-content/plugins/go_pricing/includes/vendors/elementor/class-elementor.php:46) in /home1/stepf0sq/public_html/wp-includes/feed-rss2.php on line 8
Step Forward https://stepforwardsolution.com Best Development Company Fri, 16 Jul 2021 07:12:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 214855629 Memory Management and Memory Structures https://stepforwardsolution.com/memory-management-and-memory-structures/ https://stepforwardsolution.com/memory-management-and-memory-structures/#respond Sat, 26 Jun 2021 12:55:46 +0000 https://markitiers.in/step/?p=3504  

Oracle Database Memory Management

Memory management – focus is to maintain optimal sizes for memory structures.

  • Memory is managed based on  memory-related initialization parameters.
  • These values are stored in the init.ora file for each database.

Three basic options for memory management are as follows:

  • Automatic memory management:
    • DBA specifies the target size for instance memory.
    • The database instance automatically tunes to the target memory size.
    • Database redistributes memory as needed between the SGA and the instance PGA.
  • Automatic shared memory management:
    • This management mode is partially automated.
    • DBA specifies the target size for the SGA.
    • DBA can optionally set an aggregate target size for the PGA or managing PGA work areas individually.
  • Manual memory management:
    • Instead of setting the total memory size, the DBA sets many initialization parameters to manage components of the SGA and instance PGA individually.

If you create a database with Database Configuration Assistant (DBCA) and choose the basic installation option, then automatic memory management is the default.

The memory structures include three areas of memory:

  • System Global Area (SGA) – this is allocated when an Oracle Instance starts up.
  • Program Global Area (PGA) – this is allocated when a Server Process starts up.
  • User Global Area (UGA) – this is allocated when a user connects to create a session.

System Global Area

The SGA is a read/write memory area that stores information shared by all database processes and by all users of the database (sometimes it is called the Shared Global Area).

  • This information includes both organizational data and control information used by the Oracle Server.
  • The SGA is allocated in memory and virtual memory.
  • The size of the SGA can be established by a DBA by assigning a value to the parameter SGA_MAX_SIZE in the parameter file—this is an optional parameter.

The SGA is allocated when an Oracle instance (database) is started up based on values specified in the initialization parameter file (either PFILE or SPFILE).

The SGA has the following mandatory memory structures:

  • Database Buffer Cache
  • Redo Log Buffer
  • Java Pool
  • Streams Pool
  • Shared Pool – includes two components:
  • Library Cache
  • Data Dictionary Cache
  • Other structures (for example, lock and latch management, statistical data)

Additional optional memory structures in the SGA include:

  • Large Pool

The SHOW SGA SQL command will show you the SGA memory allocations.

  • This is a recent clip of the SGA for the DBORCL database at SIUE.
  • In order to execute SHOW SGA you must be connected with the special privilege SYSDBA (which is only available to user accounts that are members of the DBA Linux group).

SQL> connect / as sysdba

Connected.

SQL> show sga

Total System Global Area 1610612736 bytes

Fixed Size                  2084296 bytes

Variable Size            1006633528 bytes

Database Buffers          587202560 bytes

Redo Buffers               14692352 bytes

 

Early versions of Oracle used a Static SGA.  This meant that if modifications to memory management were required, the database had to be shutdown, modifications were made to the init.ora parameter file, and then the database had to be restarted.

Oracle 11g uses a Dynamic SGA.   Memory configurations for the system global area can be made without shutting down the database instance.  The DBA can resize the Database Buffer Cache and Shared Pool dynamically.

Several initialization parameters are set that affect the amount of random access memory dedicated to the SGA of an Oracle Instance.  These are:

  • SGA_MAX_SIZE:  This optional parameter is used to set a limit on the amount of virtual memory allocated to the SGA – a typical setting might be 1 GB; however, if the value for SGA_MAX_SIZE in the initialization parameter file or server parameter file is less than the sum the memory allocated for all components, either explicitly in the parameter file or by default, at the time the instance is initialized, then the database ignores the setting for SGA_MAX_SIZE.  For optimal performance, the entire SGA should fit in real memory to eliminate paging to/from disk by the operating system.
  • DB_CACHE_SIZE:  This optional parameter is used to tune the amount memory allocated to the Database Buffer Cache in standard database blocks.  Block sizes vary among operating systems.  The DBORCL database uses 8 KB blocks.  The total blocks in the cache defaults to 48 MB on LINUX/UNIX and 52 MB on Windows operating systems.
  • LOG_BUFFER:   This optional parameter specifies the number of bytes allocated for the Redo Log Buffer.
  • SHARED_POOL_SIZE:  This optional parameter specifies the number of bytes of memory allocated to shared SQL and PL/SQL.  The default is 16 MB.  If the operating system is based on a 64 bit configuration, then the default size is 64 MB.
  • LARGE_POOL_SIZE:  This is an optional memory object – the size of the Large Pool defaults to zero.  If the init.ora parameter PARALLEL_AUTOMATIC_TUNING is set to TRUE, then the default size is automatically calculated.
  • JAVA_POOL_SIZE:   This is another optional memory object.  The default is 24 MB of memory.

The size of the SGA cannot exceed the parameter SGA_MAX_SIZE minus the combination of the size of the additional parameters, DB_CACHE_SIZELOG_BUFFERSHARED_POOL_SIZELARGE_POOL_SIZE, and JAVA_POOL_SIZE.

Memory is allocated to the SGA as contiguous virtual memory in units termed granules.  Granule size depends on the estimated total size of the SGA, which as was noted above, depends on the SGA_MAX_SIZE parameter.  Granules are sized as follows:

  • If the SGA is less than 1 GB in total, each granule is 4 MB.
  • If the SGA is greater than 1 GB in total, each granule is 16 MB.

Granules are assigned to the Database Buffer Cache, Shared Pool, Java Pool, and other memory structures, and these memory components can dynamically grow and shrink.  Using contiguous memory improves system performance.  The actual number of granules assigned to one of these memory components can be determined by querying the database view named

V$BUFFER_POOL.

Granules are allocated when the Oracle server starts a database instance in order to provide memory addressing space to meet the SGA_MAX_SIZE parameter.  The minimum is 3 granules:  one each for the fixed SGA, Database Buffer Cache, and Shared Pool.  In practice, you’ll find the SGA is allocated much more memory than this.  The SELECT statement shown below shows a current_size of 1,152 granules.

SELECT name, block_size, current_size, prev_size, prev_buffers

FROM v$buffer_pool;

 

NAME                 BLOCK_SIZE CURRENT_SIZE  PREV_SIZE PREV_BUFFERS

——————– ———- ———— ———- ————

DEFAULT                    8192          560        576        71244

 

For additional information on the dynamic SGA sizing, enroll in Oracle’s Oracle11g Database Performance Tuning course.

Program Global Area (PGA)

A PGA is:

  • nonshared memory region that contains data and control information exclusively for use by an Oracle process.
  • A PGA is created by Oracle Database when an Oracle process is started.
  • One PGA exists for each Server Process and each Background Process.  It stores data and control information for a single Server Process or a single Background Process.
  • It is allocated when a process is created and the memory is scavenged by the operating system when the process terminates.  This is NOT a shared part of memory – one PGA to each process only.
  • The collection of individual PGAs is the total instance PGA, or instance PGA.
  • Database initialization parameters set the size of the instance PGA, not individual PGAs.

The Program Global Area is also termed the Process Global Area (PGA) and is a part of memory allocated that is outside of the Oracle Instance.

The content of the PGA varies, but as shown in the figure above, generally includes the following:

  • Private SQL Area: Stores information for a parsed SQL statement – stores bind variable values and runtime memory allocations.  A user session issuing SQL statements has a Private SQL Area that may be associated with a Shared SQL Area if the same SQL statement is being executed by more than one system user.  This often happens in OLTP environments where many users are executing and using the same application program.
    • Dedicated Server environment – the Private SQL Area is located in the Program Global Area.
    • Shared Server environment – the Private SQL Area is located in the System Global Area.
  • Session Memory: Memory that holds session variables and other session information.
  • SQL Work Areas: Memory allocated for sort, hash-join, bitmap merge, and bitmap create types of operations.
    • Oracle 9i and later versions enable automatic sizing of the SQL Work Areas by setting the WORKAREA_SIZE_POLICY = AUTO parameter (this is the default!) and PGA_AGGREGATE_TARGET = n (where n is some amount of memory established by the DBA). However, the DBA can let the Oracle DBMS determine the appropriate amount of memory.

User Global Area

The User Global Area is session memory.

A session that loads a PL/SQL package into memory has the package state stored to the UGA.  The package state is the set of values stored in all the package variables at a specific time. The state changes as program code the variables. By default, package variables are unique to and persist for the life of the session.

The OLAP page pool is also stored in the UGA. This pool manages OLAP data pages, which are equivalent to data blocks. The page pool is allocated at the start of an OLAP session and released at the end of the session.  An OLAP session opens automatically whenever a user queries a dimensional object such as a cube.

Note:  Oracle OLAP is a multidimensional analytic engine embedded in Oracle Database 11g.  Oracle OLAP cubes deliver sophisticated calculations using simple SQL queries – producing results with speed of thought response times.

The UGA must be available to a database session for the life of the session.  For this reason, the UGA cannot be stored in the PGA when using a shared server connection because the PGA is specific to a single process.  Therefore, the UGA is stored in the SGA when using shared server connections, enabling any shared server process access to it. When using a dedicated server connection, the UGA is stored in the PGA.

Automatic Shared Memory Management

Prior to Oracle 10G, a DBA had to manually specify SGA Component sizes through the initialization parameters, such as SHARED_POOL_SIZE, DB_CACHE_SIZE, JAVA_POOL_SIZE, and LARGE_POOL_SIZE parameters.

Automatic Shared Memory Management enables a DBA to specify the total SGA memory available through the SGA_TARGET initialization parameter.  The Oracle Database automatically distributes this memory among various subcomponents to ensure most effective memory utilization.

The DBORCL database SGA_TARGET is set in the initDBORCL.ora file:

sga_target=1610612736

With automatic SGA memory management, the different SGA components are flexibly sized to adapt to the SGA available.

Setting a single parameter simplifies the administration task – the DBA only specifies the amount of SGA memory available to an instance – the DBA can forget about the sizes of individual components. No out of memory errors are generated unless the system has actually run out of memory.  No manual tuning effort is needed.

The SGA_TARGET initialization parameter reflects the total size of the SGA and includes memory for the following components:

  • Fixed SGA and other internal allocations needed by the Oracle Database instance
  • The log buffer
  • The shared pool
  • The Java pool
  • The buffer cache
  • The keep and recycle buffer caches (if specified)
  • Nonstandard block size buffer caches (if specified)
  • The Streams Pool

If SGA_TARGET is set to a value greater than SGA_MAX_SIZE at startup, then the SGA_MAX_SIZE value is bumped up to accommodate SGA_TARGET.

When you set a value for SGA_TARGET, Oracle Database 11g automatically sizes the most commonly configured components, including:

  • The shared pool (for SQL and PL/SQL execution)
  • The Java pool (for Java execution state)
  • The large pool (for large allocations such as RMAN backup buffers)
  • The buffer cache

There are a few SGA components whose sizes are not automatically adjusted. The DBA must specify the sizes of these components explicitly, if they are needed by an application. Such components are:

  • Keep/Recycle buffer caches (controlled by DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE)
  • Additional buffer caches for non-standard block sizes (controlled by DB_nK_CACHE_SIZEn = {2, 4, 8, 16, 32})
  • Streams Pool (controlled by the new parameter STREAMS_POOL_SIZE)

The granule size that is currently being used for the SGA for each component can be viewed in the view V$SGAINFO. The size of each component and the time and type of the last resize operation performed on each component can be viewed in the view V$SGA_DYNAMIC_COMPONENTS.

SQL> select * from v$sgainfo;

More…

 

NAME                                  BYTES RES

——————————– ———- —

Fixed SGA Size                      2084296 No

Redo Buffers                       14692352 No

Buffer Cache Size                 587202560 Yes

Shared Pool Size                  956301312 Yes

Large Pool Size                    16777216 Yes

Java Pool Size                     33554432 Yes93

Streams Pool Size                         0 Yes

Granule Size                       16777216 No

Maximum SGA Size                 1610612736 No

Startup overhead in Shared Pool    67108864 No

Free SGA Memory Available                 0

11 rows selected.

Shared Pool

 

The Shared Pool is a memory structure that is shared by all system users.

  • It caches various types of program data. For example, the shared pool stores parsed SQL, PL/SQL code, system parameters, and data dictionary information.
  • The shared pool is involved in almost every operation that occurs in the database. For example, if a user executes a SQL statement, then Oracle Database accesses the shared pool.
  • It consists of both fixed and variable structures.
  • The variable component grows and shrinks depending on the demands placed on memory size by system users and application programs.

Memory can be allocated to the Shared Pool by the parameter SHARED_POOL_SIZE in the parameter file.  The default value of this parameter is 8MB on 32-bit platforms and 64MB on 64-bit platforms. Increasing the value of this parameter increases the amount of memory reserved for the shared pool.

You can alter the size of the shared pool dynamically with the ALTER SYSTEM SET command.  An example command is shown in the figure below.  You must keep in mind that the total memory allocated to the SGA is set by the SGA_TARGET parameter (and may also be limited by the SGA_MAX_SIZE if it is set), and since the Shared Pool is part of the SGA, you cannot exceed the maximum size of the SGA.  It is recommended to let Oracle optimize the Shared Pool size.

The Shared Pool stores the most recently executed SQL statements and used data definitions.  This is because some system users and application programs will tend to execute the same SQL statements often.  Saving this information in memory can improve system performance.

The Shared Pool includes several cache areas described below.

Library Cache

Memory is allocated to the Library Cache whenever an SQL statement is parsed or a program unit is called.  This enables storage of the most recently used SQL and PL/SQL statements.

If the Library Cache is too small, the Library Cache must purge statement definitions in order to have space to load new SQL and PL/SQL statements.  Actual management of this memory structure is through a Least-Recently-Used (LRU) algorithm.  This means that the SQL and PL/SQL statements that are oldest and least recently used are purged when more storage space is needed.

The Library Cache is composed of two memory subcomponents:

  • Shared SQL:  This stores/shares the execution plan and parse tree for SQL statements, as well as PL/SQL statements such as functions, packages, and triggers.  If a system user executes an identical statement, then the statement does not have to be parsed again in order to execute the statement.
  • Private SQL Area:  With a shared server, each session issuing a SQL statement has a private SQL area in its PGA.
  • Each user that submits the same statement has a private SQL area pointing to the same shared SQL area.
  • Many private SQL areas in separate PGAs can be associated with the same shared SQL area.
  • This figure depicts two different client processes issuing the same SQL statement – the parsed solution is already in the Shared SQL Area.

Data Dictionary Cache

The Data Dictionary Cache is a memory structure that caches data dictionary information that has been recently used.

  • This cache is necessary because the data dictionary is accessed so often.
  • Information accessed includes user account information, datafile names, table descriptions, user privileges, and other information.

The database server manages the size of the Data Dictionary Cache internally and the size depends on the size of the Shared Pool in which the Data Dictionary Cache resides.  If the size is too small, then the data dictionary tables that reside on disk must be queried often for information and this will slow down performance.

Server Result Cache

The Server Result Cache holds result sets and not data blocks. The server result cache contains the SQL query result cache and PL/SQL function result cache, which share the same infrastructure.

SQL Query Result Cache

This cache stores the results of queries and query fragments.

  • Using the cache results for future queries tends to improve performance.
  • For example, suppose an application runs the same SELECT statement repeatedly. If the results are cached, then the database returns them immediately.
  • In this way, the database avoids the expensive operation of rereading blocks and recomputing results.

PL/SQL Function Result Cache

The PL/SQL Function Result Cache stores function result sets.

  • Without caching, 1000 calls of a function at 1 second per call would take 1000 seconds.
  • With caching, 1000 function calls with the same inputs could take 1 second total.
  • Good candidates for result caching are frequently invoked functions that depend on relatively static data.
  • PL/SQL function code can specify that results be cached.

Buffer Caches

A number of buffer caches are maintained in memory in order to improve system response time.

Database Buffer Cache

The Database Buffer Cache is a fairly large memory object that stores the actual data blocks that are retrieved from datafiles by system queries and other data manipulation language commands.

The purpose is to optimize physical input/output of data.

When Database Smart Flash Cache (flash cache) is enabled, part of the buffer cache can reside in the flash cache.

  • This buffer cache extension is stored on a flash disk device, which is a solid state storage device that uses flash memory.
  • The database can improve performance by caching buffers in flash memory instead of reading from magnetic disk.
  • Database Smart Flash Cache is available only in Solaris and Oracle Enterprise Linux.

A query causes a Server Process to look for data.

  • The first look is in the Database Buffer Cache to determine if the requested information happens to already be located in memory – thus the information would not need to be retrieved from disk and this would speed up performance.
  • If the information is not in the Database Buffer Cache, the Server Process retrieves the information from disk and stores it to the cache.
  • Keep in mind that information read from disk is read a block at a timeNOT a row at a time, because a database block is the smallest addressable storage space on disk.

Database blocks are kept in the Database Buffer Cache according to a Least Recently Used (LRU) algorithm and are aged out of memory if a buffer cache block is not used in order to provide space for the insertion of newly needed database blocks.

There are three buffer states:

  • Unused – a buffer is available for use – it has never been used or is currently unused.
  • Clean – a buffer that was used earlier – the data has been written to disk.
  • Dirty – a buffer that has modified data that has not been written to disk.

Each buffer has one of two access modes:

  • Pinned – a buffer is pinned so it does not age out of memory.
  • Free (unpinned).

The buffers in the cache are organized in two lists:

  • the write list and,
  • the least recently used (LRU) list.

The write list (also called a write queue) holds dirty buffers – these are buffers that hold that data that has been modified, but the blocks have not been written back to disk.

The LRU list holds unused, free clean buffers, pinned buffers, and free dirty buffers that have not yet been moved to the write list.  Free clean buffers do not contain any useful data and are available for use.  Pinned buffers are currently being accessed.

When an Oracle process accesses a buffer, the process moves the buffer to the most recently used (MRU) end of the LRU list – this causes dirty buffers to age toward the LRU end of the LRU list.

When an Oracle user process needs a data row, it searches for the data in the database buffer cache because memory can be searched more quickly than hard disk can be accessed.  If the data row is already in the cache (a cache hit), the process reads the data from memory; otherwise a cache miss occurs and data must be read from hard disk into the database buffer cache.

Before reading a data block into the cache, the process must first find a free buffer. The process searches the LRU list, starting at the LRU end of the list.  The search continues until a free buffer is found or until the search reaches the threshold limit of buffers.

Each time a user process finds a dirty buffer as it searches the LRU, that buffer is moved to the write list and the search for a free buffer continues.

When a user process finds a free buffer, it reads the data block from disk into the buffer and moves the buffer to the MRU end of the LRU list.

If an Oracle user process searches the threshold limit of buffers without finding a free buffer, the process stops searching the LRU list and signals the DBWn background process to write some of the dirty buffers to disk.  This frees up some buffers.

Database Buffer Cache Block Size

The block size for a database is set when a database is created and is determined by the init.ora parameter file parameter named DB_BLOCK_SIZE.

  • Typical block sizes are 2KB4KB8KB16KB, and 32KB.
  • The size of blocks in the Database Buffer Cache matches the block size for the database.
  • The DBORCL database uses an 8KB block size.

Because tablespaces that store oracle tables can use different (non-standard) block sizes, there can be more than one Database Buffer Cache allocated to match block sizes in the cache with the block sizes in the non-standard tablespaces.

The size of the Database Buffer Caches can be controlled by the parameters DB_CACHE_SIZE and DB_nK_CACHE_SIZE to dynamically change the memory allocated to the caches without restarting the Oracle instance.

You can dynamically change the size of the Database Buffer Cache with the ALTER SYSTEM command like the one shown here:

ALTER SYSTEM SET DB_CACHE_SIZE = 96M;

You can have the Oracle Server gather statistics about the Database Buffer Cache to help you size it to achieve an optimal workload for the memory allocation.  This information is displayed from the V$DB_CACHE_ADVICE view.   In order for statistics to be gathered, you can dynamically alter the system by using the ALTER SYSTEM SET DB_CACHE_ADVICE (OFF, ON, READY) command.  However, gathering statistics on system performance always incurs some overhead that will slow down system performance.

SQL> ALTER SYSTEM SET db_cache_advice = ON;

 

System altered.

 

SQL> DESC V$DB_cache_advice;

 Name                                      Null?    Type

 —————————————– ——– ————-

 ID                                                 NUMBER

 NAME                                               VARCHAR2(20)

 BLOCK_SIZE                                         NUMBER

 ADVICE_STATUS                                      VARCHAR2(3)

 SIZE_FOR_ESTIMATE                                  NUMBER

 SIZE_FACTOR                                        NUMBER

 BUFFERS_FOR_ESTIMATE                               NUMBER

 ESTD_PHYSICAL_READ_FACTOR                          NUMBER

 ESTD_PHYSICAL_READS                                NUMBER

 ESTD_PHYSICAL_READ_TIME                            NUMBER

 ESTD_PCT_OF_DB_TIME_FOR_READS                      NUMBER

 ESTD_CLUSTER_READS                                 NUMBER

 ESTD_CLUSTER_READ_TIME                             NUMBER

 

SQL> SELECT name, block_size, advice_status FROM v$db_cache_advice;

 

NAME                 BLOCK_SIZE ADV

——————– ———- —

DEFAULT                    8192 ON

<more rows will display>

21 rows selected.

 

SQL> ALTER SYSTEM SET db_cache_advice = OFF;

 

System altered.


KEEP Buffer Pool

This pool retains blocks in memory (data from tables) that are likely to be reused throughout daily processing.  An example might be a table containing user names and passwords or a validation table of some type.

The DB_KEEP_CACHE_SIZE parameter sizes the KEEP Buffer Pool.

RECYCLE Buffer Pool

This pool is used to store table data that is unlikely to be reused throughout daily processing – thus the data blocks are quickly removed from memory when not needed.

The DB_RECYCLE_CACHE_SIZE parameter sizes the Recycle Buffer Pool.

Redo Log Buffer

The Redo Log Buffer memory object stores images of all changes made to database blocks.

  • Database blocks typically store several table rows of organizational data.  This means that if a single column value from one row in a block is changed, the block image is stored.  Changes include INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP.
  • LGWR writes redo sequentially to disk while DBWn performs scattered writes of data blocks to disk.
    • Scattered writes tend to be much slower than sequential writes.
    • Because LGWR enable users to avoid waiting for DBWn to complete its slow writes, the database delivers better performance.

The Redo Log Buffer as a circular buffer that is reused over and over.  As the buffer fills up, copies of the images are stored to the Redo Log Files that are covered in more detail in a later module.

Large Pool

The Large Pool is an optional memory structure that primarily relieves the memory burden placed on the Shared Pool.  The Large Pool is used for the following tasks if it is allocated:

  • Allocating space for session memory requirements from the User Global Area where a Shared Server is in use.
  • Transactions that interact with more than one database, e.g., a distributed database scenario.
  • Backup and restore operations by the Recovery Manager (RMAN) process.
    • RMAN uses this only if the BACKUP_DISK_IO = n and BACKUP_TAPE_IO_SLAVE = TRUE parameters are set.
    • If the Large Pool is too small, memory allocation for backup will fail and memory will be allocated from the Shared Pool.
  • Parallel execution message buffers for parallel server operations.  The PARALLEL_AUTOMATIC_TUNING = TRUE parameter must be set.

The Large Pool size is set with the LARGE_POOL_SIZE parameter – this is not a dynamic parameter.  It does not use an LRU list to manage memory.

Java Pool

The Java Pool is an optional memory object, but is required if the database has Oracle Java installed and in use for Oracle JVM (Java Virtual Machine).

  • The size is set with the JAVA_POOL_SIZE parameter that defaults to 24MB.
  • The Java Pool is used for memory allocation to parse Java commands and to store data associated with Java commands.
  • Storing Java code and data in the Java Pool is analogous to SQL and PL/SQL code cached in the Shared Pool.

Streams Pool

This pool stores data and control structures to support the Oracle Streams feature of Oracle Enterprise Edition.

  • Oracle Steams manages sharing of data and events in a distributed environment.
  • It is sized with the parameter STREAMS_POOL_SIZE.
  • If STEAMS_POOL_SIZE is not set or is zero, the size of the pool grows dynamically.
]]>
https://stepforwardsolution.com/memory-management-and-memory-structures/feed/ 0 3504
SQL Statement Processing https://stepforwardsolution.com/sql-statement-processing/ https://stepforwardsolution.com/sql-statement-processing/#respond Sat, 26 Jun 2021 12:53:14 +0000 https://markitiers.in/step/?p=3501  

SQL Statements are processed differently depending on whether the statement is a query, data manipulation language (DML) to update, insert, or delete a row, or data definition language (DDL) to write information to the data dictionary.

 

Processing a query:

  • Parse:
    • Search for identical statement in the Shared SQL Area.
    • Check syntax, object names, and privileges.
    • Lock objects used during parse.
    • Create and store execution plan.
  • Bind: Obtains values for variables.
  • Execute: Process statement.
  • Fetch: Return rows to user process.

Processing a DML statement:

  • Parse: Same as the parse phase used for processing a query.
  • Bind: Same as the bind phase used for processing a query.
  • Execute:
    • If the data and undo blocks are not already in the Database Buffer Cache, the server process reads them from the datafiles into the Database Buffer Cache.
    • The server process places locks on the rows that are to be modified. The undo block is used to store the before image of the data, so that the DML statements can be rolled back if necessary.
    • The data blocks record the new values of the data.
    • The server process records the before image to the undo block and updates the data block.  Both of these changes are made in the Database Buffer Cache.  Any changed blocks in the Database Buffer Cache are marked as dirty buffers.  That is, buffers that are not the same as the corresponding blocks on the disk.
    • The processing of a DELETE or INSERT command uses similar steps.  The before image for a DELETE contains the column values in the deleted row, and the before image of an INSERT contains the row location information.

Processing a DDL statement:

  • The execution of DDL (Data Definition Language) statements differs from the execution of DML (Data Manipulation Language) statements and queries, because the success of a DDL statement requires write access to the data dictionary.
  • For these statements, parsing actually includes parsing, data dictionary lookup, and execution.  Transaction management, session management, and system management SQL statements are processed using the parse and execute stages.  To re-execute them, simply perform another execute.
]]>
https://stepforwardsolution.com/sql-statement-processing/feed/ 0 3501
Oracle Architecture https://stepforwardsolution.com/oracle-architecture/ https://stepforwardsolution.com/oracle-architecture/#respond Sat, 26 Jun 2021 12:36:59 +0000 https://markitiers.in/step/?p=3494  

Oracle server:  An Oracle server includes an Oracle Instance and an Oracle database.

  • An Oracle database includes several different types of files:  datafiles, control files, redo log files and archive redo log files.  The Oracle server also accesses parameter files and password files.
  • This set of files has several purposes.
    • One is to enable system users to process SQL statements.
    • Another is to improve system performance.
    • Still another is to ensure the database can be recovered if there is a software/hardware failure.
  • The database server must manage large amounts of data in a multi-user environment.
  • The server must manage concurrent access to the same data.
  • The server must deliver high performance.  This generally means fast response times.

Oracle instance:  An Oracle Instance consists of two different sets of components:

  • The first component set is the set of background processes (PMON, SMON, RECO, DBW0, LGWR, CKPT, D000 and others).
    • These will be covered later in detail – each background process is a computer program.
    • These processes perform input/output and monitor other Oracle processes to provide good performance and database reliability.
  • The second component set includes the memory structures that comprise the Oracle instance.
    • When an instance starts up, a memory structure called the System Global Area (SGA) is allocated.
    • At this point the background processes also start.
  • An Oracle Instance provides access to one and only one Oracle database.

Oracle database: An Oracle database consists of files.

  • Sometimes these are referred to as operating system files, but they are actually database files that store the database information that a firm or organization needs in order to operate.
  • The redo log files are used to recover the database in the event of application program failures, instance failures and other minor failures.
  • The archived redo log files are used to recover the database if a disk fails.
  • Other files not shown in the figure include:
    • The required parameter file that is used to specify parameters for configuring an Oracle instance when it starts up.
    • The optional password file authenticates special users of the database – these are termed privileged users and include database administrators.
    • Alert and Trace Log Files – these files store information about errors and actions taken that affect the configuration of the database.

User and server processes:  The processes shown in the figure are called user and server processes.  These processes are used to manage the execution of SQL statements.

  • Shared Server Process can share memory and variable processing for multiple user processes.
  • Dedicated Server Process manages memory and variables for a single user process.

This figure from the Oracle Database Administration Guide provides another way of viewing the SGA.

Connecting to an Oracle Instance – Creating a Session

 

System users can connect to an Oracle database through SQLPlus or through an application program like the Internet Developer Suite (the program becomes the system user).  This connection enables users to execute SQL statements.

The act of connecting creates a communication pathway between a user process and an Oracle Server.  As is shown in the figure above, the User Process communicates with the Oracle Server through a Server Process.  The User Process executes on the client computer.  The Server Process executes on the server computer, and actually executes SQL statements submitted by the system user.

The figure shows a 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.

Sessions:  When a user connects to an Oracle server, this is termed a session.  The User Global Area is session memory and these memory structures are described later in this document.  The session starts when the Oracle server validates the user for connection.  The session ends when the user logs out (disconnects) or if the connection terminates abnormally (network failure or client computer failure).

A user can typically have more than one concurrent session, e.g., the user may connect using SQLPlus and also connect using Internet Developer Suite tools at the same time.  The limit of concurrent session connections is controlled by the DBA.

If a system users attempts to connect and the Oracle Server is not running, the system user receives the Oracle Not Available error message.

]]>
https://stepforwardsolution.com/oracle-architecture/feed/ 0 3494
Using Oracle Virtual Private Database to Control Data Access https://stepforwardsolution.com/using-oracle-virtual-private-database-to-control-data-access/ https://stepforwardsolution.com/using-oracle-virtual-private-database-to-control-data-access/#respond Sat, 26 Jun 2021 12:33:55 +0000 https://markitiers.in/step/?p=3492

 

Oracle Virtual Private Database (VPD) enables you to create security policies to control database access at the row and column level. Essentially, Oracle Virtual Private Database adds a dynamic WHERE clause to a SQL statement that is issued against the table, view, or synonym to which an Oracle Virtual Private Database security policy was applied.

Oracle Virtual Private Database enforces security, to a fine level of granularity, directly on database tables, views, or synonyms. Because you attach security policies directly to these database objects, and the policies are automatically applied whenever a user accesses data, there is no way to bypass security.

When a user directly or indirectly accesses a table, view, or synonym that is protected with an Oracle Virtual Private Database policy, Oracle Database dynamically modifies the SQL statement of the user. This modification creates a WHERE condition (called a predicate) returned by a function implementing the security policy. Oracle Database modifies the statement dynamically, transparently to the user, using any condition that can be expressed in or returned by a function. You can apply Oracle Virtual Private Database policies to SELECT, INSERT, UPDATE, INDEX, and DELETE statements.

For example, suppose a user performs the following query:

SELECT * FROM HR.BILLS;

The Oracle Virtual Private Database policy dynamically appends the statement with a WHERE clause. For example:

SELECT * FROM HR.BILLS
WHERE SALES_REP_ID = 159;

In this example, the user can only view orders by Sales Representative 159.

If you want to filter the user based on the session information of that user, such as the ID of the user, then you can create the WHERE clause to use an application context. For example:

SELECT * FROM HR.BILLS
WHERE SALES_REP_ID = SYS_CONTEXT (‘USERENV’,’SESSION_USER’);

Benefits of Using Oracle Virtual Private Database Policies

Oracle Virtual Private Database policies provide the following benefits:

Basing Security Policies on Database Objects Rather Than Applications

Attaching Oracle Virtual Private Database security policies to database tables, views, or synonyms, rather than implementing access controls in all your applications, provides the following benefits:

  • Security. Associating a policy with a database table, view, or synonym can solve a potentially serious application security problem. Suppose a user is authorized to use an application, and then drawing on the privileges associated with that application, wrongfully modifies the database by using an ad hoc query tool, such as SQL*Plus. By attaching security policies directly to tables, views, or synonyms, fine-grained access control ensures that the same security is in force, no matter how a user accesses the data.
  • Simplicity. You add the security policy to a table, view, or synonym only once, rather than repeatedly adding it to each of your table-based, view-based, or synonym-based applications.
  • Flexibility. You can have one security policy for SELECT statements, another for INSERT statements, and still others for UPDATE and DELETE For example, you might want to enable Human Resources clerks to have SELECT privileges for all employee records in their division, but to update only salaries for those employees in their division whose last names begin with A through F. Furthermore, you can create multiple policies for each table, view, or synonym.

Controlling How Oracle Database Evaluates Policy Functions

Running policy functions multiple times can affect performance. You can control the performance of policy functions by configuring how Oracle Database caches the Oracle Virtual Private Database predicates. The following options are available:

  • Evaluate the policy once for each query (static policies).
  • Evaluate the policy only when an application context within the policy function changes (context-sensitive policies).
  • Evaluate the policy each time it is run (dynamic policies).

Setup Test Environment

First we must create a user to act as the schema owner for this example. Obviously, you will perform the following tasks using your current schema owner.

CONNECT sys/password@service AS SYSDBA;
CREATE USER logix IDENTIFIED BY logix
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
GRANT connect, resource TO logix; 

CREATE USER user1 IDENTIFIED BY user1
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
GRANT connect, resource TO user1;

CREATE USER user2 IDENTIFIED BY user2
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
GRANT connect, resource TO user2;

GRANT EXECUTE ON DBMS_RLS TO PUBLIC;

CONN logix/logix@service

CREATE TABLE users
(id NUMBER(10) NOT NULL,
ouser VARCHAR2(30) NOT NULL,
first_name VARCHAR2(50) NOT NULL,
last_name VARCHAR2(50) NOT NULL);

CREATE TABLE user_data
(column1 VARCHAR2(50) NOT NULL,
user_id NUMBER(10) NOT NULL);

INSERT INTO users VALUES (1,’USER1′,’User’,’One’);
INSERT INTO users VALUES (2,’USER2′,’User’,’Two’);
COMMIT;

GRANT SELECT, INSERT ON user_data TO user1, user2;

Create an Application Context

Grant CREATE ANY CONTEXT to the schema owner then create the context and context package.

CONNECT sys/password@service AS SYSDBA;
GRANT create any context, create public synonym TO logix; 

CONNECT logix/logix@service;

CREATE CONTEXT LOGIX USING LOGIX.context_package;

CREATE OR REPLACE PACKAGE context_package AS
PROCEDURE set_context;
END;
/

Next we create the context_package body which will actually set the user context.

CREATE OR REPLACE PACKAGE BODY context_package IS
PROCEDURE set_context IS
v_ouser VARCHAR2(30);
v_id NUMBER;
BEGIN
DBMS_SESSION.set_context(‘LOGIX’,’SETUP’,’TRUE’);
v_ouser := SYS_CONTEXT(‘USERENV’,’SESSION_USER’); 

BEGIN
SELECT id
INTO v_id
FROM users
WHERE ouser = v_ouser;

DBMS_SESSION.set_context(‘LOGIX’,’USER_ID’, v_id);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_SESSION.set_context(‘LOGIX’,’USER_ID’, 0);
END;

DBMS_SESSION.set_context(‘LOGIX’,’SETUP’,’FALSE’);
END set_context;
END context_package;
/
SHOW ERRORS

Next we make sure that all users have access to the Context_Package.

GRANT EXECUTE ON LOGIX.context_package TO PUBLIC;
CREATE PUBLIC SYNONYM context_package FOR LOGIX.context_package;

Create Login Trigger

Next we must create a trigger to fire after the user logs onto the database.

CONNECT sys/password@service AS SYSDBA;
CREATE OR REPLACE TRIGGER LOGIX.set_security_context
AFTER LOGON ON DATABASE
BEGIN
LOGIX.context_package.set_context;
END;
/
SHOW ERRORS

Create Security Policies

In order for the context package to have any effect on the users interaction with the database, we need to define a security_package for use with the security policy. This package will tell the database how to treat any interactions with the specified table.

CONNECT logix/logix@service; 

CREATE OR REPLACE PACKAGE security_package AS
FUNCTION user_data_insert_security(owner VARCHAR2, objname VARCHAR2)
RETURN VARCHAR2;

FUNCTION user_data_select_security(owner VARCHAR2, objname VARCHAR2)
RETURN VARCHAR2;
END security_package;
/

Next we create the security_package body.

CREATE OR REPLACE PACKAGE BODY Security_Package IS
FUNCTION user_data_select_security(owner VARCHAR2, objname VARCHAR2) RETURN VARCHAR2 IS
predicate VARCHAR2(2000);
BEGIN
predicate := ‘1=2’;
IF (SYS_CONTEXT(‘USERENV’,’SESSION_USER’) = ‘LOGIX’) THEN
predicate := NULL;
ELSE
predicate := ‘USER_ID = SYS_CONTEXT(”LOGIX”,”USER_ID”)’;
END IF;
RETURN predicate;
END user_data_select_security; 

FUNCTION user_data_insert_security(owner VARCHAR2, objname VARCHAR2) RETURN VARCHAR2 IS
predicate VARCHAR2(2000);
BEGIN
predicate := ‘1=2’;
IF (SYS_CONTEXT(‘USERENV’,’SESSION_USER’) = ‘LOGIX’) THEN
predicate := NULL;
ELSE
predicate := ‘USER_ID = SYS_CONTEXT(”LOGIX”,”USER_ID”)’;
END IF;
RETURN Predicate;
END user_data_insert_security;
END security_package;
/
SHOW ERRORS

Next we make sure that all users have access to the Security_Package.

GRANT EXECUTE ON LOGIX.security_package TO PUBLIC;
CREATE PUBLIC SYNONYM security_package FOR LOGIX.security_package;

Apply Security Policies to Tables

The DBMS_RlS package is used to apply the security policay, implemented by security_package, to the the relevant tables.

BEGIN
DBMS_RLS.add_policy(‘LOGIX’, ‘USER_DATA’, ‘USER_DATA_INSERT_POLICY’,
‘LOGIX’, ‘SECURITY_PACKAGE.USER_DATA_INSERT_SECURITY’,
‘INSERT’, TRUE);
DBMS_RLS.add_policy(‘LOGIX’, ‘USER_DATA’, ‘USER_DATA_SELECT_POLICY’,
‘LOGIX’, ‘SECURITY_PACKAGE.USER_DATA_SELECT_SECURITY’,
‘SELECT’);
END;
/

Test VPD

Finally, test that the VPD is working correctly

CONNECT user1/user1@service;
INSERT INTO logix.user_data (column1, user_id) VALUES (‘User 1’, 1);
INSERT INTO logix.user_data (column1, user_id) VALUES (‘User 2’, 2);
COMMIT; 

CONNECT user2/user2@service
INSERT INTO logix.user_data (column1, user_id) VALUES (‘User 1’, 1);
INSERT INTO logix.user_data (column1, user_id) VALUES (‘User 2’, 2);
COMMIT;

CONNECT logix/logix@service
SELECT * FROM logix.user_data;
CONNECT user1/user1@Service;
SELECT * FROM logix.user_data;
CONNECT user2/user2@Service
SELECT * FROM logix.user_data;

Notice that:

  • When connected to USER1, only the first insert will work.
  • When connected to USER2, only the second insert will work.
  • The failing inserts produce the following error.
ORA-28115: policy with check option violation
  • Once the inserts are finished, there will be two rows in the table, as seen when connected as LOGIX. When connected as USER1 or USER2, only the single row they inserted will be visible.
]]>
https://stepforwardsolution.com/using-oracle-virtual-private-database-to-control-data-access/feed/ 0 3492
Oracle DBA https://stepforwardsolution.com/oracle-dba/ https://stepforwardsolution.com/oracle-dba/#respond Sat, 26 Jun 2021 12:32:14 +0000 https://markitiers.in/step/?p=3489  

A) Start Oracle Apps Process

1. Login to the Linux server system with the login credentials specified whilst installation of Oracle Apps server.

e.g. In this case, user logged in with “Oracle” user.

5

2. Check the network connectivity.

51

3. Check the filesystem for space available and required in future.

4. Refer to the last session stop log file for any error if occurred.

5. Now set the environment in the db stack (oracle db home) by executing the <dbname>_<hostname>.env

e.g. user executed below command from “/oracle/u01/oraprod/11.2.0”

. VIS_step.env

52

53

6. Now start the listener : listener start <listener name>

e.g      lsnrctl start VIS

54

7. Now login to Database as sys user and start the database.

[oracle@step 11.2.0]$ sqlplus “/as sysdba”

 

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 9 13:38:55 2016

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup

55

8. Please confirm the database is up and running along with the listener.

9. Go to APPL_TOP and set the environment of Apps.

56

10. Go to ADMIN_SCRIPTS_HOME

57

11. Now, Run adstrtal.sh to start Application Server

adstrtal.sh apps/apps

It will ask for Weblogic Password. We need to enter weblogic password.

58

12. Once the script is executed till the point we keep on receiving ——–“exited with 0” means that the everything is going on track, the moment we get exited with 1 means that part of server has not been up due to any reason, the details of the same can be viewed in the log file of the same.

B) Stop Oracle Apps Server

1. Go to APPL_TOP and set the environment of Apps.

e.g. cd /oracle/u01/applprod/fs1/EBSapps/appl

59

13. Go to ADMIN_SCRIPTS_HOME and run adstpall.sh to stop Application Server

adstpall.sh apps/apps

60

It will ask for weblogic password, which we need to provide.

61

14. Ensure that the script exits with 0 if not then refer to the log file.

15. Now before shutting down DB please ensure that all the oracle apps process is down by checking the FNDLIBR process.

ps -ef |grep FNDLIBR

62

It is showing 4 processors.

Keep on executing FNDLIBR command as above to confirm that each and every process is closed.

63

16. Now, set DB environment.

64

17. Now login to Database as sys user and stop the database.

65

66

18. Now we can stop the listener.

67

]]>
https://stepforwardsolution.com/oracle-dba/feed/ 0 3489
Differences between Various Oracle Database Versions https://stepforwardsolution.com/differences-between-various-oracle-database-versions/ https://stepforwardsolution.com/differences-between-various-oracle-database-versions/#respond Sat, 26 Jun 2021 12:30:07 +0000 https://markitiers.in/step/?p=3486  

Oracle 9i Oracle10g Oracle11g
RAC Introduced

–      Providing High avaliability

RAC Improvements

–       improved clusterware

–       Introduction of VIP’s for RAC

Further RAC Improvements

–       Faster failover of services

–       Grid Plug&Play allowing seamless additions/removal of nodes

DataGuard enhancements

–      Detection of gasps and automatic resolution

DataGuard improvements

–       Realtime apply and log compressions

–      Fast start failover added

Active DataGuard added

–       Standby Database can now be queried whilst redo apply is active

Backup and Recovery

–       Block level recovery

–      Improved reporting and automation

Data Pump added

–      Extract and import data faster than ever

Improved Manageability

–       ASM Cluster FileSystem (ACFS) Introduced

–      Virtual Columns added

 

Oracle 11g Oracle 12c
Varchar 2 Size max 4K max 32K
Multiple Indexes on a Single Column max 1 a column can be part of multiple index
Pluggable Database NA Available
In-Memory Column Store Data Buffer was available IM Column Store along with DB Cache
Data Pump Support for the In-Memory Column Store NA Available
Force full database caching mode NA Available
Oracle Multitenant option NA Available
Full transportable export/import NA Available
Target Enviroment Grid Cloud
]]>
https://stepforwardsolution.com/differences-between-various-oracle-database-versions/feed/ 0 3486
Oracle Database 11g Installation https://stepforwardsolution.com/oracle-database-11g-installation/ https://stepforwardsolution.com/oracle-database-11g-installation/#respond Sat, 26 Jun 2021 12:28:10 +0000 https://markitiers.in/step/?p=3484  

We would initiate the job by creating a VM on the base windows machine, the installation of Oracle / linux remains same with installation on base machine other than VM part.

Please follow the steps as specified in the image any explanation if required, that would be available at the bottom of the image.

11g

g1

g2

g3

g4

Over here u can use NAT as well.

1

Preferred using single file as u might see in newer versions of the VM.

2

3

Please select the first option and press enter.

4

Skip the media test option.

5

6

7

8

Please select Yes.

9

If u r aware of self creation of various partitions then u should change or rather leave it as it is.

a

Please select yes.b

If u wanna configure the n/w settings then u can use this option.

c

d

e

Please remember to select the Customize now or rather u will install the default config OS with no GUI.

f

Desktop Environments

GNOME Desktop Environment

Applications

Graphical Internet

Development

Development Libraries,  Development Tools,  GNOME Software Development,  Java Development,  X Software Development  (Select libxpdevel and openmotif)

Servers

Server Configuration Tools,  Web Server,  Windows File Server

Base System

Administration Tools,  Base , Java ,  Legacy Software Support (select compat­db) ,   System Tools  (select sysstat) , X Window System

a1

a2

a3

a4

a5

a6

Please Disbale the Firewall settings.

a8

Please Disable the Selinux Settings.

a7

Do not Enable the kdump setting as not necessary.

a9

b1

b2

b3

b4

Install VMware Tools.

b5

Drag n Drop the VMWare Tools package and unzip the same.

b7

b8

Drag n drop the .pl file to the terminal to install the vmware tools, Just keep on pressing enter.

b9

c1

  • vi /etc/sysctl.conf

net.ipv4.ip_forward = 0

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 2147483648

kernel.shmall = 2097152

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file­max = 6815744

fs.aio­max­nr = 1048576

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 1048576

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

c2

Post entry do > /sbin/sysctl -p

c3

vi  /etc/pam.d/login

add the line

session required pam_limits.so

c4

vi /etc/security/limits.conf

add the following lines

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

c5

Create the required directories

c6

vi /home/oracle/.bash_profile

add the following code line

export ORACLE_HOME=/u01/home/oracle/product/11.2.0/db_1 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export PATH=$ORACLE_HOME/bin:$PATH

c7

Now copy downloaded oracle installation files to the /tmp directory. Ensure that oracle user can access the files and folder.

c8

Switch the user to oracle and unzip both the 11g installer dir. This should create a single dir database. Post this logout and login with oracle

c9

d1

Now go to the database dir and run the runInstaller.

  • ./runInstaller

Now select the options as per your requirement to install the oracle db software.

d2

d3

d4

d6

d7

At this point you would come to know what’s missing and accordingly install the packages or perform changes in OS.

d8

d9

a1

a2

a3

a4

a5

a6

a7

a8

a9

a11

Run these scripts from root login.

a12a13a14

Now ur db is up and running and ready for use.

]]>
https://stepforwardsolution.com/oracle-database-11g-installation/feed/ 0 3484
Top 12 New Features of Oracle 12c https://stepforwardsolution.com/top-12-new-features-of-oracle-12c/ https://stepforwardsolution.com/top-12-new-features-of-oracle-12c/#respond Sat, 26 Jun 2021 12:25:33 +0000 https://markitiers.in/step/?p=3482  

1. Pluggable Databases through Database Consolidation:

Oracle is doing everything to jump into the cloud bandwagon. With 12C, Oracle is trying to address the problem of Multitenancy through this feature. There is a radical change and a major change in the core database architecture through the introduction of Container Databases also called CBD and Pluggable Databases (PDB). The memory and process is owned by the Container Database. The container holds the metadata where the PDBs hold the user data. You can create up to 253 PDBs including the seed PDB.

In a large setup, it is common to see 20 or 30 different instances running in production environment. With these many instances, it is a maintenance nightmare as all these instances have to be separately

  • Upgraded
  • Patched
  • Monitored
  • Tuned
  • RAC Enabled
  • Adjusted
  • Backed up and
  • Data Guarded.

With Pluggable Databases feature, you just have to do all this for ONE single instance. Without this feature, prior to 12C, you would have to create separate schemas and there is always a thread of security how much ever the isolation we build into it. There are problems with namespace conflicts, there is always going to be one public synonym that you can create. With PDBs you can have a separate HR or Scott schema for each PDB, separate Emp, Dept Tables and separate public synonyms. Additionally, 2 PDBs can talk to each other through the regular DB Link feature. There is no high start-up cost of creating a database any more. Instead of one instance per day, the shift is into one instance per many databases. For the developer community, you can be oblivious of all this and still continue to use the PDBs as if it were a traditional database, but for the DBAs the world would look like it has changed a lot.

Another cool feature is, you can allocate a CPU percentage for each PDB.

2. Redaction Policy:

This is one of the top features in Oracle 12C. Data Redaction in simple terms means, masking of data. You can setup a Data Redaction policy, for example SSN field in a Employee table can be masked. This is called redaction. From SQL Developer you can do this by going to the table:

Employee->Right click on Security Policy->click on New->click on Redaction Policy->Enter SSN.
When you do a select * from employee, it will show that the SSN is masked.
The new data masking will use a package called DBMS_REDACT. It is the extension to the FGAC and VPD present in earlier versions.
By doing this, whoever needs to view the data will be able to see it where as the other users will not be able to view it.

3. Top N Query and Fetch and offset Replacement to Rownum:

With the release of Oracle Database 12c, Oracle has introduced this new SQL syntax to simplify fetching the first few rows. The new sql syntax “Fetch First X Rows only” can be used.

4. Adaptive Query Optimization and Online Stats Gathering:

With this feature, it helps the optimizer to make runtime adjustments to execution plan which leads to better stats. For statements like CTAS (Create Table As Select) and IAS (Insert As Select), the stats is gathered online so that it is available immediately.

5. Restore a Table easily through RMAN:

Earlier if you had to restore a particular table, you had to do all sorts of things like restoring a tablespace and or do Export and Import. The new restore command in RMAN simplifies this task.

6. Size Limit on Varchar2, NVarchar2, Raw Data Types increased:

The previous limit on these data types was 4K. In 12C, it has been increased to 32,767 bytes. Up to 4K, the data is stored inline. I am sure everyone will be happy with this small and cute enhancement.

7. Inline PL/SQL Functions and Procedures:

The in line feature is extended in Oracle 12C. In addition to Views, we can now have PL/SQL Procedures and Functions as in line constructs. The query can be written as if it is calling a real stored procedure, but however the functions do not actually exist in the database. You will not be able to find them in ALL_OBJECTS. I think this will be a very good feature for the developers to explore as there is no code that needs to be compiled.

8. Generated as Identity/Sequence Replacement:

You can now create a col with ‘generated as identity’ clause. Thats it. Doing this is equivalent to creating a separate sequence and doing a sequence.nextval for each row. This is another handy and a neat feature which will help developer community. This is also called No Sequence Auto Increment Primary Key.

9. Multiple Indexes on a Single Column:

Prior to 12C, a column cant be in more than one index. In 12C, you can include a column in B-tree index as well as a Bit Map index. But, please note that only one index is usable at a given time.

10. Online Migration of Table Partition or Sub Partition:

You can very easily migrate a partition or sub partition from one tablespace to another. Similar to how the online migration was achieved for a non-partitioned table in prior releases, a table partition or sub partition can be moved to another tablespace online or offline. When an ONLINE clause is specified, all DML operations can be performed without any interruption on the partition|sub-partition which is involved in the procedure. In contrast, no DML operations are allowed if the partition|sub-partition is moved offline.

11. Temporary UNDO:

Prior to 12C, undo records generated by TEMP Tablespace is stored in the undo tablespace. With Temp undo feature in 12C, temp undo records can be stored in temporary table instead of UNDO TS. The benefit is – reduced undo tablespace and reduced redo log space used.

SQL> ALTER SYSTEM SET PGA_AGGREGATE_LIMIT=2G;
SQL> ALTER SYSTEM SET PGA_AGGREGATE_LIMIT=0; –disables the hard limit

12. In Database Archiving:

This feature enables archiving rows within a table by marking them as inactive. These inactive rows are in the database and can be optimized using compression but are not visible to the application. These records are skipped during FTS (Full Table Scan).

Other Features:

Advanced Replication and Streams are Dead. It is being replaced with Oracle Golden Gate.

Invisible Columns. You can now have a invisible column in a table. When a column is defined as invisible, the column won’t appear in generic queries

PGA Aggregate Limit setting:

In 12c, you can set a hard limit on PGA by enabling the automatic PGA management, which requires PGA_AGGREGATE_LIMIT parameter settings. Therefore, you can now set the hard limit on PGA by setting the new parameter to avoid excessive PGA usage.

DDL Logging:

The DDL statements will automatically get recorded in xml/log file if ENABLE_DDL_LOGGING is set to True. ALTER SYSTEM|SESSION SET ENABLE_DDL_LOGGING=TRUE

]]>
https://stepforwardsolution.com/top-12-new-features-of-oracle-12c/feed/ 0 3482
FNDLOAD https://stepforwardsolution.com/fndload/ https://stepforwardsolution.com/fndload/#respond Sat, 26 Jun 2021 12:23:22 +0000 https://markitiers.in/step/?p=3479  

FNDLOAD is an Oracle utility that allows for the transfer of a wide range of Oracle Foundation (FND) data from one instance to the other. The loader reads a configuration file (LCT) to determine what data to access. It works by downloading the data in the source instance into a text file (LDT file) that can then be uploaded into target instances. FNDLOAD ensures consistent migration of the objects within Oracle Applications

 

  1. Concurrent Program

— —————————–

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CON_PROG_SHORT_NAME.ldt PROGRAM APPLICATION_SHORT_NAME=”XXCUST” CONCURRENT_PROGRAM_NAME=”XX_CON_PROG_SHORT_NAME”

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CON_PROG_SHORT_NAME.ldt – WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

 

  1. Lookups

— ————-

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct XXCUST_LOOKUPTYPE.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME=”XXCUST” LOOKUP_TYPE=”XXCUST_LOOKUPTYPE”

 

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct XXCUST_LOOKUPTYPE.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

 

  1. Profile

— ———

FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct XXCUST_PROFILE.ldt PROFILE PROFILE_NAME=”XXCUST_PROFILE” APPLICATION_SHORT_NAME=”XXCUST”

 

$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct XXCUST_PROFILE.ldt – WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

 

  1. Request Set and Link

— ——————————

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct XXCUST_REQUESTSET.ldt REQ_SET REQUEST_SET_NAME=”XXCUST_REQUESTSET”

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct XXCUST_REQSET_LINKS.ldt REQ_SET_LINKS REQUEST_SET_NAME=”XXCUST_REQUESTSET”

Links

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct  XXCUST_REQUESTSET.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct  XXCUST_REQSET_LINKS.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

 

  1. FND Message

— ———————

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct XXCUST_MSG.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME=”XXCUST” MESSAGE_NAME=”XXCUST_MSG”

FNDLOAD apps/apps O Y UPLOAD $FND_TOP/patch/115/import/afmdmsg.lct XXCUST_MSG.ldt UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

 

  1. Alerts

— ———

FNDLOAD apps/apps 0 Y DOWNLOAD $ALR_TOP/patch/115/import/alr.lct XXCUST_ALR.ldt ALR_ALERTS APPLICATION_SHORT_NAME=XXCUST ALERT_NAME=”Alert Name”

FNDLOAD apps/apps 0 Y UPLOAD $ALR_TOP/patch/115/import/alr.lct XXCUST_ALR.ldt CUSTOM_MODE=FORCE

 

  1. Value Set

— ————–

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct XXCUST_VALSET.ldt VALUE_SET FLEX_VALUE_SET_NAME=”Custom Value Set Name”

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afffload.lct XXCUST_VALSET.ldt – WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE

 

  1. Forms personalization

— ————–

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct ARXTWMAI.ldt FND_FORM_CUSTOM_RULES form_name=ARXTWMAI

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct ARXTWMAI.ldt

 

  1. Data Definition and Associated Template

— ———————————————————-

FNDLOAD apps/apps 0 Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct XXCUST_DD_TEMPLATE.ldt XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=XBOL DATA_SOURCE_CODE=XXCUST_DD_TEMPLATE

FNDLOAD apps/trxappsttrxi 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct XXCUST_DD_TEMPLATE.ldt

 

  1. DATA_TEMPLATE (Data Source .xls and RTF file)

— ———————————————————-

java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD -DB_USERNAME apps -DB_PASSWORD apps -JDBC_CONNECTION ‘(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HOST NAME)(PORT=PORT NUMBER))(CONNECT_DATA=(SERVICE_NAME=SERVICE NAME)))’ -LOB_TYPE TEMPLATE -LOB_CODE XXCUST_CODE -APPS_SHORT_NAME XBOL -LANGUAGE en -TERRITORY 00 -lct_FILE $XDO_TOP/patch/115/import/xdotmpl.lct -LOG_FILE XXCUST_CODE.log

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD  -DB_USERNAME apps -DB_PASSWORD apps -JDBC_CONNECTION ‘(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HOST NAME)(PORT=PORT NUMBER))(CONNECT_DATA=(SERVICE_NAME=SERVICE NAME)))’ -LOB_TYPE TEMPLATE -LOB_CODE XXCUST_CODE -XDO_FILE_TYPE RTF -FILE_NAME XXCUST_CODE_RTF_FILE.rtf -APPS_SHORT_NAME XBOL -LANGUAGE en -TERRITORY 00 -CUSTOM_MODE FORCE -LOG_FILE XXCUST_CODE_RTF_UPLOAD.log

]]>
https://stepforwardsolution.com/fndload/feed/ 0 3479
USER EXIT IN REPORT – ORACLE APPS https://stepforwardsolution.com/user-exit-in-report-oracle-apps/ https://stepforwardsolution.com/user-exit-in-report-oracle-apps/#respond Sat, 26 Jun 2021 12:21:42 +0000 https://markitiers.in/step/?p=3477  

FND SRWINIT:

FND SRWINIT sets your profile option values and allows Oracle AOL user exits to detect that they have been called by a Oracle Reports program.[Before Report trigger, P_CONC_REQUEST_ID lexical parameter]. We should always call FND SRWINIT from the Before Report Trigger

SRW.USER_EXIT(‘FND SRWINIT’);

FND SRWEXIT:

FND SRWEXIT ensures that all the memory allocated for Oracle AOL user exits has been freed up properly. [After Report trigger]. You always call FND SRWEXIT from the After Report Trigger

SRW.USER_EXIT(‘FND SRWEXIT’); Note:- Mandatory Parameter with SRWINIT AND SRWEXIT is P_CONC_REQUEST_ID. Datatype Should be Number(15).

FND FORMAT_CURRENCY:

FND FORMAT_CURRENCY is used for MULTIPLE CURRNECY REPORTING (MRC)[formula Column, P_MIN_PRECISION lexical parameter]

SRW.USER_EXIT(‘FND FORMAT_CURRENCY ‘);

FND FORMAT_CURRENCY

CODE=”:column containing currency code”

DISPLAY_WIDTH=”field width for display”

AMOUNT=”:source column name”

DISPLAY=”:display column name”

[MINIMUM_PRECISION=”:P_MIN_PRECISION”] [PRECISION=”{STANDARD|EXTENDED}”] [DISPLAY_SCALING_FACTOR=””:P_SCALING_FACTOR”

 

DESCRIPTION:

CODE – Specify the column which contains the currency code for the amount. The type of this column is CHARACTER.

DISPLAY_WIDTH – Specify the width of the field in which you display the formatted amount.

AMOUNT – Specify the name of the column which contains the amount retrieved from the database. This amount is of type NUMBER.

DISPLAY – Specify the name of the column into which you want to display the formatted values. The type of this column is CHARACTER.

MINIMUM_PRECISION – Specify the precision to which to align all currencies used in this report region. You specify the MINIMUM_PRECISION token in mixed currency report regions to ensure all currency values align at the radix character for easy readability. Your user can adjust the report by setting an input parameter when submitting the report to specifically tailor the report output to a desired minimum precision or accept the default which is determined from the profile option

CURRENCY:MIXED_PRECISION (Currency: Mixed Currency Precision). Your report submission must pass the value as a report argument. You use P_MIN_PRECISION as the name of this lexical.

PRECISION – If specified as STANDARD, then standard precision is used

DISPLAY_SCALING_FACTOR- Optionally, specify the scaling factor to be applied to the amount in that column. If this token is not specified or is negative no scaling is performed. You use

P_SCALING_FACTOR as the name of this lexical parameter.

FND FLEXSQL:

FND FLEXSQL this API is used for get SELECT/WHERE/HAVING/ORDER BY/GROUP BY from flex field  tables. This call changes the value of the lexical parameter P_FLEXDATA at runtime to the SQL fragment that selects all flexfields value data. For example, the parameter changes to (SEGMENT1||’n’||SEGMENT2||’n’||SEGMENT3||’n’||SEGMENT4).

SRW.REFERENCE(:P_STRUCT_NUM);SRW.USER_EXIT(‘FND FLEXSQL CODE=”GL#” NUM=”:P_STRUCT_NUM”APPL_SHORT_NAME=”SQLGL” OUTPUT=”:P_FLEXDATA” MODE=”SELECT” DISPLAY=”ALL”‘);

FND FLEXIDVAL:

FND FLEXIDVAL this API is used for get descriptions from flex fields gets input from FND FLEXSQL.

Call this user exit to populate fields for display. You pass the key flex fields data retrieved by the query into this exit from the formula column. With this exit you display values, descriptions and prompts by passing appropriate token (VALUE/DESCRIPTION/APROMPT/LPROMPT).

it will take inputs from columns of query , the columns are defined  by FND FLEXSQL.

SRW.USER_EXIT(‘FND FLEXIDVAL’)

FND FLEXIDVALCODE=”flexfield code”APPL_SHORT_NAME=”application short name”DATA=”:source column name”[NUM=”:structure defining source column/lexical”][DISPLAY=”{ALL|flexfield qualifier|segment number}”][IDISPLAY=”{ALL|flexfield qualifier|segmentnumber}”][SHOWDEPSEG=”{Y | N}”][VALUE=”:output column name”][DESCRIPTION=”:output column name”][APROMPT=”:output column name”][LPROMPT=”:output column name”][PADDED_VALUE=”:output column name”][SECURITY=”:column name”]CODE means Key flexfield code(GL# is for Accounting Flex field, for all other check the table FND_ID_FLEXS)NUM is the structure of the key flex field(Chart of Accounts Number)DATA is where you store the retrieved data (your sql output).

]]>
https://stepforwardsolution.com/user-exit-in-report-oracle-apps/feed/ 0 3477