Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all 1640 articles
Browse latest View live

RMAN-20501: redo logs from parent database incarnation cannot be applied

$
0
0


Cause:

A RESTORE or RECOVER of a datafile was requested, but recovery of the datafile would require applying redo logs that were generated before the most recent OPEN RESETLOGS.


Action:

If a full backup or datafile copy from the current database incarnation exists, ensure that it is marked AVAILABLE, and that a channel of the correct device type is allocated.

It may also be necessary to remove the FROM BACKUPSET or FROM DATAFILECOPY or FROM TAG operands if these have been specified

RMAN-20246: new db_unique_name is already known to the recovery catalog

$
0
0


Cause:

the user specified known DB_UNIQUE_NAME value when renaming a DB_UNIQUE_NAME in the recovery catalog.


Action:

 change the database DB_UNIQUE_NAME to an known DB_UNIQUE_NAME value; or unregister the new DB_UNIQUE_NAME before renaming an old DB_UNIQUE_NAME value for a database.

To display the list of all DB_UNIQUE_NAME for the databases LIST DB_UNIQUE_NAME OF DATABASE command can be executed.

RMAN-20222: datafile name not found in recovery catalog or is ambiguous

$
0
0


Cause:

The specified datafile name is not the name of a datafile that is currently part of the target database, or an UNTIL clause has been specified and the file name was for a different datafile at the time specified by the UNTIL clause than it is now.


Action:

Use a datafile number to specify the datafile you want to RESTORE or RECOVER.

RMAN-20109: remote database has different database ID

$
0
0


Cause:

Command RESYNC CATALOG FROM DB_UNIQUE_NAME was executed and the database ID of the remote database was different than the connected target database.


Action:

  The remote database should have the same database ID as the database connected as the target database.

Fix the connect identifier for the remote database and retry the command.

Correct permission for oracle binary from GRID and RDBMS Home and ASM devices to avoid ORA-27041 ORA-15025 ORA-15081

$
0
0
Correct permission for oracle binary from GRID and RDBMS Home and ASM devices.

 GRID(oracle binary)RDBMS(oracle binary)ASM Devices permission
Correct Permission for role separation-rwsr-s--x 1 grid oinstall-rwsr-s--x 1 oracle asmadmin brw-rw---- 1 grid asmadmin

"ORA-01017: invalid username/password; logon denied" while starting up asm

$
0
0
"ORA-01017: invalid username/password; logon denied" while starting up asm

Symptoms :

I. ASM instance can be started manually using sqlplus "/as sysasm" but the CRSD fails to start

Cause :

sqlnet.ora has below entry set

SQLNET.AUTHENTICATION_SERVICES=none

Solution :

CRS uses OS authentication method to connect ASM instance. Remove AUTHENTICATION_SERVICES parameter, if any, set in sqlnet.ora.

Refer note 1681849.1

Volume Creation endup with ORA-15221

$
0
0
Volume Creation endup with ORA-15221

Symptoms :

ASMCMD> volcreate -G DATA -s 250G volume1
ORA-15032: not all alterations performed
ORA-15479: ASM diskgroup does not support volumes
ORA-15221: ASM operation requires compatible.asm of 12.1.0.2.0 or higher (DBD ERROR: OCIStmtExecute)

Cause:

Affected diskgroup (e.g. +DATA) has set compatible.asm 11.2.0.4.0 and compatible.rdbms 11.2.0.2 attributes
 In order to enable ACFS, compatible.asm and compatible.rdbms attributes must be set both = 12.1.0.2.0 or higher in the diskgroup.

Solution:

#1: Set the Attribute:

sqlplus / as sysasm
SQL> ALTER DISKGROUP DATA SET ATTRIBUTE 'compatible.advm' = '12.1.0.2.0';
SQL> ALTER DISKGROUP DATA SET ATTRIBUTE 'compatible.asm' = '12.1.0.2.0';
exit

#2 : Check the new attributes values

$> asmcmd lsattr -G DATA -l

#3: And then create the ADVM volume as follows:

ASMCMD> volcreate -G DATA -s 250G volume1

PRCR-1013 : Failed to start resource ora.proxy_advm + ORA-09925: Unable to create audit trail file

$
0
0
PRCR-1013 : Failed to start resource ora.proxy_advm + ORA-09925: Unable to create audit trail file

Symptoms :

# srvctl start asm -proxy -n asmcloud1
PRCR-1013 : Failed to start resource ora.proxy_advm
PRCR-1064 : Failed to start resource ora.proxy_advm on node asmcloud1
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 20: Not a directory
Additional information: 9925

Cause:

Affected node shows the "audit" as a file instead of a directory

Solution :

Remove the audit file and create audit directory as grid user and restart cluster.

step 1:

$> rm /u01/app/12.1.0.2/grid/rdbms/audit

Step 2 : As Grid User

$> mkdir /u01/app/12.1.0.2/grid/rdbms/audit

Step 3: Restart Cluster:

# crsctl stop crs -f
# crsctl start crs
# crsctl stat res -t

Path is lost with error in ASM

$
0
0
Path is lost with error

Symptoms:

Errors in file /u01/oracle/product/diag/asm/+asm/+ASM/trace/+ASM_gmon_11519.trc:
ORA-27072: File I/O error>>>>>
Linux-x86_64 Error: 5: Input/output error
WARNING: Write Failed. group:1 disk:0 AU:1 offset:1044480 size:4096
WARNING: Hbeat write to PST disk 0.3915951984 (KARC_DG1_FLASH_0000) in group 1 failed.

Cause:

ORACLEASM_SCANORDER is set to empty.

Solution:

Set the oracleasm_scanorder to mpath should fix the issue.

Database restoration Failed with ORA-15001,ORA-17502

$
0
0
Database restoration Failed with ORA-15001,ORA-17502

Symptoms :

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/TEST1/DATAFILE/system.280.938093005
channel ORA_DISK_1: restoring datafile 00002 to +DATA/TEST1/DATAFILE/sysaux.274.938092969
channel ORA_DISK_1: restoring datafile 00003 to +DATA/TEST1/DATAFILE/undotbs1.273.938092969
channel ORA_DISK_1: restoring datafile 00004 to +DATA/TEST1/DATAFILE/users.279.938093029
channel ORA_DISK_1: restoring datafile 00005 to +DATA/mgmt_depot.dbf
channel ORA_DISK_1: restoring datafile 00006 to +DATA/mgmt.dbf
channel ORA_DISK_1: restoring datafile 00007 to +DATA/mgmt_ad4j.dbf
channel ORA_DISK_1: reading from backup piece /u01/TEST1/DB_FULL_REVPROEM_20171001_956268007_15247
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/TEST1/DB_FULL_REVPROEM_20171001_956268007_15247
ORA-19504: failed to create file "+DATA/mgmt.dbf"
ORA-17502: ksfdcre:3 Failed to create file +DATA/mgmt.dbf
ORA-15001: diskgroup "DATA" does not exist or is not mounted
ORA-15040: diskgroup is incomplete

SQL> select status from v$instance;
STATUS
------------
STARTED

SQL> select name, state from v$asm_diskgroup;

NAME STATE
------------------------------ -----------
RECO MOUNTED
DATA MOUNTED

Cause:

Permission issue.

Solution :

-- Change the permission.

ls -lrt /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle

-rwsr-s--x 1 oracle oinstall 327811823 Oct 2 16:50
/u01/app/oracle/product/12.1.0.2/dbhome_2/bin/oracle

The asm disks would be owned by grid:asmadmin so if the database needs to access those disks then the oracle binaries have to be oracle:asmadmin.

--Change the group to asmadmin :-

chgrp asmadmin /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
 ls -lrt  /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle

 -rwsr-s–x 1 oracle asmadmin 327811823 Oct 5 16:50/u01/app/oracle/product/12.1.0.2/dbhome_2/bin/oracle



Article 1

$
0
0

Set Autotrace Traceonly giving error SP2-0618 and SP2-0611 in Oracle 18c


I was trying few things in Oracle 18c database using command window and needed autotrace enable for the same.

When i had given command "set autotrace traceonly" it has thrown error as below,


SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report



It seems something wired here.

Few steps need to follow to work autotrace in sqlplus.


1.       cd $oracle_home/rdbms/admin
2.       log into sqlplus as sys or system
3.       run SQL> @utlxplan
4.       run SQL> create public synonym plan_table for plan_table
5.       run SQL> grant all on plan_table to public
6.       exit sqlplus and cd $oracle_home/sqlplus/admin
7.       log into sqlplus as SYS
8.       run SQL> @plustrce
9.       run SQL> grant plustrace to public



Let's follow another steps.

$ cd $ORACLE_HOME/sqlplus/admin/
$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Wed Oct 17 12:40:27 2018
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL> alter session set container=testpdb1;
Session altered.

SQL> @plustrce
SQL>
SQL> drop role plustrace;
drop role plustrace
          *
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist

SQL> create role plustrace;
Role created.

SQL>
SQL> grant select on v_$sesstat to plustrace;
Grant succeeded.

SQL> grant select on v_$statname to plustrace;
Grant succeeded.

SQL> grant select on v_$mystat to plustrace;
Grant succeeded.

SQL> grant plustrace to dba with admin option;
Grant succeeded.

SQL>
SQL> set echo off
SQL>
SQL> grant plustrace to public;
Grant succeeded.



After following all above steps, now we are good with autotrace traceonly.

SQL> conn hr/hr@testpdb1
Connected.
SQL>
SQL> set autotrace traceonly
SQL>

Article 0

$
0
0

SYSTEM Tablespace is Growing Abnormally in 12c

SYSTEM Tablespace is Growing Abnormally in 12c


My SYSTEM tablespace was growing rapidly. This was happening in my test environment. We observe that we 
were not doing much on this database. Only few users were working to test the application and doing 
approx 40-50 transaction per day. That's it.
There was no much load as well, still it's went up to 100gb. This seems to be some wired behavior .

Database version is 12cR1














Possibly there are few reasons for the same.

1)    Some has assigned default tablespace as SYSTEM
2)    Auditing is ON and consuming more space.
3)    SYS_LOB Objects uses lot of disk space
4)    Data dictionary objects uses lot of disk space

So now, how to find the root cause and what could be the solution?

Let’s query to dba_segments table to find the root cause. I came across few scenarios in my different databases. 
Here I am discussing those scenarios, what could be the problem and solution of it.

Use below query to find out what are those segments which are consuming lot of space in SYSTEM tablespace.
select owner,segment_name,segment_type
 ,bytes/(1024*1024) size_mb
 from dba_segments
 where tablespace_name = 'SYSTEM'
 order by size_mb desc



Scenario 1






















Here in above database my AUD$ table is growing rapidly and it is almost 30gb in size.

Problem
Auditing is enabled hence AUD$ table is growing very fast. Organization wants to do auditing and there is 
no option to disable it.

Solution
Few solutions which Oracle always recommended,
 ‘-  Move AUD$ to different tablespace
‘- Purge audit data
‘- Delete/truncate older data

Visit https://support.oracle.com  there are many notes available for this issue..

Scenario 2
Check below screenshot,
































Here in 2nd scenario, ARGUMENT$, I_ARGUMENT1, I_ARGUMENT2, IDL_UB1$, SOURCE$ ; tables and 
indexes showing very huge in size.
These tables are core dictionary tables. Consider like these tables stores your database/schema/table procedure’s 
meta data information.

You cannot move those tables to another table space or truncate or reorg of these table. Oracle strictly says that 
don’t touch those tables as these are metadata tables. If you move or truncate tables, you might lose database
 information and this will corrupts your database as well.

So, is this the ideal scenario?
Can’t we control the growth of those tables like AUD$ tables?

Answer is, Yes, this is the ideal scenario and we don’t have control over it.

Scenario 3
SYSTEM tablespace growing unexpectedly after database upgrade OR after IMPDP

If you are upgrading your database from 11g to 12c, this might happen that you observer some unexpected 
growth of SYSTEM tablespace.

Here I would like to highlight that when you do the data import; import do lots of compilation of your function, 
procedure and packages. Metadata is associated with PL/SQL library. During compilation it generates duplicate 
rows in ARGUMENT$ table, which cause to huge size of ARGUMENT$ table.

This behavior found in 12c database due to new features introduced and reported as BUG. Here is the bug 
information.
Bug 5910872 : ARGUMENT$ DATA UNNECESSARILY DUPLICATED.

Solution
Here the workaround is to recompile the objects. This will decrease the logical space, not the physical space.
Run this command after impdp,
Example
1) alter session set events ='10946 trace name context forever, level 8454144'; 

2) exec utl_recomp.recomp_parallel('4','SCOTT');   

Scenario 4

Many a times it has been observed that data dictionary tables are occupying more space like BOOTSTRAP$, 
FILE$, UNDO$, IDL_UB1$, SOURCE$ etc.
Such issue found in Oracle Database 9i, 10g, 11g. Still I haven’t faced this type of issue in 12c or 18c.








Solution
To resolve this issue run catalog.sql and catproc.sql and re-query to dba_segments. 
This will work only in certain my scenario only, this is not for all.

Article 0

$
0
0

                  Workflow notification mailer not sending emails in Oracle Apps




We often find issues in Oracle Apps where our Workflow notification mailer not sending emails. There are many Steps to be involved to do the Debugging of the Workflow notification mailer issues.
Step1:- First of all we need to confirm that our Notification Mailer and Listeners is working or Not. Some time Notification mailer got some issues and it goes down automatically. So this is also be one of the case of Workflow notification mailer not sending emails.
To Check Notification Mailer and Listeners are working or not We need to go to the
'Workflow Administrator Web Applications' responsibility.

Step2:- If our Notification Mailer is running fine , Then in Step 2 , we will check the WF_NOTIFICATIONS table to check the status of the Email for the notification.
Query:
Select * from WF_Notifications where notification_id = :notification_id and item_key = :item_key(po_header_id or requisition_header_id or Expense Report Number);
In this Table We have column 'Mail _Status' which determine the status of the email that whether email is send or not.

Mail_status:

  • Sent: – Mails are successfully sent to the recipients.
  • Error: – Mails are not delivered to the recipient due to invalid email address.
  • Mail :- This Notification is Eligible for Sending Email but not sent yet. This status will be converted to Sent or Error.
  • Null:- IF Notification Mail status Null then it means this notification is not eligible not sending emails. If its null then it could be an issue in the Setup side

Step 3:

 If your Particular Notification Record Mail_Status showing 'Null' then it means there is some issue in the Setups.
If user is not receiving the Workflow Email's  , then we need to check the User Preferences settings for the user. This could be the reason of Mail_Status Column Showing null for the Notification for Particular Recipient
Go to Your Application Home Page , Then Go to the Top Right Side of the corner
Select the Preferences Option.
In the Preferences Under Notifications Select the Email Style ' HTML mail with attachments'

This Information Stores in the WF_LOCAL_ROLES TABLE.
To Update Preferences From Backend.
update wf_local_roles set notification_preference = ‘MAILHTML’ where name = ‘USER_NAME'

Article 0

$
0
0
                                                Error in  Diskgroup  ASM Solaris 


Steps: 


1. After adding the raw disk mounted to the Server. Perform the following steps.

Use format command from root user and it will show the available disk and also the newly added device in it.

Example:root@host:~$ format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t0d0
          /pci@0,600000/pci@0/pci@8/pci@0/scsi@1/sd@0,0
       1. c0t1d0 Solaris
          /pci@0,600000/pci@0/pci@8/pci@0/scsi@1/sd@1,0
       2. c2t600A0B800029B03400001B474BE28D9Bd0
          /scsi_vhci/ssd@g600a0b800029b03400001b474be28d9b
       3. c2t600A0B800029B034000022A64DB65A53d0
          /scsi_vhci/ssd@g600a0b800029b034000022a64db65a53
     
Specify disk (enter its number): 3

And give the partition label and cylinder 3 .

In Solaris the device is visible if the cylinder label is set as 3 and created. / it wont show it device in the asmca or in v$asm_disk.

And  mounted to the ASM.







Article 2

$
0
0
Adop fs_clone fails with error - the following nodes are not in sync.


Issue:

EBS Application is multi node setup and a patch has been applied by DBA from Primary node using adop with hotpatch option. The patch is successful in one node and failed on other node. This is not observed by the DBA and he proceeded with other patch as well and that has also failed on second node.

DBA identified the issue on secondary node and fixed the issue with second node. 

DBA fixed issue on Node2 and tried to apply patch on Slave node with allnodes=no

adop phase=apply patches=20012197 workers=8 hotpatch=yes allnodes=no action=nodb

adop returned successfully updated that Patch is successfull.

Now we need to sync the filesystems and tried to fs_clone on all nodes as below.

$ adop phase=fs_clone

Unfortunately fs_clone has failed with below errors..
Checking for pending adop sessions...
    No pending session exists.
    Staging new adop session...
    [UNEXPECTED]The following nodes are not in sync : oraapp02    Please bring the nodes in sync and then continue    [UNEXPECTED]Unrecoverable error occured. Exiting the current session.


DBA Tried to run prepare/cleanup and none of them helped.. all these got failed.

Solution:

Even though patch has been applied on failed nodes and it showed as successfull. ADOP activity didn't updated patchrun_id in table AD_ADOP_SESSION_PATCHES.
 
Below is the output seen:

select bug_number, patchrun_id, node_name from  AD_ADOP_SESSION_PATCHES where bug_number in ('20126243') 
BUG_NUMBER                     PATCHRUN_ID            NODE_NAME                       
------------------------------ ---------------------- ------------------------------- 
20126243                       24398                  oraapp01                      
20126243                       -1                  oraapp02                     
   
Based on output patchrun_id for oraapp02 should be 24398 instead it is showing as "-1".

Before are two solutions to fix this issue:

Sol 1: 
If Patch that is applied is a small oneoff patch try applying patch on all nodes with force option & nodbportion as below

$ adop phase=apply  patches=20126243 workers=8 hotpatch=yes options=forceapply,nodatabaseportion

This step will update patchrun_id in table AD_ADOP_SESSION_PATCHES

Sol 2: 
Manually update patchrun_id for node 2 as value same as that of node1

SQL> update table AD_ADOP_SESSION_PATCHES set patchrun_id=24398 where bug_number='<bug_number>' and session_id='<adop_sess_id>' and node_name='oraapp02';
SQL> commit;

Run fs_clone now it will complete now without any issues 



Article 1

$
0
0

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

Article 0

$
0
0

Deinstall Oracle Database 12c with all PDBs

Deinstall Oracle Database 12c with all PDBs


How to deinstall oracle database 12c and all PDBs which are connected to the same CDB.



Step 1: Export ORACLE_HOME & PATH

bash-4.1$ export ORACLE_HOME=/mnt/Oracle/product/12.1.0.2/db_1
bash-4.1$ export PATH=$ORACLE_HOME/bin:$PATH
bash-4.1$ cd $ORACLE_HOME
bash-4.1$ cd bin

Go to the deinstall directory.

bash-4.1$ pwd
/mnt/Oracle/product/12.1.0.2/db_1/deinstall


Step 2: Run deinstall.sh, Below is the full listing of how deinstall process run through.
I have highlighted few parts in bold which needs user input and require more attention during deinstall process.


bash-4.1$ pwd
/mnt/Oracle/product/12.1.0.2/db_1/deinstall

bash-4.1$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2016-06-08_11-09-08AM/logs/

############ ORACLE DECONFIG TOOL START ############

The product version number of the specified home cannot be determined. Is the product 
version 12.1.0.2.0 (y - yes, n - no)? [n]y

######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##
The deinstall tool cannot determine the home type needed to deconfigure the selected home.  Please select the type of Oracle home you are trying to deinstall.
Single Instance database - Enter 1
Real Application Cluster database - Enter 2
Grid Infrastructure for a cluster - Enter 3
Grid Infrastructure for a stand-alone server - Enter 4
Client Oracle Home - Enter 5
Transparent Gateways Oracle Home - Enter 6
GSM Oracle Home - Enter 7
1
The product version number of the specified home cannot be determined. Is the product version at least 11.2.0.1.0 (y - yes, n - no)? [n]
y



Checking for existence of the Oracle home location /mnt/Oracle/product/12.1.0.2/db_1
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is:
Checking for existence of central inventory location /mnt/Oracle/oraInventory

## [END] Install check configuration ##


Network Configuration check config START
Network de-configuration trace file location: /tmp/deinstall2016-06-08_11-09-08AM/logs/netdc_check2016-06-08_11-27-01-AM.log

Specify all Single Instance listeners that are to be de-configured. Enter .(dot) to deselect all. [LISTENERORCLNEW,LISTENER]:
Network Configuration check config END
Database Check Configuration START

Database de-configuration trace file location: /tmp/deinstall2016-06-08_11-09-08AM/logs/databasedc_check2016-06-08_11-27-11-AM.log

Use comma as separator when specifying list of values as input

Specify the list of database names that are configured in this Oracle home [orcl12c,orclnew,orclchan]: 

###### For Database 'orclnew' ######

Single Instance Database
The diagnostic destination location of the database: /mnt/Oracle/diag/rdbms/orclnew
Storage type used by the Database: FS
Database file location: /mnt/OrclNew/oradata/orclnew,/mnt/OrclNew/fast_recovery_area/orclnew
Fast recovery area location: /mnt/OrclNew/fast_recovery_area/ORCLNEW
database spfile location: /mnt/Oracle/product/12.1.0.2/db_1/dbs/spfileorclnew.ora

###### For Database 'orclchan' ######

Single Instance Database
The diagnostic destination location of the database: /mnt/Oracle/diag/rdbms/orclchan
Storage type used by the Database: FS
Database file location: /mnt/OrclChan/oradata/orclchan,/mnt/OrclChan/fast_recovery_area/orclchan
Fast recovery area location: /mnt/OrclChan/fast_recovery_area/ORCLCHAN
database spfile location: /mnt/Oracle/product/12.1.0.2/db_1/dbs/spfileorclchan.ora

The details of database(s) orclnew,orclchan have been discovered automatically. For database(s) orcl12c details will be prompted for confirmation. Do you still want to modify the details of orclnew,orclchan database(s)? [n]: y


###### For Database 'orcl12c' ######

Specify the type of this database (1.Single Instance Database|2.Oracle Restart Enabled Database) [1]: 1
Specify the diagnostic destination location of the database [/mnt/Oracle/diag/rdbms/orcl12c]:
Specify the storage type used by the Database ASM|FS []: FS

Specify the list of directories if any database files exist on a shared file system. If 'orcl12c' subdirectory is found, then it will be deleted. Otherwise, the specified directory will be deleted. Alternatively, you can specify list of database files with full path [ ]:

Specify the fast recovery area location, if it is configured on the file system. If 'orcl12c' subdirectory is found, then it will be deleted. []:

Specify the database spfile location [ ]:


###### For Database 'orclnew' ######

Specify the type of this database (1.Single Instance Database|2.Oracle Restart Enabled Database) [1]:
Specify the diagnostic destination location of the database [/mnt/Oracle/diag/rdbms/orclnew]:
Specify the storage type used by the Database ASM|FS [FS]:

Specify the list of directories if any database files exist on a shared file system. If 'orclnew' subdirectory is found, then it will be deleted. Otherwise, the specified directory will be deleted. Alternatively, you can specify list of database files with full path [/mnt/OrclNew/oradata/orclnew,/mnt/OrclNew/fast_recovery_area/orclnew]:

Specify the fast recovery area location, if it is configured on the file system. If 'orclnew' subdirectory is found, then it will be deleted. [/mnt/OrclNew/fast_recovery_area/ORCLNEW]:

Specify the database spfile location [/mnt/Oracle/product/12.1.0.2/db_1/dbs/spfileorclnew.ora]:


###### For Database 'orclchan' ######

Specify the type of this database (1.Single Instance Database|2.Oracle Restart Enabled Database) [1]:
Specify the diagnostic destination location of the database [/mnt/Oracle/diag/rdbms/orclchan]:
Specify the storage type used by the Database ASM|FS [FS]:

Specify the list of directories if any database files exist on a shared file system. If 'orclchan' subdirectory is found, then it will be deleted. Otherwise, the specified directory will be deleted. Alternatively, you can specify list of database files with full path [/mnt/OrclChan/oradata/orclchan,/mnt/OrclChan/fast_recovery_area/orclchan]:

Specify the fast recovery area location, if it is configured on the file system. If 'orclchan' subdirectory is found, then it will be deleted. [/mnt/OrclChan/fast_recovery_area/ORCLCHAN]:

Specify the database spfile location [/mnt/Oracle/product/12.1.0.2/db_1/dbs/spfileorclchan.ora]:

Database Check Configuration END
Oracle Configuration Manager check START
OCM check log file location : /tmp/deinstall2016-06-08_11-09-08AM/logs//ocm_check9495.log
Oracle Configuration Manager check END

######################### DECONFIG CHECK OPERATION END #########################

####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /mnt/Oracle/product/12.1.0.2/db_1
Inventory Location where the Oracle home registered is: /mnt/Oracle/oraInventory
Following Single Instance listener(s) will be de-configured: LISTENERORCLNEW,LISTENER
The following databases were selected for de-configuration : orcl12c,orclnew,orclchan
Database unique name : orcl12c
Storage used : FS
Database unique name : orclnew
Storage used : FS
Database unique name : orclchan
Storage used : FS
Checking the config status for CCR
Oracle Home exists with CCR directory, but CCR is not configured
CCR check is finished
Do you want to continue (y - yes, n - no)? [n]: Y
A log of this session will be written to: '/tmp/deinstall2016-06-08_11-09-08AM/logs/deinstall_deconfig2016-06-08_11-10-35-AM.out'
Any error messages from this session will be written to: '/tmp/deinstall2016-06-08_11-09-08AM/logs/deinstall_deconfig2016-06-08_11-10-35-AM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /tmp/deinstall2016-06-08_11-09-08AM/logs/databasedc_clean2016-06-08_11-29-24-AM.log
Database Clean Configuration START orcl12c
This operation may take few minutes.
Database Clean Configuration END orcl12c
Database Clean Configuration START orclnew
This operation may take few minutes.
Database Clean Configuration END orclnew
Database Clean Configuration START orclchan
This operation may take few minutes.
Database Clean Configuration END orclchan

Network Configuration clean config START

Network de-configuration trace file location: /tmp/deinstall2016-06-08_11-09-08AM/logs/netdc_clean2016-06-08_11-33-09-AM.log

De-configuring Single Instance listener(s): LISTENERORCLNEW,LISTENER

De-configuring listener: LISTENERORCLNEW
    Stopping listener: LISTENERORCLNEW
    Listener stopped successfully.
    Deleting listener: LISTENERORCLNEW
    Listener deleted successfully.
Listener de-configured successfully.

De-configuring listener: LISTENER
    Stopping listener: LISTENER
    Warning: Failed to stop listener. Listener may not be running.
    Deleting listener: LISTENER
    Listener deleted successfully.
Listener de-configured successfully.

De-configuring Naming Methods configuration file...
Naming Methods configuration file de-configured successfully.

De-configuring Local Net Service Names configuration file...
Local Net Service Names configuration file de-configured successfully.

De-configuring backup files...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.
Network Configuration clean config END

Oracle Configuration Manager clean START
OCM clean log file location : /tmp/deinstall2016-06-08_11-09-08AM/logs//ocm_clean9495.log
Oracle Configuration Manager clean END

######################### DECONFIG CLEAN OPERATION END #########################


####################### DECONFIG CLEAN OPERATION SUMMARY #######################
Successfully de-configured the following database instances : orcl12c,orclnew,orclchan
Following Single Instance listener(s) were de-configured successfully: LISTENERORCLNEW,LISTENER
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
#######################################################################


############# ORACLE DECONFIG TOOL END #############

Using properties file /tmp/deinstall2016-06-08_11-09-08AM/response/deinstall_2016-06-08_11-10-35-AM.rsp
Location of logs /tmp/deinstall2016-06-08_11-09-08AM/logs/

############ ORACLE DEINSTALL TOOL START ############


####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/tmp/deinstall2016-06-08_11-09-08AM/logs/deinstall_deconfig2016-06-08_11-10-35-AM.out'
Any error messages from this session will be written to: '/tmp/deinstall2016-06-08_11-09-08AM/logs/deinstall_deconfig2016-06-08_11-10-35-AM.err'

######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to OraLinuxNode
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2016-06-08_11-09-08AM/oraInst.loc
Setting oracle.installer.local to false

## [END] Preparing for Deinstall ##

Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START

Detach Oracle home '/mnt/Oracle/product/12.1.0.2/db_1' from the central inventory on the local node : Done

Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/bin'. The directory is in use.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/sqlplus/mesg'. The directory is in use.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/sqlplus'. The directory is not empty.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/rdbms/mesg'. The directory is in use.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/rdbms'. The directory is not empty.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/deinstall'. The directory is in use.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/lib'. The directory is in use.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/oracore/zoneinfo'. The directory is in use.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1/oracore'. The directory is not empty.
Failed to delete the directory '/mnt/Oracle/product/12.1.0.2/db_1'. The directory is not empty.
Delete directory '/mnt/Oracle/product/12.1.0.2/db_1' on the local node : Failed <<<<

Delete directory '/mnt/Oracle/oraInventory' on the local node : Done
Oracle Universal Installer cleanup was successful.
Oracle Universal Installer clean END

## [START] Oracle install clean ##

Clean install operation removing temporary directory '/tmp/deinstall2016-06-08_11-09-08AM' on node 'OraLinuxNode'

## [END] Oracle install clean ##


######################### DEINSTALL CLEAN OPERATION END #########################


####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/mnt/Oracle/product/12.1.0.2/db_1' from the central inventory on the local node.
Failed to delete directory '/mnt/Oracle/product/12.1.0.2/db_1' on the local node.
Successfully deleted directory '/mnt/Oracle/oraInventory' on the local node.
Oracle Universal Installer cleanup was successful.

Run 'rm -r /opt/ORCLfmap' as root on node(s) 'OraLinuxNode' at the end of the session.
Run 'rm -r /etc/oratab' as root on node(s) 'OraLinuxNode' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL TOOL END #############

bash-4.1$
#######################################################################
#######################################################################


So, deinstallation completed and all files and folders also deleted except below directories.
/mnt/devops_0/Oracle/db1212/product/12.1.0.2/db_1/deinstall
This is because we have initiated deinstall process from above location hence Oracle cannot delete above directories. We can delete Oracle directory manually once deinstall process completed.

MONITORING LONG RUNING QUERY

$
0
0


MONITORING LONG RUNING QUERY
==============================

using the v$session_longops view, you can view any SQL statement that executes for more than 6 seconds.

select  s.inst_id,
        SQL.SQL_TEXT as "OPERATION",
        to_char(START_TIME, 'dd/mm/yyyy hh24:mi:ss') Start_Time,
        to_char(LAST_UPDATE_TIME, 'dd/mm/yyyy hh24:mi:ss') Last_Update_Time,
        round(TIME_REMAINING/60,1) as "MINUTES_REMAINING",
        round((SOFAR/TOTALWORK) * 100,2) as PCT_DONE
from    gv$session s,
        gv$sqlarea sql,
        gv$session_longops op
where   
        s.sid=op.sid
and     s.sql_id = sql.sql_id
and     s.sid = op.sid
and     s.status  = 'ACTIVE'
and     op.totalwork > op.sofar
and     s.sid not in (select distinct sid from gv$mystat where rownum < 2)
order by 4 desc;


the SET_SESSION_LONGOPS procedure of the DBMS_APPLICATION_INFO package can be used to publish your application information about the progress of long operations.

DECLARE
        rindex    BINARY_INTEGER;
        slno      BINARY_INTEGER;
        totalwork number;
        sofar     number;
        obj       BINARY_INTEGER;
 
      BEGIN
        rindex := dbms_application_info.set_session_longops_nohint;
        sofar := 0;
        totalwork := 10;
 
        WHILE sofar < 10 LOOP
          -- update obj based on sofar
          -- perform task on object target
 
          sofar := sofar + 1;
          dbms_application_info.set_session_longops(rindex, slno,
            "Operation X", obj, 0, sofar, totalwork, "table", "tables");
        END LOOP;
      END;
 
 
 
 
After instrumentation, v$session_longops view is populated with this information:
SELECT
   opname,
   target_desc,
   sofar,
   totalwork,
   time_remaining,
    units
FROM 
   v$session_longops;
 
 
   

IN-MEMORY In Oracle 12c

$
0
0


IN-MEMORY In Oracle 12c
=======================
How to check whether inmemory is enabled or not:

SQL> show parameter inmemory

NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------
inmemory_clause_default              string
inmemory_force                       string      DEFAULT
inmemory_max_populate_servers        integer     0
inmemory_query                       string      ENABLE     
inmemory_size                        big integer 0  ---- > 0 Means inmemory not enabled
inmemory_trickle_repopulate_servers_ integer     1
percent
optimizer_inmemory_aware             boolean     TRUE



SQL>  select name,value from v$sga where NAME='In-Memory Area';

No rows selected.

How to enable the in-memory feature in DB:

SQL> alter system set inmemory_size=5G scope=spfile;

System altered.


shutdown immediate;
startup


SQL> show parameter inmemory_size

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
inmemory_size                        big integer 3G


SQL>  select name,value from v$sga where NAME='In-Memory Area';
NAME                      VALUE
-------------------- ----------
In-Memory Area       3221225472

Enable in-memory for  a table

SELECT table_name,inmemory,inmemory_priority,
inmemory_distribute,inmemory_compression,
inmemory_duplicate
FROM   dba_tables
WHERE table_name='test123';

no rows selected

SQL>select owner, segment_name, populate_status from v$im_segments

no rows selected



SELECT table_name,inmemory,inmemory_priority,
inmemory_distribute,inmemory_compression,
inmemory_duplicate
FROM   dba_tables
WHERE table_name='test123';

no rows selected

SQL>select owner, segment_name, populate_status from v$im_segments

no rows selected

SQL> alter table dbaadmin.test123 inmemory;

Table altered


col owner for a12
col segment_name for a12
select owner, segment_name, populate_status from v$im_segments

no rows selected


select count(*) from dbaadmin.test123;


col owner for a12
col segment_name for a12
select owner, segment_name, populate_status from v$im_segments

OWNER        SEGMENT_NAME POPULATE_STATUS
------------ ------------ ---------------
dbaadmin     test123        COMPLETED

set lines 299
col table_name for a12
SELECT table_name,inmemory,inmemory_priority,
inmemory_distribute,inmemory_compression,
inmemory_duplicate
FROM   dba_tables
WHERE table_name='test123';


TABLE_NAME   INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
------------ -------- -------- --------------- ----------------- -------------
test123        ENABLED  NONE     AUTO            FOR QUERY LOW     NO DUPLICATE



Now check the explain plan:


SQL> explain plan for select * from dbaadmin.test123;

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Plan hash value: 3778028574

------------------------------------------------------------------------------------
| Id  | Operation                  | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |       | 77294 |  8001K|    29  (25)| 00:00:01 |
|   1 |  TABLE ACCESS INMEMORY FULL| test123 | 77294 |  8001K|    29  (25)| 00:00:01 | ---- >>> THIS ONE SHOWS THAT INMEMORY IS USED
------------------------------------------------------------------------------------

8 rows selected.


Enable in-memory with PRIORITY CRITICAL

ALTER TABLE dbaadmin.TEST3 INMEMORY PRIORITY CRITICAL;


SQL> select OWNER,SEGMENT_NAME,populate_status,INMEMORY_PRIORITY from v$im_segments;

OWNER    SEGMENT_N POPULATE_ INMEMORY
-------- --------- --------- --------
dbaadmin test124     COMPLETED CRITICAL
dbaadmin test123     COMPLETED NONE


Enable in-memory for a tablespace:

If enabled at tablespace level, all the tables will enable for IM column store.

SQL> select tablespace_name,DEF_INMEMORY,DEF_INMEMORY_PRIORITY,DEF_INMEMORY_COMPRESSION,
DEF_INMEMORY_DISTRIBUTE,DEF_INMEMORY_DUPLICATE from dba_tablespaces where tablespace_name='USERS';

TABLESPACE_NAME                DEF_INME DEF_INME DEF_INMEMORY_COMP DEF_INMEMORY_DI DEF_INMEMORY_
------------------------------ -------- -------- ----------------- --------------- -------------
USERS                          DISABLED

SQL> ALTER TABLESPACE USERS DEFAULT INMEMORY;

Tablespace altered.

SQL> select tablespace_name,DEF_INMEMORY,DEF_INMEMORY_PRIORITY,DEF_INMEMORY_COMPRESSION,
DEF_INMEMORY_DISTRIBUTE,DEF_INMEMORY_DUPLICATE from dba_tablespaces where tablespace_name='USERS';


TABLESPACE_NAME                DEF_INME DEF_INME DEF_INMEMORY_COMP DEF_INMEMORY_DI DEF_INMEMORY_
------------------------------ -------- -------- ----------------- --------------- -------------
USERS                          ENABLED  NONE     FOR QUERY LOW     AUTO            NO DUPLICATE


Disable in-memory for the table:

ALTER TABLE dbaadmin.test123 NO INMEMORY;

USAGE:

V$INMEMORY_AREA stores the usage of inmemory area.


set pagesize 200
set lines 200
select * from V$INMEMORY_AREA
POOL                       ALLOC_BYTES USED_BYTES POPULATE_STATUS                CON_ID
-------------------------- ----------- ---------- -------------------------- ----------
1MB POOL                    2549088256    9437184 DONE                                0
64KB POOL                    654311424    1638400 DONE                                0



ENABLE_PARALLEL_DML Hint In Oracle 12c

$
0
0

ENABLE_PARALLEL_DML Hint In Oracle 12c:
=======================================

Till Oracle 12c, For doing DML transactions in parallel, we need to enable PDML (parallel DML) at the session level.
I.e before any DML statement, we need to issue the below statement.

ALTER SESSION ENABLE PARALLEL DML;

-- Then parallel DML statement

insert /*+ parallel(8) */ into test123 select * from test123;



ALTER SESSION ENABLE PARALLEL DML;

-- Then parallel DML statement

insert /*+ parallel(8) */ into test123 select * from test123;


WITHOUT ENABLE_PARALLEL_DML:
============================

SQL> explain plan for insert /*+ parallel(8) */ into test123 select * from test123;

Explained.


PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Plan hash value: 2876518734

------------------------------------------------------------------------------------------------------------------
| Id  | Operation                | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
------------------------------------------------------------------------------------------------------------------
|   0 | INSERT STATEMENT         |          |   122K|    13M|    82   (2)| 00:00:01 |        |      |            |
|   1 |  LOAD TABLE CONVENTIONAL | test123    |       |       |            |          |        |      |            |  ----- > NOT UNDER PX CORDIN..
|   2 |   PX COORDINATOR         |          |       |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM)   | :TQ10000 |   122K|    13M|    82   (2)| 00:00:01 |  Q1,00 | P->S | QC (RAND)  |
|   4 |     PX BLOCK ITERATOR    |          |   122K|    13M|    82   (2)| 00:00:01 |  Q1,00 | PCWC |            |
|   5 |      TABLE ACCESS FULL   | test123    |   122K|    13M|    82   (2)| 00:00:01 |  Q1,00 | PCWP |            |

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------

Note
-----
   - Degree of Parallelism is 8 because of hint
   - PDML is disabled in current session --- >          --- >>>  IT INDICATED PDML IS DISABLED

17 rows selected.



WITH ENABLE_PARALLEL_DML hint:
==============================

SQL> explain plan for insert /*+ parallel(8) enable_parallel_dml */ into test123 select * from test123;

Explained.

SQL> set lines 299
SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Plan hash value: 4043334015

-----------------------------------------------------------------------------------------------------------------------
| Id  | Operation                          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Dist
-----------------------------------------------------------------------------------------------------------------------
|   0 | INSERT STATEMENT                   |          | 61649 |  6863K|    40   (3)| 00:00:01 |        |      |       
|   1 |  PX COORDINATOR                    |          |       |       |            |          |        |      |       
|   2 |   PX SEND QC (RANDOM)              | :TQ10000 | 61649 |  6863K|    40   (3)| 00:00:01 |  Q1,00 | P->S | QC (RAN --- > LOAD IS UNDER PX COORDINATOR
|   3 |    LOAD AS SELECT (HYBRID TSM/HWMB)| test123    |       |       |            |          |  Q1,00 | PCWP |       
|   4 |     PX BLOCK ITERATOR              |          | 61649 |  6863K|    40   (3)| 00:00:01 |  Q1,00 | PCWC |       
|   5 |      TABLE ACCESS FULL             | test123    | 61649 |  6863K|    40   (3)| 00:00:01 |  Q1,00 | PCWP |       

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------

Note
-----
   - The degree of Parallelism is 8 because of the hint         - PARALLEL IS ENABLED

16 rows selected.


We can see, With this ENABLE_PARALLEL_DML hint, even without the alter session command, PDML is enabled.
Viewing all 1640 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>