Sunday, December 9, 2018

RMAN Backup of Oracle 12c Database


 run
{
 allocate channel c1 device type disk format '/dbexports/FCUBS/RMANBACKUP/FCUB/%u';
 allocate channel c2 device type disk format '/dbexports/FCUBS/RMANBACKUP/FCUB/%u';
 allocate channel c3 device type disk format '/dbexports/FCUBS/RMANBACKUP/FCUB/%u';
 allocate channel c4 device type disk format '/dbexports/FCUBS/RMANBACKUP/FCUB/%u';
 allocate channel c5 device type disk format '/dbexports/FCUBS/RMANBACKUP/FCUB/%u';
 backup database plus archivelog;
}

 run{
 CONFIGURE DEVICE TYPE disk BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 6;
 allocate channel c1 device type disk  format '/dbexports/FCUBS/RMANBACKUP/FCUB/%d_D_%T_%u_s%s_p%p' MAXPIECESIZE 2G ;
 allocate channel c2 device type disk  format '/dbexports/FCUBS/RMANBACKUP/FCUB/%d_D_%T_%u_s%s_p%p' MAXPIECESIZE 2G ;
 allocate channel c3 device type disk  format '/dbexports/FCUBS/RMANBACKUP/FCUB/%d_D_%T_%u_s%s_p%p' MAXPIECESIZE 2G ;
 allocate channel c4 device type disk  format '/dbexports/FCUBS/RMANBACKUP/FCUB/%d_D_%T_%u_s%s_p%p' MAXPIECESIZE 2G ;
 BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG  ;
  backup current controlfile for standby format '/dbexports/FCUBS/RMANBACKUP/FCUB/standbycontrol.ctl';
}

Wednesday, July 25, 2018

Configure X11 on Exadata Compute Node

By default, X11 is disabled on Compute node and requires X11 libraries to install before the launch of any Oracle or other GUI tools.
here are rpm files required and commands to configure

Step1. Get the following files.
libdmx-1.1.3-3.el6.x86_64.rpm                                                                               100%   14KB  14.1KB/s   00:00
libICE-1.0.6-1.el6.x86_64.rpm                                                                               100%   52KB  52.1KB/s   00:00
libSM-1.2.1-2.el6.x86_64.rpm                                                                                100%   36KB  36.1KB/s   00:00
libXmu-1.1.1-2.el6.x86_64.rpm                                                                               100%   65KB  65.5KB/s   00:00
libXt-1.1.4-6.1.el6.x86_64.rpm                                                                              100%  164KB 164.0KB/s   00:00
libXxf86vm-1.1.3-2.1.el6.x86_64.rpm                                                                         100%   16KB  15.6KB/s   00:00
xorg-x11-utils-7.5-14.el6.x86_64.rpm                                                                        100%  100KB 100.1KB/s   00:00
xorg-x11-xauth-1.0.9-1.el6.x86_64.rpm                                                                       100%   44KB  43.8KB/s   00:00

Step2. Run the yum install command
[root@mbflxdbpdbadm01 ~]# yum install ./xorg-x11-xauth-1.0.9-1.el6.x86_64.rpm ./libXmu-1.1.1-2.el6.x86_64.rpm ./libXt-1.1.4-6.1.el6.x86_64.rpm ./libICE-1.0.6-1.el6.x86_64.rpm ./libSM-1.2.1-2.el6.x86_64.rpm
Setting up Install Process
Examining ./xorg-x11-xauth-1.0.9-1.el6.x86_64.rpm: 1:xorg-x11-xauth-1.0.9-1.el6.x86_64
Marking ./xorg-x11-xauth-1.0.9-1.el6.x86_64.rpm to be installed
Examining ./libXmu-1.1.1-2.el6.x86_64.rpm: libXmu-1.1.1-2.el6.x86_64
Marking ./libXmu-1.1.1-2.el6.x86_64.rpm to be installed
Examining ./libXt-1.1.4-6.1.el6.x86_64.rpm: libXt-1.1.4-6.1.el6.x86_64
Marking ./libXt-1.1.4-6.1.el6.x86_64.rpm to be installed
Examining ./libICE-1.0.6-1.el6.x86_64.rpm: libICE-1.0.6-1.el6.x86_64
Marking ./libICE-1.0.6-1.el6.x86_64.rpm to be installed
Examining ./libSM-1.2.1-2.el6.x86_64.rpm: libSM-1.2.1-2.el6.x86_64
Marking ./libSM-1.2.1-2.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package libICE.x86_64 0:1.0.6-1.el6 will be installed
---> Package libSM.x86_64 0:1.2.1-2.el6 will be installed
---> Package libXmu.x86_64 0:1.1.1-2.el6 will be installed
---> Package libXt.x86_64 0:1.1.4-6.1.el6 will be installed
---> Package xorg-x11-xauth.x86_64 1:1.0.9-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================
 Package                        Arch                   Version                       Repository                                          Size
==============================================================================================================================================
Installing:
 libICE                         x86_64                 1.0.6-1.el6                   /libICE-1.0.6-1.el6.x86_64                         115 k
 libSM                          x86_64                 1.2.1-2.el6                   /libSM-1.2.1-2.el6.x86_64                           76 k
 libXmu                         x86_64                 1.1.1-2.el6                   /libXmu-1.1.1-2.el6.x86_64                         154 k
 libXt                          x86_64                 1.1.4-6.1.el6                 /libXt-1.1.4-6.1.el6.x86_64                        406 k
 xorg-x11-xauth                 x86_64                 1:1.0.9-1.el6                 /xorg-x11-xauth-1.0.9-1.el6.x86_64                  89 k

Transaction Summary
==============================================================================================================================================
Install       5 Package(s)

Total size: 841 k
Installed size: 841 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : libICE-1.0.6-1.el6.x86_64                                                                                                  1/5
  Installing : libSM-1.2.1-2.el6.x86_64                                                                                                   2/5
  Installing : libXt-1.1.4-6.1.el6.x86_64                                                                                                 3/5
  Installing : libXmu-1.1.1-2.el6.x86_64                                                                                                  4/5
  Installing : 1:xorg-x11-xauth-1.0.9-1.el6.x86_64                                                                                        5/5
  Verifying  : libXmu-1.1.1-2.el6.x86_64                                                                                                  1/5
  Verifying  : libSM-1.2.1-2.el6.x86_64                                                                                                   2/5
  Verifying  : 1:xorg-x11-xauth-1.0.9-1.el6.x86_64                                                                                        3/5
  Verifying  : libICE-1.0.6-1.el6.x86_64                                                                                                  4/5
  Verifying  : libXt-1.1.4-6.1.el6.x86_64                                                                                                 5/5

Installed:
  libICE.x86_64 0:1.0.6-1.el6              libSM.x86_64 0:1.2.1-2.el6      libXmu.x86_64 0:1.1.1-2.el6      libXt.x86_64 0:1.1.4-6.1.el6
  xorg-x11-xauth.x86_64 1:1.0.9-1.el6

Complete!
[root@mbflxdbpdbadm01 ~]#




Step3: copy the .Xauthority file to desired user home folder

[root@mbflxdbpdbadm01 ~]# cp .Xauthority /home/oracle/
[root@mbflxdbpdbadm01 ~]# chmod 600 /home/oracle/.Xauthority
[root@mbflxdbpdbadm01 ~]# chown oracle:oinstall /home/oracle/.Xauthority

Tuesday, July 10, 2018

Exadata: Reallocate OCR and VOTE disks to different Diskgroup






===================================
ocrconfig
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check succeeded
[root@mbflxdbpdbadm01 bin]# ./ocrconfig -delete +DATAC1
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check succeeded
[root@mbflxdbpdbadm01 bin]# ./crsctl query css votedisk
SQL*Plus: Release 12.1.0.2.0 Production on Fri Jul 6 01:27:00 2018
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
SQL>  create pfile='/tmp/asminit.ora' from spfile;
File created.
SQL>
[grid@mbflxdbpdbadm01 ~]$ sqlplus / as sysasm
SQL*Plus: Release 12.1.0.2.0 Production on Fri Jul 6 01:27:00 2018
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
SQL>  create pfile='/tmp/asminit.ora' from spfile;
File created.
SQL> create spfile='+RECOC1' from pfile='/tmp/asminit.ora';
File created.
SQL> exit
[grid@mbflxdbpdbadm01 ~]$ gpnptool get
<?xml version="1.0" encoding="UTF-8"?><gpnp:GPnP-Profile Version="1.0" xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile gpnp-profile.xsd" ProfileSequence="5" ClusterUId="4ac943e6090e5f51ffde516369905bf9" ClusterName="mbprodclus" PALocation=""><gpnp:Network-Profile><gpnp:HostNetwork id="gen" HostName="*"><gpnp:Network id="net1" IP="172.28.167.0" Adapter="bondeth0" Use="public"/><gpnp:Network id="net2" IP="192.168.68.0" Adapter="ib0" Use="cluster_interconnect"/><gpnp:Network id="net3" IP="192.168.68.0" Adapter="ib1" Use="cluster_interconnect"/></gpnp:HostNetwork></gpnp:Network-Profile><orcl:CSS-Profile id="css" DiscoveryString="+asm" LeaseDuration="400"/><orcl:ASM-Profile id="asm" DiscoveryString="o/*/*" SPFile="+RECOC1/mbprodclus/ASMPARAMETERFILE/registry.253.980731721" Mode="legacy"/><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="gpnp orcl xsi"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>I5jcSBp+klSVfahABW28jC/wjns=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>kA26UJIgyVuhw/aNFbxta6pNfqUJbjitgwf593zUZzLIoHtXZmyQ6OCHA8jfr6aS6WpglFF3b0/do8YqIwnmu/IuY41mdyujtoJGUc+UavDHKZGohr5P62073iMx7oir04OPr8/QJ70zCGKzRAY0bC9N925Fz6Tc/GmuUITw/9Q=</ds:SignatureValue></ds:Signature></gpnp:GPnP-Profile>
[root@mbflxdbpdbadm01 bin]# ./crsctl start crs
GROUP_NUMBER INSTANCE_NAME
NAME                                 TYPE        VALUE
x

[root@mbflxdbpdbadm01 bin]# export ORACLE_SID=+ASM1
[root@mbflxdbpdbadm01 bin]# export ORACLE_HOME=/u01/app/12.1.0.2/grid
[root@mbflxdbpdbadm01 bin]# export PATH=$PATH:/u01/app/12.1.0.2/grid/bin

[root@mbflxdbpdbadm01 bin]# ./ocrconfig -add +RECOC1
[root@mbflxdbpdbadm01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     409568
         Used space (kbytes)      :       1900
         Available space (kbytes) :     407668
         ID                       : 1202396802
         Device/File Name         :    +DATAC1
                                    Device/File integrity check succeeded
         Device/File Name         :    +RECOC1
                                    Device/File integrity check succeeded











[root@mbflxdbpdbadm01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     409568
         Used space (kbytes)      :       1900
         Available space (kbytes) :     407668
         ID                       : 1202396802
         Device/File Name         :    +RECOC1
                                    Device/File integrity check succeeded













##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   659a51b34a524f84bf883eb244f50ea2 (o/192.168.68.109;192.168.68.110/DATAC1_CD_02_mbflxdbpceladm01) [DATAC1]
 2. ONLINE   1d4d1487d2624f07bf9c82d73c539dbc (o/192.168.68.111;192.168.68.112/DATAC1_CD_02_mbflxdbpceladm02) [DATAC1]
 3. ONLINE   d204dc678b064f9cbfbdd770a5d822cd (o/192.168.68.113;192.168.68.114/DATAC1_CD_02_mbflxdbpceladm03) [DATAC1]
 4. ONLINE   e65991258f004f49bfaef77bea5430d0 (o/192.168.68.115;192.168.68.116/DATAC1_CD_02_mbflxdbpceladm04) [DATAC1]
 5. ONLINE   c2c0a61055e34f81bf2c25460df33ed5 (o/192.168.68.117;192.168.68.118/DATAC1_CD_02_mbflxdbpceladm05) [DATAC1]
Located 5 voting disk(s).
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]# ./crsctl replace votedisk +RECOC1
Successful addition of voting disk 5ed72da19a754fd7bf9a45c3a02506a9.
Successful addition of voting disk 23a445e9deaa4f44bf75890d000a25ec.
Successful addition of voting disk e9c35fa192e94f8ebf03e9eb3310a56e.
Successful addition of voting disk fd54a9a45b244f02bf9f584e4e5bef95.
Successful addition of voting disk c507ce6a04454f85bf49affaef9feb6a.
Successful deletion of voting disk 659a51b34a524f84bf883eb244f50ea2.
Successful deletion of voting disk 1d4d1487d2624f07bf9c82d73c539dbc.
Successful deletion of voting disk d204dc678b064f9cbfbdd770a5d822cd.
Successful deletion of voting disk e65991258f004f49bfaef77bea5430d0.
Successful deletion of voting disk c2c0a61055e34f81bf2c25460df33ed5.
Successfully replaced voting disk group with +RECOC1.
CRS-4266: Voting file(s) successfully replaced
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]# ./crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   5ed72da19a754fd7bf9a45c3a02506a9 (o/192.168.68.109;192.168.68.110/RECOC1_CD_02_mbflxdbpceladm01) [RECOC1]
 2. ONLINE   23a445e9deaa4f44bf75890d000a25ec (o/192.168.68.111;192.168.68.112/RECOC1_CD_02_mbflxdbpceladm02) [RECOC1]
 3. ONLINE   e9c35fa192e94f8ebf03e9eb3310a56e (o/192.168.68.113;192.168.68.114/RECOC1_CD_02_mbflxdbpceladm03) [RECOC1]
 4. ONLINE   fd54a9a45b244f02bf9f584e4e5bef95 (o/192.168.68.115;192.168.68.116/RECOC1_CD_02_mbflxdbpceladm04) [RECOC1]
 5. ONLINE   c507ce6a04454f85bf49affaef9feb6a (o/192.168.68.117;192.168.68.118/RECOC1_CD_02_mbflxdbpceladm05) [RECOC1]
Located 5 voting disk(s).
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#



[grid@mbflxdbpdbadm01 ~]$ sqlplus / as sysasm





Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options













Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options









Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

[grid@mbflxdbpdbadm01 ~]$

Warning: some command line parameters were defaulted. Resulting command line:
         /u01/app/12.1.0.2/grid/bin/gpnptool.bin get -o-

Success.
[grid@mbflxdbpdbadm01 ~]$
[grid@mbflxdbpdbadm01 ~]$
[grid@mbflxdbpdbadm01 ~]$

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.crsd' on 'mbflxdbpdbadm01'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.DATAC1.dg' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN2.lsnr' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.MGMTLSNR' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.DATAC1.dg' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.DBFS_DG.dg' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.RECOC1.dg' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.RECOC1.dg' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.mbflxdbpdbadm01.vip' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.LISTENER_SCAN2.lsnr' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.scan2.vip' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.MGMTLSNR' on 'mbflxdbpdbadm01' succeeded
CRS-2672: Attempting to start 'ora.MGMTLSNR' on 'mbflxdbpdbadm04'
CRS-2677: Stop of 'ora.DBFS_DG.dg' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.asm' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.scan2.vip' on 'mbflxdbpdbadm01' succeeded
CRS-2672: Attempting to start 'ora.scan2.vip' on 'mbflxdbpdbadm04'
CRS-2677: Stop of 'ora.mbflxdbpdbadm01.vip' on 'mbflxdbpdbadm01' succeeded
CRS-2672: Attempting to start 'ora.mbflxdbpdbadm01.vip' on 'mbflxdbpdbadm02'
CRS-2676: Start of 'ora.MGMTLSNR' on 'mbflxdbpdbadm04' succeeded
CRS-2676: Start of 'ora.scan2.vip' on 'mbflxdbpdbadm04' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN2.lsnr' on 'mbflxdbpdbadm04'
CRS-2676: Start of 'ora.mbflxdbpdbadm01.vip' on 'mbflxdbpdbadm02' succeeded
CRS-2676: Start of 'ora.LISTENER_SCAN2.lsnr' on 'mbflxdbpdbadm04' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.ons' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.net1.network' on 'mbflxdbpdbadm01' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'mbflxdbpdbadm01' has completed
CRS-2677: Stop of 'ora.crsd' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.storage' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.storage' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.drivers.acfs' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.asm' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.evmd' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.ctssd' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.evmd' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.cssd' on 'mbflxdbpdbadm01' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'mbflxdbpdbadm01'
CRS-2673: Attempting to stop 'ora.gipcd' on 'mbflxdbpdbadm01'
CRS-2677: Stop of 'ora.gipcd' on 'mbflxdbpdbadm01' succeeded
CRS-2677: Stop of 'ora.diskmon' on 'mbflxdbpdbadm01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'mbflxdbpdbadm01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#
[root@mbflxdbpdbadm01 bin]#

CRS-4123: Oracle High Availability Services has been started.

  2  ;

------------ ----------------------------------------------------------------
DB_NAME  CLUSTER_NAME                    STATUS
-------- ------------------------------- ------------
SOFTWARE_VERSION
------------------------------------------------------------
COMPATIBLE_VERSION                                               CON_ID
------------------------------------------------------------ ----------
           3 +ASM1
+ASM     mbprodclus                      CONNECTED
12.1.0.2.0
12.1.0.2.0                                                            0



------------------------------------ ----------- ------------------------------
spfile                               string      +RECOC1/mbprodclus/ASMPARAMETE
                                                 RFILE/registry.253.980731721

SQL>
x

Disconnected
grid@mbflxdbpdbadm01 ~]$ export ORACLE_SID=+ASM1
Connected to:
Connected to:
[root@mbflxdbpdbadm01 bin]# ./crsctl stop crs
SQL> SELECT  * from v$asm_client
SQL> show parameter spfile
x






























































































































































































Thursday, July 5, 2018

Exadata Redundancy


1) “External” redundancy diskgroups do not provide ASM mirroring.
2) “External” redundancy diskgroups rely on the redundancy provided outside Oracle (e.g. RAID 1, etc) at Storage level.
3) Therefore, on “External” redundancy diskgroups, if one disk member fails or is affected, then the diskgroup is dismounted or cannot be mounted back again, this behavior is expected, because an external redundancy diskgroup cannot tolerate the failure of any disk in the diskgroup.
4) Any kind of disk failure causes ASM to dismount the diskgroup or unable to mount it back.
5) For this reason, if the redundancy provided outside Oracle(ASM) is not offering the complete/correct coverage against corruptions or physical disk failures (expected redundancy), it is recommendable to implement/use "Normal" or "High" redundancy diskgroups instead, because ASM ("Normal" or "High" redundancy) provides redundancy with the use of failure groups, which are defined during diskgroup creation. The diskgroup type determines how ASM mirrors files. When you create a diskgroup, you indicate whether the diskgroup is a "Normal" redundancy diskgroup (2-way mirroring for most files by default) or a "High" redundancy diskgroup (3-way mirroring) or an "External" redundancy diskgroup (no mirroring by Oracle ASM).
6) Failgroups definition is specific to each storage setup, but you should follow these guidelines on "Normal" redundancy diskgroups:

a) All the failgroups (each failgroup), in the same diskgroup, must have the same number of disks to maintain the diskgroup redundancy (mirroring).

b) All the disks, in the same diskgroup, must have the same uniform size to guarantee the required redundancy as well.

c) All the disks, in the same diskgroup, must have the same I/O physical characteristics to provide a uniform I/O throughput among all the disks in the same diskgroup.

Note: Those rules must be followed when normal or high redundancy diskgroups are created and configured, otherwise it is a bad diskgroup design and ASM redundancy will not be guaranteed, thus ASM mirroring will be in risk and I/O performance will be compromised as well

Mirroring protects data by storing copies of data across different disks, providing access to user data in the event of a disk failure. When you create an ASM disk group, you specify a level of redundancy—this redundancy level dictates how many copies of data are maintained:

Normal redundancy = two-way mirror
High redundancy = three-way mirror
External redundancy = no ASM mirroring; ASM uses mirroring functionality in the storage array/subsystem, if available, to provide protection
With Exadata, Oracle protects and mirrors storage exclusively with ASM normal or high redundancy; there is no external redundancy alternative on Exadata.

The redundancy level controls how many disk failures are tolerated without ASM un-mounting the disk group or losing data.

When ASM allocates an extent for a mirrored file, it allocates a primary copy and one or two mirror copies. Oracle places the mirror copy on a disk that’s part of a different failure group. Failure groups are where mirror copies are stored. If you lost disks in either the primary location or failure group(s) (but not both or all), Oracle would continue to operate normally on the surviving copy.

ASM doesn’t mirror physical disks or LUNs like traditional RAID—it mirrors database extents. This is a very important design aspect of ASM—with normal or high redundancy, extents are mirrored on sectors from disks on one or more failure groups. These failure groups consist of disks different from the primary extents.

On Oracle Exadata, Oracle always places mirrored extents on grid disks located in a different storage server. This provides the flexibility that if you lost an entire storage server, you would still have access to either the primary or mirrored extents.

Wednesday, July 4, 2018

EXADATA: How to resize ASM disks


EXADATA: How to resize ASM disks

Requirement:
Reduce the space allocated to RECO Diskgroup and allocate the space to DATA diskgroup.
Exclusion:
No change in redundacy at any level.
No add or drop any griddisk.
Approach:
1.Check the free space in celldisk and griddisk of both DATA and RECO
2.resize the RECO diskgroup
3.resize (reduction) griddisk of RECO diskgroup
4.resize (addition) griddisk of DATA diskgroup
5.resize the DATA diskgroup.
6.Check the free space 
7.conclude
Steps:
1.Login to storage cell and check

# cellcli -e "list celldisk where name like 'CD.*' attributes name, size, freespace"

# cellcli -e "list griddisk where name like 'DATA.*' attributes name, size"
# cellcli -e "list griddisk where name like 'RECO.*' attributes name, size"

2. Login to ASM instance in compute node

$ sqlplus / as sysasm
SQL> alter diskgroup RECO resize all size 20000M rebalance power 32;
SQL> select name, total_mb from v$asm_disk_stat where name like 'RECO%';

3. Login to *ALL* Storage cell and resize for RECO
# cellcli -e alter griddisk RECO_CD_00_exacell01, RECO_CD_01_exacell01, RECO_CD_02_exacell01, RECO_CD_03_exacell01, RECO_CD_04_exacell01, RECO_CD_05_exacell01, RECO_CD_06_exacell01, RECO_CD_07_exacell01, RECO_CD_08_exacell01, RECO_CD_09_exacell01, RECO_CD_10_exacell01, RECO_CD_11_exacell01 size=234176M;

4. Login to *ALL* Storage cell and resize for DATA
# cellcli -e alter griddisk DATA_CD_00_exacell01, DATA_CD_01_exacell01, DATA_CD_02_exacell01, DATA_CD_03_exacell01, DATA_CD_04_exacell01, DATA_CD_05_exacell01, DATA_CD_06_exacell01, DATA_CD_07_exacell01, DATA_CD_08_exacell01, DATA_CD_09_exacell01, DATA_CD_10_exacell01, DATA_CD_11_exacell01 size=300G;

5. Login to ASM instance in compute node and resize grid disk for DATA 

$ sqlplus / as sysasm
SQL> alter diskgroup DATA resize all rebalance power 32;

6. check free space
SQL> select name, total_mb/1024 "GB" from v$asm_disk_stat where name like 'DATA%';

Tuesday, May 22, 2018

TDE (Transparent Data Encryption)

Oracle has introduced TDE from 10g and has come through various enhancements till 12c release.


Encryption requires at least two things: an encryption key and an algorithm. TDE uses what is known as a two-tier key architecture: both column and tablespace encryption keys are stored in the database but are encrypted with another key called the master key . The master key is stored outside the database in a special container called an external security module , which can be something as easy to set up as an Oracle wallet or as sophisticated as a hardware security module device. The Oracle wallet is a file formatted according to Public Key Cryptography Standard No. 12 and encrypted with a password. For using the wallet as the external security module, a password must be provided to make the master key accessible to the database. Unless the right password is supplied, the wallet can’t be opened and the encrypted data can’t be retrieved. The wallet is automatically closed when the database instance is shut down and must be reopened by a security officer when the instance starts. So although thieves might be able to restore a database from tapes, without the wallet and the password, they will not be able to view the encrypted data. (In the hardware security module case, the hardware device must be made available to the database in a manner specified by the vendor of the device.)



Tablespace Encryption Setup
Let’s look at how to set up TDE tablespace encryption, using a file-based wallet. Note that the compatibility of the database must be set to 11.1 or higher. First, if you don’t have one, create the wallet:

1. Make sure the ORACLE_BASE variable has been set. If it has not, set it by issuing



$ export ORACLE_BASE=/opt/oracle



2. Change to the ORACLE_BASE directory and then to the admin subdirectory for that instance. In my case, the instance is named prolin1, so I issue



$ cd $ORACLE_BASE/admin/prolin1



3. Create a directory called “wallet” to hold the wallet:



$ mkdir wallet



4. Create the wallet, along with a secure password, preferably containing a mix of alphanumeric characters, such as “T45rustMe54”:



$ sqlplus / as sysdba
SQL> alter system set encryption key 
identified by "T45rustMe54";



The password is case-sensitive.

The preceding step will create the wallet as well as open it. You need to create the wallet only once. After the database is opened, the wallet remains open until either the wallet is explicitly closed or the database is shut down, at which time the wallet automatically closes. You can reopen this wallet after the database is restarted, by using



SQL> alter system set wallet open 
identified by "T45rustMe54";
System altered.



Now that the wallet is set up, you can create the encrypted tablespace.

1. The following code sets up an encrypted tablespace named enc128_ts:




create tablespace enc128_ts
datafile '/u01/oracle/database/
enc128_ts.dbf'
size 1M autoextend on next 1M
encryption using 'AES128'
default storage (encrypt)
/



Note the special encryption using 'AES128’ clause, which indicates that the AES algorithm is to be used with a 128-bit key. You can also use the values AES192 and AES256 (in place of AES128, the default value) to use 192- and 256-bit keys, respectively.

2. Once the tablespace is created, you can create objects in it. For instance, the following code creates a table called ACCOUNTS_ENC:



create table accounts_enc (
  ACC_NO        NUMBER           NOT NULL,
  FIRST_NAME  VARCHAR2(30)  NOT NULL,
                               
... other columns ...
)
tablespace enc128_ts;
                            



That’s it; no special clause is required. All the columns of the table (or anything else created in this tablespace) will be encrypted.





-------------



Steps to Configure Transparent Data Encryption (TDE)

Lets walk through the step by step process for implementing Transparent Data Encryption (TDE) in Oracle Database 12c.

Demonstration (step 1):

Configure Key store location in database for Oracle 12c Setup :

[oracle@labserver ~]$ echo $ORACLE_SID

prodcdb



[oracle@labserver ~]$ cd $ORACLE_HOME/network/admin



[oracle@labserver admin]$ pwd

/app/oracle/db/12.1.0.1/network/admin



[oracle@labserver admin]$ vi sqlnet.ora (append the following lines in SQLNET.ORA)

ENCRYPTION_WALLET_LOCATION=

 (SOURCE=

  (METHOD=FILE)

   (METHOD_DATA=

    (DIRECTORY=+DATA/PRODCDB/WALLET)

   )

 )

ENCRYPTION_WALLET_LOCATION.

[oracle@labserver ~]$ echo $ORACLE_SID

+ASM



[oracle@labserver ~]$ asmcmd

ASMCMD>

ASMCMD> cd +DATA/PRODCDB

ASMCMD> mkdir WALLET

ASMCMD> cd WALLET/

ASMCMD> pwd

+DATA/PRODCDB/WALLET

Demonstration (step 2):



sys@PRODCDB> ADMINISTER KEY MANAGEMENT CREATE KEYSTORE '+DATA/PRODCDB/WALLET' IDENTIFIED BY encWallet;



keystore altered.

Once we create the Keystore from the database, we can see the file 'ewallet.p12' gets created in the Keystore Location.

ASMCMD> pwd

+DATA/PRODCDB/WALLET

ASMCMD> ls -l

Type       Redund  Striped  Time             Sys  Name

KEY_STORE  MIRROR  COARSE   MAR 28 15:00:00  N    ewallet.p12 => +DATA/PRODCDB/KEY_STORE/ewallet.338.875546829

ASMCMD>

Demonstration (step 3):

Open the Keystore:

sys@PRODCDB> show con_name



CON_NAME

------------------------------

CDB$ROOT



sys@PRODCDB> ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY encWallet;



keystore altered.

We can optionally query the V_$ENCRYPTION_WALLET view to check the STATUS of the Keystore as shown below.

sys@PRODCDB> select * from V_$ENCRYPTION_WALLET;



WRL_TYPE   WRL_PARAMETER             STATUS                    WALLET_TYPE     WALLET_OR FULLY_BAC     CON_ID

---------- ------------------------- ------------------------- --------------- --------- --------- ----------

ASM        +DATA/PRODCDB/WALLET      OPEN_NO_MASTER_KEY        PASSWORD        SINGLE    UNDEFINED          0

To enable the Keystore to open automatically, use the following command.

Demonstration (Enable Auto Login for keystore):

Here, I am enabling Auto-Login for the Keystore defined for my Oracle 12c CDB database 'prodcdb'.

sys@PRODCDB> show con_name



CON_NAME

------------------------------

CDB$ROOT



sys@PRODCDB> ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE FROM KEYSTORE '+DATA/PRODCDB/WALLET' IDENTIFIED BY encWallet;



keystore altered.



Once, we enable the Auto-Login for the Keystore, we can see a new file 'cwallet.sso' gets created in the Keystore location.

[oracle@labserver ~]$ asmcmd

ASMCMD> cd +DATA/PRODCDB/WALLET

ASMCMD> ls -l

Type                 Redund  Striped  Time             Sys  Name

AUTOLOGIN_KEY_STORE  MIRROR  COARSE   --- -- 08:00:00  N    cwallet.sso => +DATA/PRODCDB/AUTOLOGIN_KEY_STORE/cwallet

We can also observe that WALLET_TYPE is set to AUTOLOGIN when querying V$ENCRYPTION_WALLET view.

sys@PRODCDB> select * from v$encryption_wallet;



WRL_TYPE             WRL_PARAMETER             STATUS     WALLET_TYPE          WALLET_OR FULLY_BAC     CON_ID

-------------------- ------------------------- ---------- -------------------- --------- --------- ----------

ASM                  +DATA/PRODCDB/WALLET      OPEN       AUTOLOGIN            SINGLE    NO                 0



sys@PRODCDB> select * from v$encryption_wallet;



WRL_TYPE             WRL_PARAMETER             STATUS               WALLET_TYPE          WALLET_OR FULLY_BAC     CON_ID

-------------------- ------------------------- -------------------- -------------------- --------- --------- ----------

ASM                  +DATA/PRODCDB/WALLET      OPEN_NO_MASTER_KEY   AUTOLOGIN            SINGLE    UNDEFINED          0

Demonstration (step 4):

Activating the Master Encryption Key :



sys@PRODCDB>  ADMINISTER KEY MANAGEMENT SET KEY IDENTIFIED BY encWallet WITH BACKUP;



keystore altered.

Once a Master Encryption Key is created, we can query the V_$ENCRYPTION_KEYS to check the status of key as follows.

sys@PRODCDB> select CON_ID,KEY_ID,KEYSTORE_TYPE,CREATOR_DBNAME,CREATOR_PDBNAME from v$encryption_keys;



    CON_ID KEY_ID                                                KEYSTORE_TYPE     CREATOR_DBNAME  CREATOR_PDBNAME

---------- ----------------------------------------------------- ----------------- --------------- ---------------      

         0 AcxA2N2N5k/Wv80Sy7NkDHkAAAAAAAAAAAAAAAAAAAAAAAAAAAAA  SOFTWARE KEYSTORE prodcdb         CDB$ROOT



Once the Master Encryption Key is created, the STATUS of the Keystore also gets changed from OPEN_NO_MASTER_KEY to OPEN as shown below.

sys@PRODCDB> select * from V_$ENCRYPTION_WALLET;



WRL_TYPE   WRL_PARAMETER             STATUS                    WALLET_TYPE     WALLET_OR FULLY_BAC     CON_ID

---------- ------------------------- ------------------------- --------------- --------- --------- ----------

ASM        +DATA/PRODCDB/WALLET      OPEN                      PASSWORD        SINGLE    NO                 0

Step 5: Encrypt the Tablespace:

Once the Keystore is created and opened with an active Master Encryption Key, we are all set to start encrypting the data. We can either ENCRYPT individual table columns in the database or ENCRYPT a entire tablespace.

Encrypt Tablespace:

We can encrypt a tablespace using TDE while creating it using CREATE TABLESPACE statement by means of ENCRYPTION clause.

Demonstration (Encrypt Tablespace):



sys@PRODCDB> create tablespace enc_data

  2  datafile '+DATA'

  3  encryption

  4  default storage (ENCRYPT)

  5  ;



Tablespace created.

TDE Encryption Algorithms:

By default, TDE uses the AES encryption algorithm with a 192-bit key length (AES192). If we encrypt a table column without specifying a encryption algorithm, then the column is encrypted using the AES192 algorithm. TDE also enables us to specify a non-default encryption algorithm. We can choose from one of the following encryption algorithms for TDE:

3DES168

AES128

AES192 (default)

AES256

Restrictions using TDE:

Restrictions on Data Types:

Transparent Data Encryption (TDE) supports the following list of data types.

BINARY_DOUBLE

BINARY_FLOAT

CHAR

DATE

INTERVAL DAY TO SECOND

INTERVAL YEAR TO MONTH

NCHAR

NUMBER

NVARCHAR2

RAW (legacy or extended)

TIMESTAMP (includes TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE)

VARCHAR2 (legacy or extended)