Saturday, 23 September 2017

Oracle Database 12c New Features and its advantage

Oracle 12c is significantly cost savings ,reduced risk and increased flexibility and also provide many technical benefits and business value

1 ) Multitenant and Pluggable Database feature allows to reduce costs by consolidating multiple databases and isolating applications while still sharing the same memory structures and clouding of databases into IaaS, PaaS, and DBaaS deployments. Oracle see multitenant databases as the first step to the cloud, As they allow  to move databases between on-premise and the cloud, between cloud providers, or between different parts of a high-availability cloud design. 

a) Cloning is fast as only user metadata/data needs to be cloned
b) Upgrades/patch can just unplug from old version and plug into new version
c) Reduces total db usage by not having repeated all the CDB resources.(Less disk space and memory usages)

2) Automatic Data Optimization feature
  monitors database read/write activity enabling DBAs to easily identify the data that is hot/warm/cold in terms of access frequency.  Also smart compression and storage tiering automatically compress and tier data based on the activity and age of the data. 

3) In-Memory Caching, Compression, and Column Store
–it is a new set of features which allow for large amounts of memory-based data caching beyond the traditional buffer caches, and the cached data is stored in a compressed columnar format.  This can dramatically improve performance and optimize server resources, and is surprisingly easy to implement since it is built into the database kernel and transparent to the application.

4) Recovery Manager (RMAN) Compression

Data is compressed before it is written to disk or tape, and doesn’t need to be uncompressed before recovery, leading to a reduction in storage costs of up to five times for backups. 

5) Database Compression Technologies for all Data Types -Oracle 12c Database  provides a comprehensive set of compression capabilities across all types of data without changes to your application to help customers improve query performance while reducing storage costs

6) Data Guard Network Compression

Redo log data is compressed before it is sent over the network to standby databases, which can double redo transport speed.

Other advantages

High Availability

Further RAC Improvements

–Faster failover of services

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

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

--Detection of  gaps and automatic resolution


Legacy Database risk

1) Risk of hitting an issue/bug
2) limited feature which restrict DBA to fine-fune database
3) Oracle support will not help in case of crash and bugs

 Premier Support for Oracle 11gR2 ended 31 January 2015 and the free extended support ends 31 May 2017. Bug fixes, security and other support for Oracle 11gR2 will no longer be provided.
and  will be charged for extended support for Oracle 11g from June 2017.  Extended support for release 11.2.0.3 ended on 27th August 2015 so you need to apply a bundle patch immediately if you are on 11.2.0.3 or lower. 
Extended support for Oracle 11g ends completely on 31st January 2018.  By then, we need to have upgraded to Oracle 12c.


Wednesday, 30 August 2017

Oracle RMAN Backup script with Example for window Enviroment

Rman backup on disk
--------------
#!/usr/bin/ksh
ORACLE_SID=dastat03
export ORACLE_SID
ORACLE_HOME=`cat /etc/oratab|grep $ORACLE_SID:|cut -f2 -d':'`
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
dt=$(date +"%d-%b-%Y_%H_%M")
export dt
mkdir -p /backup/rman/$dt/control
mkdir -p /backup/rman/$ORACLE_SID/logs
output=$ORACLE_SID_backup_$dt.log
log_file=/backup/rman/$ORACLE_SID/logs/$output

$ORACLE_HOME/bin/rman target / nocatalog log=$log_file  <<EOF
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 80 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
run {
      allocate channel ch1 type DISK;
      allocate channel ch2 type DISK;
      backup incremental level 0 database format '/backup/rman/${dt}/db_full%d_%s_%p_%t';
      backup archivelog all;
      backup current controlfile format  '/backup/rman/${dt}/control/snapcf_${ORACLE_SID}.f';
      backup spfile format               '/backup/rman/${dt}/control/snapspfile_${ORACLE_SID}.f';
      crosscheck backup;
      crosscheck archivelog all;
      delete noprompt obsolete;
      delete noprompt expired backup;
      release channel ch1;
      release channel ch2;
};
>>EOF


========================================================================

Rman backup on tape


$ hostname
servername
$ pwd
/backup/rman
$ cat rman_backup_tape.sh
#!/usr/bin/ksh
ORACLE_SID=database_SID
export ORACLE_SID
ORACLE_HOME=`cat /etc/oratab|grep $ORACLE_SID:|cut -f2 -d':'`
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
dt=$(date +"%d-%b-%Y_%H_%M")
export dt
DATESTAMP=`date '+%d-%m-%Y-%H-%M'`
export DATESTAMP
mkdir -p /backup/rman/$dt/control
mkdir -p /backup/rman/$ORACLE_SID/logs
output=$ORACLE_SID_backup_$dt.log
log_file=/backup/rman/$ORACLE_SID/logs/$output
$ORACLE_HOME/bin/rman target / nocatalog log=$log_file @/backup/rman/rman_11g_level0_database_bkp.scr
$ cat /backup/rman/rman_11g_level0_dastap01_bkp.scr
run {
configure retention policy to redundancy 80;
configure backup optimization on;
configure controlfile autobackup on;

set command id to '{$ORACLE_SID}_FULL';
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/ieo2blptsmp01_ora/tdpo.opt)';
allocate channel t2 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/ieo2blptsmp01_ora/tdpo.opt)';
allocate channel t3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/ieo2blptsmp01_ora/tdpo.opt)';
allocate channel t4 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/ieo2blptsmp01_ora/tdpo.opt)';
sql 'alter system switch logfile';
crosscheck archivelog all;
      backup current controlfile tag '{$ORACLE_SID}_controlfile' format '/controlfile_%d_%U/';
      backup spfile  tag '{$ORACLE_SID}_spfile' format '/spfile_%d_%U/';
backup as compressed backupset filesperset 4
incremental level 0 tag '{$ORACLE_SID}_backup_db_level_0'
format '/FULL_%d_%U/'
(database);
backup as compressed backupset filesperset 10
 tag '{$ORACLE_SID}_backup_archive'
 format '/Archive_%d_%U/'
 (archivelog all)
archivelog until time 'SYSDATE' delete input ;
DELETE noprompt force ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt;
release channel t1;
release channel t3;
release channel t2;
release channel t4;
}
$



========================


set ORACLE_HOME=e:\app\orasbm\product\11.2.0.4\dbhome_1
set PATH=%ORACLE_HOME%\bin;%PATH%
set ORACLE_SID=EASYDB_MUS
cd E:\DB_SCRIPTS\Backup
rman target / @easydb_mus_full_Yearly.rman log=E:\DB_SCRIPTS\Backup\Logs\easydb_mus_full_Yearly_%date:~4,2%_%date:~7,2%_%date:~10%.log


run
{
allocate channel 'dev_0' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MUS,OB2BARLIST=easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY) SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
allocate channel 'dev_1' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MUS,OB2BARLIST=easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY) SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
allocate channel 'dev_2' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MUS,OB2BARLIST=easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY) SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
allocate channel 'dev_3' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MUS,OB2BARLIST=easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY) SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
backup incremental level 0 format 'easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY<easydb_MUS_%s:%t:%p>.dbf' database;
backup format 'easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY<easydb_MUS_%s:%t:%p>.dbf' archivelog all;
delete archivelog all backed up 1 times to device type 'sbt_tape' completed before 'sysdate-1';
backup format 'easyserver_ORA_easydb_MUS_STDY_FULL_ONLINE_EML_YEARLY<easydb_MUS_%s:%t:%p>.dbf' current controlfile;
release channel 'dev_0';
release channel 'dev_1';
release channel 'dev_2';
release channel 'dev_3';
}

=========================


set ORACLE_HOME=e:\app\orasbm\product\11.2.0.4\dbhome_1
set PATH=%ORACLE_HOME%\bin;%PATH%
set ORACLE_SID=easydb_MGS
cd E:\DB_SCRIPTS\Backup
rman target / @easydb_mgs_arch.rman log=E:\DB_SCRIPTS\Backup\Logs\easydb_mgs_arch_%date:~4,2%_%date:~7,2%_%date:~10%.log


run
{
allocate channel 'dev_0' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MGS,OB2BARLIST=R2_easyserver_ORA_easydb_MGS_STDY_FULL_ONLINE_EML_DAILY_ARCH)  SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
allocate channel 'dev_1' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MGS,OB2BARLIST=R2_easyserver_ORA_easydb_MGS_STDY_FULL_ONLINE_EML_DAILY_ARCH) SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
allocate channel 'dev_2' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MGS,OB2BARLIST=R2_easyserver_ORA_easydb_MGS_STDY_FULL_ONLINE_EML_DAILY_ARCH)  SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
allocate channel 'dev_3' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=easydb_MGS,OB2BARLIST=R2_easyserver_ORA_easydb_MGS_STDY_FULL_ONLINE_EML_DAILY_ARCH)  SBT_LIBRARY=C:/PROGRA~1/OmniBack/bin/orasbt.dll';
backup format 'R2_easyserver_ORA_easydb_MGS_STDY_FULL_ONLINE_EML_DAILY_ARCH<easydb_MGS_%s:%t:%p>.dbf' archivelog all;
delete noprompt archivelog all backed up 1 times to device type 'sbt_tape' completed before 'sysdate-1';
backup format 'R2_easyserver_ORA_easydb_MGS_STDY_FULL_ONLINE_EML_DAILY_ARCH<easydb_MGS_%s:%t:%p>.dbf' current controlfile;
release channel 'dev_0';
release channel 'dev_1';
release channel 'dev_2';
release channel 'dev_3';
}

Oracle RAC Background Processes And Single Instance



To check backgroup process

select name,description from V$bgprocess;


RAC specific background processes for the database instance :

LMSn
LMON
LCK0
LMDn
DIAG
RBAL
ASMB
RMSn
RSMN


LMSn (Global cache service monitor ) :coordinate block updates from one cache to another . The number of lms server processes running is       determined by gcs_server_processes . Default value for gcs_server_processes is 2 and can be increased to 32 .
LMDn  : manages requests for global enqueues . (across node )
LCK0 :handle resources not requiring Cache Fusion like library cache etc. (same node)
LMON ( global enqueue service monitor  for shared locks ) : also used by css . (across node )
DIAG : collect diagnostic info

- LMS—Global Cache Service Process
- LMD—Global Enqueue Service Daemon
- LMON—Global Enqueue Service Monitor
- LCK0—Instance Enqueue Process


GSD 9i is not compatible with 10g


RMSn
This process is called as Oracle RAC Management Service/Process. These processes perform manageability tasks for Oracle RAC. Tasks include creation of resources related Oracle RAC when new instances are added to the cluster.

RSMN
This process is called as Remote Slave Monitor. This process manages background slave process creation and communication on remote instances. This is a background slave process. This process performs tasks on behalf of a coordinating process running in another instance.


rbal : corordinate with asm instance
asmb :

GTX0-j—Global Transaction Process


2 main background process are RBAL and ASMB. RBAL process is used to make global calls to disk in diskgroup . ASMB process communicates with CSS daemon on node and receives file extend map information from ASM instance . ASMB is also responsible for providing I/O stats to ASM instance . asmb process is first started when files are first accessed .


ASM BACKGROUND PROCESSES :

DIA0
ASMB : when asmcmd invoked
RBAL : rebalance activity
ARBn
ACFS
Bnnn
CJQ0
CKPT
CPnn
GMON


asm instance has 3 background processes . RBAL , gmon and ARBn .RBAL process decides when rebalancing needs to be done and estimates how much time will it take .  RBAL process then invokes ARBn process to do actuall work . The number of ARBn processes generated depends upon asm_power_limit parameter set . Gmon is responsible for group monitoring .



Database backgroung process :
ACMS
ASnn
BMRn
DIA0
DMON
DWnn


>>>>>>>>>>>>>>>>>>> 9i
pmon
smon
arch
lgwr
DBWn
mrp
ckpt


>>>>>>>>>>>>>> 10g
mmon
mmnl
mman
RVWR
CTWR
M000


>>>>>>>>>>>>>>  11G Background Process=============
 
ABMR : automatic block media recovery
dbrm : DB resource manager
dia0 : Diagnosability process
fbda : Flashback data archiver process
vktm : Virtual Timekeeper
w000 : Space Management Co-ordination process
smc0 : Space Manager process



>>>>>>>>>>

MMAN :
Memory Manager (MMAN) coordinates the sizing of different memory components within SGA.
MMAN keeps a track of sizes of components and allocates/de-allocates memory based on their usage.
This process is used only when you enable Automatic Shared Memory Management


MMON :
The memory monitor (MMON) process was introduced in 10g is responsible for gathering statistics for Automatic Workload Repository.
This helps Oracle doing automatic problem detection and self tuning.

SMON :
System Monitor process performs recovery after instance failure and monitors temporary segments and extents.
SMON can also perform instance recovery for other failed RAC instances.

PMON :
Process Monitor recovers failed user process resources.  PMON performs cleanup of user process resources such as releasing locks.

DBWR :
Database Writer or Dirty Buffer Writer are responsible for writing dirty buffers from the database block cache to the database data files. Generally, DBWR only writes blocks back to the data files on commit, or when the cache is full and space has to be made for more blocks. The DBWR processes in RAC must be coordinated through the locking and global cache processes to ensure efficient processing is accomplished.  Oracle 11g allows for a maximum of 20 DBWR processes.


LGWR :
Log Writer process is responsible for writing the log buffers out to the redo logs. In RAC, each RAC instance has its own LGWR process that maintains that instance’s thread of redo logs.  Redo log entries are written sequentially.


ARCH : (Optional).
When running in ARCHIVELOG mode, the archive process writes filled redo logs to the archive log location(s).  The archive log files are critical for RAC and non-RAC database recovery.

CKPT :
A database checkpoint is a method where the state of a database is saved.  The checkpoint process writes checkpoint information to control files and data file headers.  Remember that the checkpoint process is the manager of the database checkpoint; the actual writing of blocks to disk is done by DBWR