Thursday, July 26, 2018

Script to monitor Oracle ASM diskgroup

Script to monitor Oracle ASM diskgroup and drop mail if threshold crossed

--------------------------------------------
/u00/oracle/SCRIPTS/asm/asm_diskgroup.sh
--------------------------------------------
set -x
export ORACLE_SID=<<DB_SID>>
export ORACLE_BASE=/u00/oracle
export ORACLE_HOME=/u00/oracle/product/10205
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

${ORACLE_HOME}/bin/sqlplus  "sys/India123@ASM_Testing.india as sysdba" << EOF

@/u00/oracle/SCRIPTS/asm/asm_diskgroup_status_Testing.sql
EOF

cat /u00/oracle/SCRIPTS/asm/asm_diskgroup_status_Testing.html > /u00/oracle/SCRIPTS/asm/asm_status_final.html


t1=7

t2=`grep "no rows selected" /u00/oracle/SCRIPTS/asm/asm_status_final.html|wc -l`
echo $t1
echo $t2
if [ "$t1" == "$t2" ]
then
echo "no mail"
else
export MAILTO="er.vaibhav1425@gmail.com"
export SUBJECT="ASM DISKGROUP STATUS REPORT(>85%)- "
TIME=$(date +"%d-%m-%Y")
export CONTENT="/u00/oracle/SCRIPTS/asm/asm_status_final.html"
(
echo "To: $MAILTO"
echo "Subject: $SUBJECT $TIME"
echo "MIME-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"'
echo
echo '---q1w2e3r4t5'
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $CONTENT
echo '---q1w2e3r4t5'
) | /usr/sbin/sendmail -r Oracle_asm@testing.com $MAILTO
fi
set +x
--------------------------------------------
<<END>>
--------------------------------------------
/u00/oracle/SCRIPTS/asm/asm_diskgroup_status_Testing.sql
--------------------------------------------

SPOOL /u00/oracle/.JLR_SCRIPTS/asm/asm_diskgroup_status_Testing.html

COLUMN spool_time NEW_VALUE _spool_time NOPRINT
 SELECT TO_CHAR (SYSDATE, 'DD Mon YYYY') spool_time
  FROM DUAL;


CLEAR COLUMNS BREAKS COMPUTES

SET markup html on -
table  'WIDTH="95%" align="center" BORDER="1"'

SET feedback off
COLUMN dbname                 FORMAT a25           HEADING 'DATABASE NAME' ENTMAP off
COLUMN group_name             FORMAT a25           HEADING 'DISK GROUP NAME' ENTMAP off
COLUMN state                  FORMAT a11           HEADING 'STATUS'  ENTMAP off
COLUMN total_mb               FORMAT 999,999,999   HEADING 'TOTAL SIZE (GB)' ENTMAP off
COLUMN used_mb                FORMAT 999,999,999   HEADING 'USED SIZE (GB)' ENTMAP off
COLUMN pct_used               FORMAT 999.99        HEADING 'PERCENTAGE USED' ENTMAP off
set lines 300
set pages 300
SET feedback      ON

prompt DB_NAME - QA(<<Server_details>>) ASM DISKGROUP Status 
--<--- Your wish in prompt

SELECT
    c.db_name                                   dbname
  ,  dg.name                                     group_name
  , dg.state                                    state
  , dg.total_mb/1024                                 total_gb
  , (dg.total_mb - dg.free_mb)/1024                     used_gb
  , ROUND((1- (dg.free_mb / dg.total_mb))*100, 2)  pct_used
FROM
    v$asm_diskgroup dg,v$asm_client c
WHERE
     dg.group_number =
 c.group_number and dg.total_mb != 0 and ROUND((1- (free_mb / total_mb))*100, 2) >=85 and dg.name not like '%REDO%' and c.db_name not like '%ASM%' and c.db_name not like '%mgmtdb%' ORDER BY  pct_used desc;

SET feedback      ON
SET heading       ON
SET verify        ON
SET wrap          OFF
SET trimspool     OFF
SET serveroutput  OFF
SET escape        OFF
SET MARKUP HTML OFF
SET TERMOUT ON

Spool off;

Tuesday, July 17, 2018

Oracle XAG Installation

XAG Installation
=================
This must be run on both nodes.
Create /u00/oracle/grid/product/xag directory on all servers in the cluster with owner oragrid:oinstall and permissions 750.
Copy the zip file to /u00/oracle/grid/xag/product/xag and unzip it. <-- can be downloaded from link in Notes
Create directory /u00/oracle/grid/product/xag/XAG_7
Run the install script:
cd /u00/oracle/grid/product/xag/xag
./xagsetup.sh --install --directory /u00/oracle/grid/product/xag/XAG_7
Modify permissions of ACFS resource to allow the GG Account to mount and unmount it.
<GRID_HOME>/bin/srvctl modify filesystem -d /dev/asm/<file system name> -u <os_user_name>

be in oragrid or ASM owner user


cd /u00/oracle/grid/product/xag/xag

./xagsetup.sh --install --directory /u00/oracle/grid/product/xag/XAG_7

<GRID_HOME>/bin/srvctl modify filesystem -d /dev/asm/testing5d1ggs-119 -u testing5d1g



Notes : 

Link from where you can download xag gzip file
http://www.oracle.com/technetwork/database/database-technologies/clusterware/downloads/xag-agents-downloads-3636484.html
You can use directory structure as per your requirement
os_user_name must be the user which you want to be owner of GG filesystem

Install OEM 13c or any OEM agent version using AgentPull Method

AgentPull Method to install any version oem agent on db server

curl "https://oem13c.local.net:7802/em/install/getAgentImage" --insecure -o AgentPull.sh


chmod +x AgentPull.sh


/home/oracle/AgentPull.sh.template

Note : Update the sh file before running it as suggested

./AgentPull.sh LOGIN_USER=sysman LOGIN_PASSWORD=welcome123 PLATFORM="Linux x86-64" AGENT_REGISTRATION_PASSWORD=welcome123 AGENT_BASE_DIR=/u00/app/oracle/agent13c

Notes :

======
https link <-- this will be your oem url
AgentPull.sh.template <-- make sure to update the oms server and port
AGENT_BASE_DIR <-- Make sure to change this to ur server directory location where u want to install agent
Run root.sh once agent is installed successfully, just after agent installation

Sunday, July 15, 2018

Create Oracle ASM disk and alter / create ASM DiskGroup

First Storage team adds LUN to server on which ASM disk addition is going to be perofmed

Once LUN is attached to Server, System Admin scans the LUN and defines some name to it


ls -ltr /dev/mapper/* --

Considering /dev/mapper/DATA01 is the raw disk provided by System Admin

First check the list of ASM disks already available on server

/etc/init.d/oracleasm listdisks >> Lists the ASM disks

/etc/init.d/oracleasm createdisk DATA /dev/mapper/DATA01 - Creates ASM disk


Once ASM disk DATA is created, scan the disk to all the nodes in the cluster

/etc/init.d/oracleasm scandisks >> This needs to be done to all nodes

/etc/init.d/oracleasm listdisks >> List again the ASM disks


You will be able to locate DATA in your ASM disks


Now for adding this DATA into ASM DiskGroup


Login to ASM through grid "/ as sysasm"


Check the asm_diskstring parameter while adding the disk to DG

show parameter asm_diskstring >> This parameter defines the PATH of ASM disk
considering this set as ORCL:

Command to add ASM disk to ASM DiskGroup

sqlplus "/ as sysasm" >> from grid
alter diskgroup DATA_1 add disk "ORCL:DATA";

If you want to create separate diskgroup then below command


create diskgroup DATA_1 EXTERNAL REDUNDANCY disk "ORCL:DATA";

Friday, July 13, 2018

RAC Cloning using RMAN DUPLICATE command


Create pfile on target host 

Mark below in pfile and rest as pfile of source database just change the target DB name in place of source DB name

*.db_unique_name='<DB_NAME>'
*.cluster_database=FLASE
#TARGET2.instance_number=2
#TARGET2.thread=2
#TARGET2.undo_tablespace='UNDOTBS2'

On target database >> create listener on db level, not on grid level

LISTENER_CLONEDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER_CLONEDB))
    (ADDRESS = (PROTOCOL = TCP) (HOST = target2300.india.testing.com) (PORT = 1527))
      )
    )
  )

SID_LIST_LISTENER_CLONEDB =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = TARGET)
      (SID_NAME = TARGET1)
      (ORACLE_HOME = /u00/app/oracle_base/product/12.1.0.2/db_home)
    )

  )

lsnrctl start LISTENER_CLONEDB

On source and target database

SOURCE1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = source2350.india.testing.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (ORACLE_SID = SORUCE1)
    )
  )

TARGET1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = target2300.india.testing.com)(PORT = 1527))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (ORACLE_SID = TARGET1)
    )
  )
  
Create password file for target -
orapwd file=orapwSOURCE1 password=passwordSOURCE entries=5 force=y

Check connectivity for source and target auxiliary, considering source database sys password is same as "passwordSOURCE"
  
sqlplus sys/passwordSOURCE@SOURCE1 as sysdba
sqlplus sys/passwordSOURCE@TARGET1 as sysdba

Once connectivity verified, run below DUPLICATE command to clone source database

rman target sys/passwordSOURCE@SOURCE1 auxiliary sys/passwordSOURCE@TARGET1
DUPLICATE TARGET DATABASE TO TARGET FROM ACTIVE DATABASE;

Create pfile from spfile and remove "_" underscore parameters from it which gets automatically created by rman duplicate
Mark back below parameters in spfile
From 
FLASE to *.cluster_database=TRUE
uncomment this --> #TARGET2.instance_number=2
uncomment this --> #TARGET2.thread=2
uncomment this --> #TARGET2.undo_tablespace='UNDOTBS2'

Create spfile on ASM and mention the location in init<DB_SID>.ora on both the nodes
cat init<DB_SID>.ora
spfile='+<DISK_GROUP>/<DB_SID>/spfile<DB_SID>.ora

Bounce the database to start it with spfile

Add the database in cluster

srvctl add database -d TARGET -o /u00/app/oracle_base/product/12.1.0.2/db_home -c RAC -p '+TARGET_DATADG/TARGET/spfileTARGET.ora' -r PRIMARY -n TARGET

srvctl add instance -d TARGET -i TARGET1 -n target2300
srvctl add instance -d TARGET -i TARGET2 -n target2301

Saturday, July 7, 2018

Move OCR and Voting Disk from one diskgroup to another - RAC

This note explains how to replace disks from "GRID" Diskgroup.
This should be used as a Ref.

SQL> select GROUP_NUMBER,NAME,ALLOCATION_UNIT_SIZE,STATE,TOTAL_MB,FREE_MB from V$asm_diskgroup where NAME='GRID';

GROUP_NUMBER NAME                           ALLOCATION_UNIT_SIZE STATE
------------ ------------------------------ -------------------- -----------
  TOTAL_MB    FREE_MB
---------- ----------
           3 GRID                                        1048576 MOUNTED
      8192       7790

=======================================
Create New diskgroup(CRS) with suitable redundancy for OCR and Voting files =======================================

asmca -silent -createDiskGroup -diskGroupName GRID_NEW -diskList 
/dev/mapper/ASM_20160428_2G_EMC_2467_59A9,\
/dev/mapper/ASM_20160428_2G_EMC_2467_59AA,\
/dev/mapper/ASM_20160428_2G_EMC_2467_59AB,\
/dev/mapper/ASM_20160428_2G_EMC_2467_59AC  -redundancy EXTERNAL -au_size 1

=======================================
Ensure that the new diskgroup is mounted on all cluster nodes
=======================================

$ asmcmd
ASMCMD> lsdg GRID_NEW
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      3936     3835                0            3835              0             N  GRID_NEW/

ASMCMD> lsdg GRID*
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      8192     7790                0            7790              0             Y  GRID/
MOUNTED  EXTERN  N         512   4096  1048576      3936     3835                0            3835              0             N  GRID_NEW/
ASMCMD>

oragrid@blph334(338) +ASM2 /opt/app/oragrid/oracle/product/11.2.0.4/cdata/prin1c1
$ asmcmd
ASMCMD> lsdg GRID_NEW
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      3936     3835                0            3835              0             N  GRID_NEW/
ASMCMD> lsdg GRID*
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      8192     7790                0            7790              0             Y  GRID/
MOUNTED  EXTERN  N         512   4096  1048576      3936     3835                0            3835              0             N  GRID_NEW/
ASMCMD>

=======================================
Move OCR and Vote file from <Current diskgroup> to <New DG>
=======================================

$ ocrcheck
$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       5708
         Available space (kbytes) :     256412
         ID                       :  667132489
         Device/File Name         :      +GRID
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

oragrid@prin046(3600) +ASM1 /home/oragrid

oragrid@vaib333(1228) +ASM1 /home/oragrid/scratch_dir
$ ocrcheck -config
Oracle Cluster Registry configuration is :
         Device/File Name         :      +GRID
oragrid@vaib333(1229) +ASM1 /home/oragrid/scratch_dir
$
=============Existing chcek==========

$ ocrconfig -showbackup

vaib333     2015/03/23 01:57:11     /opt/app/oragrid/oracle/product/11.2.0.4/cdata/prin1c1/backup00.ocr

vaib333     2015/03/22 21:57:10     /opt/app/oragrid/oracle/product/11.2.0.4/cdata/prin1c1/backup01.ocr

vaib333     2015/03/22 17:57:08     /opt/app/oragrid/oracle/product/11.2.0.4/cdata/prin1c1/backup02.ocr

vaib333     2015/03/22 01:57:05     /opt/app/oragrid/oracle/product/11.2.0.4/cdata/prin1c1/day.ocr

vaib333     2015/03/13 07:04:07     /opt/app/oragrid/oracle/product/11.2.0.4/cdata/prin1c1/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
oragrid@vaib333(1212) +ASM1 /home/oragrid/scratch_dir/3_grid_config
$

=============Existing chcek==========
oragrid@vaib333(1215) +ASM1 /home/oragrid/scratch_dir/3_grid_config
$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   036b9c2d731f4ff0bfa9992c59a11974 (/dev/mapper/ASM_2.0G_EMC_360000970000195701845533033414242) [GRID]
Located 1 voting disk(s).
oragrid@vaib333(1216) +ASM1 /home/oragrid/scratch_dir/3_grid_config

=============================================
Move OCR and Vote file from <Current diskgroup> to <>
=============================================

*****$ORACLE_HOME/bin/bin/ocrconfig -add +GRID_NEW

oragrid@vaib333(1233) +ASM1 /home/oragrid/scratch_dir
$ sudo /opt/app/oragrid/oracle/product/grid/bin/ocrconfig -add +GRID_NEW
oragrid@vaib333(1234) +ASM1 /home/oragrid/scratch_dir
$

$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       4408
         Available space (kbytes) :     257712
         ID                       :  506290951
         Device/File Name         :      +GRID
                                    Device/File integrity check succeeded
         Device/File Name         :  +GRID_NEW
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

oragrid@vaib333(1235) +ASM1 /home/oragrid/scratch_dir
$ ocrcheck -config
Oracle Cluster Registry configuration is :
         Device/File Name         :      +GRID
         Device/File Name         :  +GRID_NEW
oragrid@vaib333(1236) +ASM1 /home/oragrid/scratch_dir
$

*****sudo /opt/app/oragrid/oracle/product/grid/bin/ocrconfig -delete +GRID

oragrid@vaib333(1237) +ASM1 /home/oragrid/scratch_dir
$ sudo /opt/app/oragrid/oracle/product/grid/bin/ocrconfig -delete +GRID
oragrid@vaib333(1238) +ASM1 /home/oragrid/scratch_dir
$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       4408
         Available space (kbytes) :     257712
         ID                       :  506290951
         Device/File Name         :  +GRID_NEW
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

oragrid@vaib333(1239) +ASM1 /home/oragrid/scratch_dir
$
*****sudo /opt/app/oragrid/oracle/product/grid/bin/crsctl replace votedisk +GRID_NEW

$ sudo /opt/app/oragrid/oracle/product/grid/bin/crsctl replace votedisk +GRID_NEW
Successful addition of voting disk 4c8c3d6276164fa1bf936dfcda593648.
Successful deletion of voting disk 036b9c2d731f4ff0bfa9992c59a11974.
Successfully replaced voting disk group with +GRID_NEW.
CRS-4266: Voting file(s) successfully replaced
oragrid@vaib333(1240) +ASM1 /home/oragrid/scratch_dir
$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   4c8c3d6276164fa1bf936dfcda593648 (/dev/mapper/ASM_20150114_984M_EMC_1845_51CF) [GRID_NEW]
Located 1 voting disk(s).
oragrid@vaib333(1241) +ASM1 /home/oragrid/scratch_dir
$

=======================================
Startup CRS using New SPFILE from <CRS> Diskgroup
=======================================

oragrid@vaib333(1245) +ASM1 /home/oragrid/odba
$ sql

SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 23 04:28:57 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +GRID/prin1c1/asmparameterfil
                                                 e/registry.253.855072119


+GRID/prin1c1/asmparameterfile/REGISTRY.253.875077465
SQL> create pfile='/home/oragrid/odba/init_grid_change.ora' from spfile;

File created.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
oragrid@vaib333(1246) +ASM1 /home/oragrid/odba
$ ls -ltr

=====================Existing check=================
oragrid@vaib333(1216) +ASM1 /home/oragrid/scratch_dir/3_grid_config
$ gpnptool get
Warning: some command line parameters were defaulted. Resulting command line:
         /opt/app/oragrid/oracle/product/11.2.0.4/bin/gpnptool.bin get -o-

<?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="4" ClusterUId="3e2619da2b1d4f77ff446142990b2b07" ClusterName="prin1c1" PALocation=""><gpnp:Network-Profile><gpnp:HostNetwork id="gen" HostName="*"><gpnp:Network id="net1" IP="130.5.112.0" Adapter="bond0.575" Use="public"/><gpnp:Network id="net2" IP="172.29.70.0" Adapter="bond0.3099" Use="cluster_interconnect"/><gpnp:Network id="net3" IP="172.29.71.0" Adapter="bond0.3098" Use="cluster_interconnect"/></gpnp:HostNetwork></gpnp:Network-Profile><orcl:CSS-Profile id="css" DiscoveryString="+asm" LeaseDuration="400"/><orcl:ASM-Profile id="asm" DiscoveryString="/dev/mapper/ASM_*" SPFile="+GRID/prin1c1/asmparameterfile/registry.253.855072119"/><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>2VcFJkjR5eq0+WBXwkCY1pr1un4=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>QOimZxCf12N8xLK3RxRY469BNr106lyI4xGqoz3RoE9eu5VKlQZiYtgfviYu7nvczJvbbg8JwXhHtZu0uBlZzHoAv3g8xGB69u/TmPP/GPPuaMCamofPCBCQGyds5jy8zzrqRGaI0Yt9w9g9qg7qjoHvxywBKaudNXy58TCjjf4=</ds:SignatureValue></ds:Signature></gpnp:GPnP-Profile>
Success.
oragrid@vaib333(1217) +ASM1 /home/oragrid/scratch_dir/3_grid_config
$
=======================================
oragrid@vaib333(1250) +ASM1 /home/oragrid/odba
$ sqlplus "/as sysasm"

SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 23 04:31:56 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> create spfile='+GRID_NEW' from pfile='/home/oragrid/odba/init_grid_change.ora';

File created.

SQL> exit

=====================After check=================
oragrid@vaib333(1253) +ASM1 /home/oragrid/odba
$ gpnptool get
Warning: some command line parameters were defaulted. Resulting command line:
         /opt/app/oragrid/oracle/product/11.2.0.4/bin/gpnptool.bin get -o-

<?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="3e2619da2b1d4f77ff446142990b2b07" ClusterName="prin1c1" PALocation=""><gpnp:Network-Profile><gpnp:HostNetwork id="gen" HostName="*"><gpnp:Network id="net1" IP="130.5.112.0" Adapter="bond0.575" Use="public"/><gpnp:Network id="net2" IP="172.29.70.0" Adapter="bond0.3099" Use="cluster_interconnect"/><gpnp:Network id="net3" IP="172.29.71.0" Adapter="bond0.3098" Use="cluster_interconnect"/></gpnp:HostNetwork></gpnp:Network-Profile><orcl:CSS-Profile id="css" DiscoveryString="+asm" LeaseDuration="400"/><orcl:ASM-Profile id="asm" DiscoveryString="/dev/mapper/ASM_*" SPFile="+GRID_NEW/prin1c1/asmparameterfile/registry.253.875075585"/><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>PfeU/j5+D8xOFt/1MfmCVffxVr4=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>FeB3+H+CVLn4o9QDvyK7qVwn1sNFhGb9BChPIrgqVuwHEmVTjnrOmc5urw7TERfiaNDNqREttERWZnp548nhSkTr6trHLQYkmngCq1fgXNs67riieJxPk1+wQ0MSQ8pldm1eiGfb37Rrya6hnK8KZl/s+kJvFgF3ueu/7N+xLhY=</ds:SignatureValue></ds:Signature></gpnp:GPnP-Profile>
Success.
oragrid@vaib333(1254) +ASM1 /home/oragrid/odba

=========================
Ensure ALL Cluster Resources are started successfully 
=========================

sudo /opt/app/oragrid/oracle/product/grid/bin/crsctl stop cluster -all

sudo /opt/app/oragrid/oracle/product/grid/bin/crsctl start cluster -all

oragrid@vaib333(1277) +ASM1 /home/oragrid
$  ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       4408
         Available space (kbytes) :     257712
         ID                       :  506290951
         Device/File Name         :  +GRID_NEW
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

oragrid@vaib333(1278) +ASM1 /home/oragrid
$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   4c8c3d6276164fa1bf936dfcda593648 (/dev/mapper/ASM_20150114_984M_EMC_1845_51CF) [GRID_NEW]
Located 1 voting disk(s).
oragrid@vaib333(1279) +ASM1 /home/oragrid

===============================
unmount the old dg on both node and do the stop /restart cluster 
===============================
Drop the old dg

asmcmd
dropdg -r < old dg group


**check in crsctl resources deleted or not
***check asm_diskgroups parameter

we can rename this GRID_NEW to original as GRID if we want.

Oracle FSFO Configuration with Observer setup - Fast-Start Fail Over

FSFO configuration


1. set the fast start failover target as below for both primary and standby

DGMGRL> EDIT DATABASE t1enb3d5 SET PROPERTY FastStartFailoverTarget='t2enb4d4';

Property "faststartfailovertarget" updated

DGMGRL> EDIT DATABASE t2enb4d4 SET PROPERTY FastStartFailoverTarget='t1enb3d5';

Property "faststartfailovertarget" updated



2. Please set protection mode to maximum availability or maximum protection


DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;

OR

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPERFORMANCE;


3. set below parameters on primary

ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=1440 SCOPE=BOTH SID='*';

ALTER SYSTEM SET db_recovery_file_dest_size=720G;

ALTER SYSTEM SET db_recovery_file_dest='+T1ENB3D5_ORAFLSH';

ALTER DATABASE FLASHBACK ON;



4. set below parameter on standby

ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=1440 SCOPE=BOTH SID='*';

ALTER SYSTEM SET db_recovery_file_dest_size=720G SCOPE=BOTH SID='*';

ALTER SYSTEM SET db_recovery_file_dest='+T2ENB4D4_ORAFLSH' SCOPE=BOTH SID='*';

ALTER DATABASE FLASHBACK ON;


Observer Configuration


5. Observer should run on different server from primary and standby

dgmgrl

DGMGRL> connect sys/Testing123@t1enb3d5.db.att.com

connected

DGMGRL> start observer file='/opt/app/t1enb3d2/oracle/local/observer/fsfo.dat'

Observer started


6. enable fast start failover from primary

DGMGRL> ENABLE FAST_START FAILOVER;

Enabled.

DGMGRL> show fast_start failover


7. show database status report (for error)

DGMGRL> show database t1enb3d5 statusreport;


8. create a script as below to start observer on reboot /opt/app/t1enb3d2/oracle/local/observer/start_observer.ksh


you may need to modify script as this is not tested.

#!/bin/ksh

export true=`dgmgrl sys/Testing123@t1enb3d5 "show configuration" |grep t1enb3d5| wc -l `

if [ $true -eq 0 ] then

dgmgrl sys/Testing123@t1enb3d5 "start observer file='/opt/app/t1enb3d2/oracle/local/observer/fsfo.dat'"

EOF


schedule in crontab as below 


00 01 * * *  /bin/ksh /opt/app/t1enb3d2/oracle/local/observer/start_observer.ksh >>/opt/app/t1enb3d2/oracle/local/observer/start_observer.log