Showing posts with label 12c. Show all posts
Showing posts with label 12c. Show all posts

Thursday, 12 July 2018

LREG New BG Process In 12c

In 11.2 Pmon process propogates the service metrics to the listeners regitered in local_listener adn remote_listener initialization parameter.

As the remote_listener specifies specifies the address of scan listener and the local_listener parameter specifies the address of the VIP listener, PMON process propogates the service metrics to both SCAN and VIP listeners.

You can trace listener registration using the following command.

alter system set event='immediate trace name listener_registration level 15';

Now in 12c version listener registration is permed by a new mandatory background process named LREG.
And if you want to trace then LREG trace file getting to all info about listener registration.

Advantage : Not recommneding that you create 50+ of unnecessary services,you should create
as many services as you need to split the application into manageable and disjointed workload.

In 11gR2 if there are 50+/100+ services and listeners then there is a possiblilyt that the PMON process
might spend more time on service registration to listener.

But in 12c this possibility is eliminated as the LREG backgroud process which is totally dedicated for registering the services to Listener.

and PMON is freed from listener registration.

Friday, 22 January 2016

12c New Features

--------------------
Part 1 Covers:
--------------------
CDB & PDB
Online migration of an active data file
Online table partition or sub-partition migration
Invisible column
Multiple indexes on the same column
DDL logging  ( $DIAG )
Temporary undo in- and- outs
New backup user privilege
How to execute SQL statement in RMAN
Table level recovery in RMAN
Restricting PGA size
Smart Flash Cache
 Automatic Big Table Cache 12.1.0.2c (ABTC)


--------------------
Part 2 Covers:
--------------------
Table partition maintenance enhancements
Database upgrade improvements
Restore/Recover data file over the network
Data Pump enhancements
Real-time ADDM
Concurrent statistics gathering
TDE Re-create master key after deleting

--------------------------------------
Part 3 RAC & ASM Covers:
--------------------------------------
Additions/Enhancements in ASM
        * Flex ASM
* Increased ASM storage limits
* Tuning ASM rebalance operations
* ASM Disk Scrubbing
* Active Session History (ASH) for ASM

Additions/Enhancements in Grid Infrastructure
* Flex Clusters
* OCR backup in ASM disk group
* IPv6 support

Additions/Enhancements in Real Application Cluster (database)
* What-If command evaluation
* Miscellaneous srvctl improvements

--------------------
Part 4 Covers:
---------------------
How to truncate a master table while child tables contain data
Limiting ROWS for Top-N query results
Miscellaneous SQL*Plus enhancements
Session level sequences
WITH clause improvements
Extended data types



I'm great thanks to Mr.Syed Jaffar Hussain &  Mr.Tim Hall for nice explanation some 12c features.

Thursday, 21 January 2016

SMART_FLASH_CACHE

Smart flash_cache in 11gR2 and > ( 12c ) Version  supports on OEL or Solaris only DB Smart Flash Cache in Oracle 11g

In case you don’t have budget to buy Exadata you can still buy huge number of flash disks and put on them part of your database. But what should be stored on flash disks(very fast) and what on magnetic disks(very slow) ?

It’s not your businesses to know let decide database.
Introduction

DB Smart Flash Cache is new extension for buffer cache area. This extra area should be defined on solid state disks (SSD) and has following features:
          make performance improvements at moderate cost(cheaper than DRAM)
          low latency compared to magnetic disks
          higher throughput compared to magnetic disks
          easy to setup
          easy to control
          can be used for RAC cache fusion keeps consistency
          direct I/O bypasses buffer cache so as well bypasses DB smart flash cache
          can cache only clean blocks from buffer cache
          flash cache is not auto-tuned
          only blocks from standard buffer pool are cached in DB smart flash cache
Oracle recommends:
          flash disks should have comparable read IOPs and IOPs write
          this new layer should be at least 2-10 times bigger than buffer cache in DRAM
          mainly for OLTP systems

Architecture


if a oracle server process needs to read a block from database at first it must read it from magnetic disk(physical read). Then the block is stored in buffer cache memory and added to standard “LRU chain” list.
When “in memory buffers area” is getting full Oracle must decide which blocks needs to be removed from cache. If you have DB Smart Flash Cache enabled “clean” blocks are written to “Flash cache” by DBWR process so next time they can be read into memory from Flash Cache and improve your performance.
NOTE: “Dirty” blocks are never stored in Flash Cache
List of blocks cached in DB smart flash cache are stored in buffer cache area on two dedicated flash “LRU lists” depending on object attribute FLASH_CACHE:

          DEFAULT – standard last recently used algorithm decides how long such blocks are cached in flash cache. It’s default value assigned to each object in database.
          KEEP – such blocks are not removed from flash cache as long as the flash cache is large enough

alter|create table|index objectname
storage
(  
 buffer_pool { keep | recycle | default }
   flash_cache { keep | none    | default }
);

NONE value for FLASH_CACHE is blocking flash caching for a given object.

Statistics
All I/O operations from DB smart flash cache are counted as physical I/O however Oracle also collects such informations in new columns.
V$SQL - OPTIMIZED_PHY_READ_REQUESTS
V$SQLAREA - OPTIMIZED_PHY_READ_REQUESTS
V$FILESTAT - OPTIMIZED_PHYBLKRD
select name from v$statname where name like 'physical%optimized%';

NAME                                                           
----------------------------------------------------------------
physical read requests optimized                                 
physical read total bytes optimized
You can see such stats in V$SESSTAT and V$SYSSTAT
Setup
Two parameters must be set on database level to turn on DB smart flash cache:
 DB_FLASH_CACHE_FILE – defines (OS disk path or ASM disk group) and file name to store this data
 DB_FLASH_CACHE_SIZE – defines size of the flash cache

DB_FLASH_CACHE_FILE='/os path/flash_cache_file.dbf'
DB_FLASH_CACHE_FILE='+FLASH_DISK_GROUP/flash_cache_file.dbf'
DB_FLASH_CACHE_SIZE=200m

After setting both parameters you need to restart database.
DB_FLASH_CACHE_FILE
          can’t be shared between many databases or instances DB_FLASH_CACHE_SIZE
          can’t be dynamically resized
           can be set to 0 to disable DB smart flash cache
          can be set to original size to re-enable DB smart flash cache




Performance improvements
Oracle conducted interesting test for a OLTP database 70GB size with 8GB SGA. From below picture you can see improvements for Transactions versus size of DB smart cache size.

Following picture shows improvement in transaction response time versus DB smart cache size

Example
I simulate SSD disk by creation ramdisk – disk based in memory using following steps:
1. create directory to mount ramdisk and change owner to oracle and group dba
[root@oel5 /]mkdir /ramdisk
[root@oel5 /]chown oracle:dba -R /ramdisk
2. mount ramdisk and check it
[root@oel5 /]# mount -t tmpfs none /ramdisk -o size=256m

[root@oel5 /]# mount | grep ramdisk

none on /ramdisk type tmpfs (rw,size=256m)

3. set parameters for database and restart it as user oracle
SQL> alter system set db_flash_cache_file='/ramdisk/ram.dbf'
SQL> scope=spfile;
System altered.

SQL> alter system set db_flash_cache_size=200M scope=sp;
System altered. 
SQL> startup force
ORACLE instance started.
Total System Global Area  835104768 bytes
Fixed Size                  2232960 bytes
Variable Size             507514240 bytes
Database Buffers          322961408 bytes
Redo Buffers                2396160 bytes
Database mounted.
Database opened.
SQL> show parameter flash_cache

NAME                    TYPE        VALUE
----------------------- ----------- ------------------------------
db_flash_cache_file     string      /ramdisk/ram.dbf
db_flash_cache_size     big integer 200M
4. Check new file exists in /ramdisk
[root@oel5 ramdisk]# ll
total 8
-rw-r----- 1 oracle asmadmin 209715200 Feb 24 22:54 ram.dbf
5. Let’s create tables with flash_cache keep reference in storage clause so Oracle will try to keep the blocks in DB smart cache as long as possible.
create table test_tbl1(id number,id1 number,id2 number)storage(flash_cache keep);
begin
  for i in 1..1000000
  loop
    insert into test_tbl1 values(i, i, i);
  end loop;
  commit;
end;
/


6. Eventually after some time you can see some data in flash cache – v$bh view.
select status, count(*) from v$bh
group by status;
STATUS       COUNT(*)
---------- ----------
xcur            36915
flashcur        25583
cr                 13
7. If you clean buffer cache as well db smart flash cache is purged
alter system flush buffer_cache;
system FLUSH altered. 
STATUS       COUNT(*)
---------- ----------
xcur              520
free            36411

ERROR:-
I do all steps of your manual, but after ‘startup force’ I have an error:

SQL> startup force
ORA-00439: feature not enabled: Server Flash Cache
What am I doing wrong?
My configuration:
Oracle Linux Server release 6.4
2.6.39-400.24.1.el6uek.x86_64
Oracle Database 11g 11.2.0.3.0

Patch 12949806: FLASH CACHE CHECK IS AGAINST ENTERPRISE-RELEASE
Now it works!


------FOR TESTING PURPOSE------

    # fdisk -l /dev/sdc

    Disk /dev/sdc: 24.5 GB, 24575868928 bytes
    255 heads, 63 sectors/track, 2987 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Disk /dev/sdc doesn't contain a valid partition table
    # chmod 777 /dev/sdc

set Oracle initialization parameters:

    $ sqlplus / as sysdba
    SQL> alter system set db_flash_cache_file='/dev/sdc' scope=spfile;
    System altered.

    SQL> alter system set db_flash_cache_size=10G scope=spfile;
    System altered.


Stop/Start database

    SQL> shutdown immediate



Reference:

12c Below one more my favrt. link to configure and understand smart flash cache.

ORA-65096: invalid common user or role name


SQL> CREATE USER remote_clone_user IDENTIFIED BY remote_clone_user;
create user remote_clone_user identified by remote_clone_user
            *
ERROR at line 1:
ORA-65096: invalid common user or role name


SQL> alter session set "_ORACLE_SCRIPT"=true;


SQL> CREATE USER remote_clone_user IDENTIFIED BY remote_clone_user;


SQL> grant create session,create pluggable database to remote_clone_user;

Friday, 15 January 2016

Backup Pluggable Databases

Oracle 12c New Feature: How to backup pluggable databases

Oracle 12c introduced the new multi-tenant feature called Pluggable Databases (PDB). We will show how to take a backup of the pluggable database components in this post.

Setup for RMAN with Oracle 12c

In order to use the Oracle 12c Recovery Manager (RMAN) utility for pluggable database backups, you need to first enable archivelog mode.





Once archivelog mode is enabled, we can take a backup of the pluggable database

rman target sysbackup





Now we can verify that the backup image is available from RMAN for our pluggable database






Backup for root component of Oracle 12c Pluggable Databases
Backup database ;    # Both database backup CDB and PDB all       
Pluggable database backup above the command.

In a nutshell, an Oracle 12c PDB consists of two parts: a root component and a seed component that includes the data. Earlier we performed a full database backup of the entire pluggable database but let us say that we just want to backup the root itself. We can do so with the RMAN command BACKUP DATABASE ROOT as shown in the following example:





Now let us verify the root backup for our PDB with Oracle 12c:




Stay tuned when we visit how to restore pluggable databases with RMAN and Oracle 12c!



RESTORE & RECOVER root (Container)
RMAN> restore datafile 6;
RMAN>restore database root;
RMAN>recover database root;



RESTORE & RECOVER PDB

RMAN> restore datafile 29 pluggable database pdb1;   # restore datafile 29;
RMAN> restore pluggable database pdb1;           # restore pluggable database pdb1,pdb2,pdb3;
RMAN> recover pluggable database pdb1;


PDB Create & Drop in GUI / CLI MODE

12c

This method copies the files for the seed to a new location and associates the copied files with the new PDB, which will be called PDB1. Although you have many options for creating PDBs, this example is one of the simplest ways to get up and running. Using this method leaves you with a PDB with no customizations.

1.    Log in to your CDB using SQL*Plus as SYSDBA. To make sure you’re in the correct location, type
show con_name
You should see something like this:
CON_NAME
------------------------------
CDB$ROOT
The out-of-the box file location for PDBs is in a subdirectory under the oradata directory for the CDB.
2.    Create a subdirectory for the new PDB under the CDB file location from the OS oracle software owner by typing
mkdir /u01/app/oracle/oradata/CDB1/pdb1
If this command succeeds, you get no output. You can list the new directory by typing
ls –l /u01/app/oracle/oradata/CDB1 |grep pdb1
You should see something like this:
drwxr-xr-x. 2 oracle oinstall   4096 Aug 17 01:56 pdb1

3.    Back in SQL*Plus as SYSDBA, create pluggable database command by typing
select CON_ID, OPEN_MODE, NAME from v$containers;
select FILE_NAME from cdb_data_files;
alter session set container=PDB$SEED;
select FILE_NAME from dba_data_files;
CREATE PLUGGABLE DATABASE pdb1 ADMIN USER vinay identified by oracle  ROLE=(CONNECT)
DEFAULT TABLESPACE USERS
DATAFILE '/u01/app/oracle/oradata/CDB1/pdb1/users01.dbf'
SIZE 250M AUTOEXTEND ON
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_c62dlts4_.dbf', '/u01/app/oracle/oradata/CDB1/pdb1/system01.dbf',
'/u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_c62dltrv_.dbf', '/u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf',
'/u01/app/oracle/oradata/CDB1/datafile/pdbseed_temp012015-12-04_11-59-21-AM.dbf', '/u01/app/oracle/oradata/CDB1/pdb1/temp01.dbf');
You should see this:
Pluggable database created.
The new PDB is left in a mount state.
4.    Show the new PDB and open it by typing
show pdbs
alter pluggable database pdb1 open;
You should see this:
CON_ID CON_NAME            OPEN MODE RESTRICTED
------- ------------------------------ ---------- ----------
   2 PDB$SEED            READ ONLY NO
   3 PDB1            READ WRITE NO
Pluggable database altered.

5.    Verify the status by typing
show pdbs
You should see this:
CON_ID CON_NAME            OPEN MODE RESTRICTED
------ ------------------------------ ---------- ----------
   2 PDB$SEED            READ ONLY NO
   3 PDB1            READ WRITE NO