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

Wednesday, April 17, 2019

ORA-65011: Pluggable database does not exist.

ORA-65011: Pluggable database does not exist.


Recently I have faced issue while upgrading my application root.
Below is the error while I was upgrading my test environment.

SQL> alter pluggable database application ONLINESTORE begin upgrade '1.3' to '1.4';
alter pluggable database application ONLINESTORE begin upgrade '1.3' to '1.4'

ORA-65011: Pluggable database F3094217277_21_4 does not exist.
ORA-65169: error encountered while attempting to copy file /mnt/db18cdat/ORCLCDB/STOREROOT/users.dbf
ORA-19502: write error on file "/mnt/db18cdat/ORCLCDB/STOREROOT/8691A320CBAD38EFE053789AB80AEEB3/datafile/o1_mf_users_gc8xyz9o_.dbf", block number 2445132 (block size=8192)
ORA-27072: File I/O error
Additional information: 4
Additional information: 2445132
Additional information: 589824



I haven't faced this issue before.
I had upgraded my application from 1.0 to 1.1 and 1.1 to 1.2 and 1.2 to 1.3
But now while upgrading application from 1.3 to 1.4, it is not allowing.
And ORA-27072: File I/O error is the trigger point for me to look into the storage side. This error comes when something happens with storage.

So very first I checked the free space available on my disk.

$ df -h
Filesystem                                                             Size  Used Avail Use% Mounted on
devtmpfs                                                                15G     0   15G   0% /dev
tmpfs                                                                     30G   79M   30G   1% /dev/shm
/dev/mapper/DomUVol12-mnt                            684G  639G  9.6G  99% /mnt
/export/local/x86_64/redhat/70_prod/packages    5.0T  4.3T  726G  86% /usr/local/remote/packages
/export/home1/chandan                                         4.5T  540G  4.0T  12% /home/chandan

So in above output it is showing that /mnt mount point have only 9.6gb free and my database size is approx 15-20gb.

Now, question is; who is occupying space on this disk? Why all of sudden disk space issue arise?

MUST NOTE
When we upgrade our application, Oracle Database automatically clones the application root. At the time of upgrade, application PDBs point to the clone. Due to this applications continue to run during the upgrade also.

Here it is recommended to SYNC your application PDB with your application root. If application PDBs are not SYNC with root, PDBs will still point to the clone.
Now Clone PDBs will occupy your disk space because those are copy of your application root PDB.


Here in my case I have deleted unnecessary file and logs and free up some disk space to accommodate my next application root version.

After free up space command ran successfully.

SQL> alter pluggable database application ONLINESTORE begin upgrade '1.3' to '1.4';
Pluggable database altered.

Now, Question is, What if I don't require my previous application root versions. What if I already SYNC/upgraded my all PDBs to latest version?
Check out my next post for this. Click here.




Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert

Monday, March 26, 2018

Oracle Force Full Database Cache Mode

Oracle Force Full Database Cache Mode



One of the most expensive operations in Oracle Database is to read data from disk. Most of our performance tuning goal is to reduce IO and read block from memory.

Oracle’s db_buffer_cache is smart enough to decide what to cache and when to edge out the data blocks when not frequently used or no room for new data. Sometime edging out of data become very frequently and we face performance degradation and very high IO read from disk.

Beginning with 12cR1 (12.1.0.2) Oracle introduces a new Feature called FORCE FULL DATABASE CACHING. This Feature allows DBA to cache complete database in db buffer cache.

Starting with Oracle Database 12c Release 1 (12.1.0.2), there are two Database Caching Modes:

  • Default Database Caching Mode.
  • Force Full Database Caching Mode.
Default Database Caching Mode
If Database instance determines that there is enough space to cache the Full Database in the buffer cache and that it would be beneficial to gain performance, and then the instance automatically caches the Full Database in the buffer cache. This is a new feature in 12.1.0.2.

If the Oracle Database instance determines that there is not enough space to cache the Full Database in the buffer cache, then:

From Oracle Docs, Doc ID 1941494.1
Smaller tables are loaded into memory only when the table size is less than 2 percent of the buffer cache size.

For medium tables, Oracle Database analyzes the interval between the last table scan and the aging timestamp of the buffer cache.
If the size of the table reused in the last table scan is greater than the remaining buffer cache size, then the table is cached.

Large tables are typically not loaded into memory, unless if you explicitly declare the table for the KEEP buffer pool.

Force Full Database Caching Mode

In force Full Database Caching Mode, Oracle Database caches the entire database in memory when the size of the database is smaller than the database buffer cache size.
All data files, including NOCACHE LOBs, will be loaded into the buffer cache. This feature can improve database performance drastically for the queries which performing full table scans and IO intensive queries.

In a multitenant environment, force Full Database Caching Mode applies to the entire multitenant container database (CDB), including all of its pluggable databases (PDBs).

Must note below things before activating Force Full DB Cache Mode

  • The database size must be smaller than the BUFFER CACHE size. It is recommended that SGA should be 20% more than DB Size
  • The TEMP and the SYSAUX Tablespace can be excluded.
  • NOCACHE Securefile will be also CACHED
  • In a multitenant configuration this feature works at CDB level and all PDBs are considered for Caching Data

FAQs of Force Full DB Cache Mode

Q. What type of performance benefit we get from Force full database caching mode?
Ans. Performance benefit can be seen on IO bound and higher read intensive databases and queries which are doing full table scan.

Q. What if buffer cache is not sufficient to hold my database in cache?
Ans. If this is the case Force Full Caching setting automatically be turned off. This can be seen in alert log file.

Q. In a Multitenant environment, Is Force Full Database Caching applies to All PDBs?
Ans. Yes, It applies to entire multitenant Container Database (CDB) including all of its pluggable database (PDBs).

Q. How objects are going to be loaded/cached in Buffers?
Ans. Objects will be cached when they are accessed. Objects were not cached or loaded in buffer immediately after instance started.

Q. Where can i find information about Force Full Database Caching Mode.
Ans. You can find information in control file.

Q. What if my control file is replaced or lost?
Ans. If the control file is replace or recreated then the information about the force full database caching mode is lost. Restored control file might have information depending on when the control file was backed up.

Q. How to estimate the buffer cache size for Force Full DB Cache Mode when the instance is under normal workload:
Ans. Use below query,
SELECT NAME, BYTES FROM V$SGAINFO WHERE NAME = 'Buffer Cache Size';

Q. How to check if database is in Force Full DB Cache Mode?
Ans. Use below query to check. if FORCE_FULL_DB_CACHING showing yes than DB is in Force Full Caching Mode
SELECT FORCE_FULL_DB_CACHING FROM V$DATABASE;

Q. Is it recommended for OLTP Database?
Ans. No, my recommendation is for data warehouse workloads. This is because we cannot calculate OLTP database size due to frequent data grows. Hence if it crosses to your allocated buffer cache size than force full caching mode converts in default caching mode and you will not get benefit of this.

How to enable Force Full DB Cache Mode

Only Three Steps to enable force full db cache mode.

1) Start database should be in mount state
Sql> Startup mount

2) Alter database with force full caching
Sql> alter database force full database caching;

3) Now Open database normally
Sql> alter database open;

How to Disable Force Full DB Cache Mode

Only Three Steps to disable force full db cache mode.

1) Start database should be in mount state
Sql> Startup mount

2) Alter database with force full caching
Sql> alter database NO force full database caching;

3) Now Open database normally
Sql> alter database open;


I am very glad to share information on Oracle Force Full Database Cache Mode. Recently I have presented session Oracle Force Full Database Cache Mode in @AIOUG Gujarat Chapter and @AIOUG Mumbai Chapter.

Please find attachment of my Presentation for the same.
My presentation is more sort of on FAQ to understand Force Full Database Cache Mode.



Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert

Friday, December 23, 2016

Oracle Database 12c Silent Installation

Oracle Database 12c Silent Installation



Step 1    Prerequisites
Step 2    Assumption for Installation.
Step 3    Run installar in silent mode.
Step 4    Assumption for Database Creation.
Step 5    Run dbca in silent mode.
Step 6    Crosscheck Database Installation.



Step 1    Prerequisites

Create directory structure for following locations using root

INVENTORY_LOCATION = /mnt/devops_0/OracleSilent/oraInventory
ORACLE_HOME =/mnt/devops_0/OracleSilent/Oracle/Product/12.1.0.2/db_1
ORACLE_BASE =/mnt/devops_0/OracleSilent/Oracle

Change ownership to user db1212

$ chown -R db1212:oinstall OracleSilent/



Step 2    Assumption for Installation.

If one need to change following parameters kindly edit db_Software_Install.rsp

Parameter
Values
Remarks
InstallEdition
EE
EnterpriseEdition
oracle.install.option
INSTALL_DB_SWONLY
Install Software only
DBA_GROUP
dba
Group Information
OPER_GROUP
dba
BACKUPDBA_GROUP
dba
DGDBA_GROUP
dba
KMDBA_GROUP
dba
LANGUAGE
EN
English
DECLINE_SECURITY_UPDATES
Yes

SECURITY_UPDATES_VIA_MYORACLESUPPORT
False


Below is the sample output of db_software_install.rsp file.

#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
#   - INSTALL_DB_SWONLY
#   - INSTALL_DB_AND_CONFIG
#   - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory. 
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.            
#
# en   : English                  ja   : Japanese                 
# fr   : French                   ko   : Korean                   
# ar   : Arabic                   es   : Latin American Spanish   
# bn   : Bengali                  lv   : Latvian                  
# pt_BR: Brazilian Portuguese     lt   : Lithuanian               
# bg   : Bulgarian                ms   : Malay                    
# fr_CA: Canadian French          es_MX: Mexican Spanish          
# ca   : Catalan                  no   : Norwegian                
# hr   : Croatian                 pl   : Polish                   
# cs   : Czech                    pt   : Portuguese               
# da   : Danish                   ro   : Romanian                 
# nl   : Dutch                    ru   : Russian                  
# ar_EG: Egyptian                 zh_CN: Simplified Chinese       
# en_GB: English (Great Britain)  sk   : Slovak                   
# et   : Estonian                 sl   : Slovenian                
# fi   : Finnish                  es_ES: Spanish                  
# de   : German                   sv   : Swedish                  
# el   : Greek                    th   : Thai                     
# iw   : Hebrew                   zh_TW: Traditional Chinese      
# hu   : Hungarian                tr   : Turkish                  
# is   : Icelandic                uk   : Ukrainian                
# in   : Indonesian               vi   : Vietnamese               
# it   : Italian                                                  
#
# all_langs   : All languages
#
# Specify value as the following to select any of the languages.
# Example : SELECTED_LANGUAGES=en,fr,ja
#
# Specify value as the following to select all the languages.
# Example : SELECTED_LANGUAGES=all_langs 
#-------------------------------------------------------------------------------
SELECTED_LANGUAGES=en

#-------------------------------------------------------------------------------
# Specify the installation edition of the component.                    
#                                                            
# The value should contain only one of these choices. 
#   - EE     : Enterprise Edition

#-------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE

#------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba

#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=dba

#------------------------------------------------------------------------------
# The BACKUPDBA_GROUP is the OS group which is to be granted OSBACKUPDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.BACKUPDBA_GROUP=dba

#------------------------------------------------------------------------------
# The DGDBA_GROUP is the OS group which is to be granted OSDGDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.DGDBA_GROUP=dba

#------------------------------------------------------------------------------
# The KMDBA_GROUP is the OS group which is to be granted OSKMDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.KMDBA_GROUP=dba

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true



Step 3    Run installar in silent mode.

 Go to Installar directory
-bash-4.1$ pwd
/mnt/devops_0/Installables/database

Run below command

$ ./runInstaller -silent -responseFile /mnt/devops_0/dba/db1212/db_Software_Install.rsp INVENTORY_LOCATION=/mnt/devops_0/OracleSilent/oraInventory ORACLE_HOME=/mnt/devops_0/OracleSilent/Oracle/product/12.1.0.2/db_1 ORACLE_BASE=/mnt/devops_0/OracleSilent/Oracle


Step 4    Assumption for Database Creation.

 If one need to change following parameters kindly edit dbca.rsp


Parameter
Values
Remarks
OPERATION_TYPE
createDatabase

DATABASECONFTYPE
SI
Single Instance
CREATEASCONTAINERDATABASE
false
Container Database
CHARACTERSET
AL32UTF8

NATIONALCHARACTERSET
AL16UTF16

DATABASETYPE
MULTIPURPOSE

AUTOMATICMEMORYMANAGEMENT
TRUE

STORAGETYPE
FS

LISTENERS
(It will configure with all listerner if exists otherwise create one)


SAMPLESCHEMA
False



Below is the listing of dbca.rsp

 #-----------------------------------------------------------------------------
# GENERAL section is required for all types of database creations.
#-----------------------------------------------------------------------------
[GENERAL]

#-----------------------------------------------------------------------------
# Name          : RESPONSEFILE_VERSION
# Datatype      : String
# Description   : Version of the database to create
# Valid values  : "12.1.0"
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
RESPONSEFILE_VERSION = "12.1.0"

#-----------------------------------------------------------------------------
# Name          : OPERATION_TYPE
# Datatype      : String
# Description   : Type of operation
# Valid values  : "createDatabase" \ "createTemplateFromDB" \ "createCloneTemplate" \ "deleteDatabase" \ "configureDatabase" \ "addInstance" (RAC-only) \ "deleteInstance" (RAC-only) \ "createPluggableDatabase" \ "unplugDatabase" \ "deletePluggableDatabase" \ "configurePluggableDatabase"
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
OPERATION_TYPE = "createDatabase"

#-----------------------*** End of GENERAL section ***------------------------

#-----------------------------------------------------------------------------
# CREATEDATABASE section is used when OPERATION_TYPE is defined as "createDatabase".
#-----------------------------------------------------------------------------
[CREATEDATABASE]

#-----------------------------------------------------------------------------
# Name          : GDBNAME
# Datatype      : String
# Description   : Global database name of the database
# Valid values  : . - when database domain isn't NULL
#                              - when database domain is NULL
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
GDBNAME = "orcl12c.in.myora.com"

#-----------------------------------------------------------------------------
# Name          : DATABASECONFTYPE
# Datatype      : String
# Description   : database conf type as Single Instance, Real Application Cluster or Real Application Cluster One Nodes database
# Valid values  : SI\RAC\RACONENODE
# Default value : SI
# Mandatory     : No
#-----------------------------------------------------------------------------
DATABASECONFTYPE  = "SI"

#-----------------------------------------------------------------------------
# Name          : SID
# Datatype      : String
# Description   : System identifier (SID) of the database
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : specified in GDBNAME
# Mandatory     : No
#-----------------------------------------------------------------------------
SID = "orcl12c"

#-----------------------------------------------------------------------------
# Name          : CREATEASCONTAINERDATABASE
# Datatype      : boolean
# Description   : flag to create database as container database
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : false
# Mandatory     : No
#-----------------------------------------------------------------------------
CREATEASCONTAINERDATABASE =false

#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name of the template
# Valid values  : Template file name
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
TEMPLATENAME = "General_Purpose.dbc"

#-----------------------------------------------------------------------------
# Name          : STORAGETYPE
# Datatype      : String
# Description   : Specifies the storage on which the database is to be created
# Valid values  : FS (CFS for RAC), ASM
# Default value : FS
# Mandatory     : No
#-----------------------------------------------------------------------------
STORAGETYPE=FS

#-----------------------------------------------------------------------------
# Name          : CHARACTERSET
# Datatype      : String
# Description   : Character set of the database
# Valid values  : Check Oracle12c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory     : NO
#-----------------------------------------------------------------------------
CHARACTERSET = "AL32UTF8"

#-----------------------------------------------------------------------------
# Name          : NATIONALCHARACTERSET
# Datatype      : String
# Description   : National Character set of the database
# Valid values  : "UTF8" or "AL16UTF16". For details, check Oracle12c National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory     : No
#-----------------------------------------------------------------------------
NATIONALCHARACTERSET= "AL16UTF16"



Step 5    Run dbca in silent mode.

 Following parameter must be provided manually for silent installation.
  • gdbname
  • sid
  • datafileDestination
  • SysPassword
  • SystemPassword
  • emConfiguration
  • memoryPercentage
$ dbca -silent -responseFile /mnt/devops_0/dba/db1212/dbca.rsp -createDatabase -gdbname oraslnt -sid oraslnt   -emConfiguration LOCAL -datafileDestination /mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt -SysPassword sysdba123  -SystemPassword sysdba123 -memoryPercentage 10

Below is the sample output of above command.

$ export ORACLE_HOME =/mnt/devops_0/OracleSilent/Oracle/Product/12.1.0.2/db_1

-bash-4.1$ dbca -silent -responseFile /mnt/devops_0/dba/db1212/dbca.rsp -createDatabase -gdbname oraslnt -sid oraslnt   -emConfiguration LOCAL -datafileDestination /mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt -SysPassword sysdba123  -SystemPassword sysdba123
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/mnt/devops_0/Oracle/cfgtoollogs/dbca/oraslnt/oraslnt.log" for further details.


Step 6    Crosscheck Database Installation.

-bash-4.1$ export ORACLE_SID=oraslnt
-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Mar 15 11:36:01 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
ORASLNT   READ WRITE


SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/system01.dbf
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/sysaux01.dbf
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/undotbs01.dbf
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/users01.dbf


SQL> select member from v$logfile;

MEMBER
----------------------------------------------------------------------------------------------------
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/redo03.log
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/redo02.log
/mnt/devops_0/OracleSilent/Oracle/oradata/oraslnt/oraslnt/redo01.log




Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert