Advertisement

Showing posts with label ASM. Show all posts
Showing posts with label ASM. Show all posts

Friday, June 14, 2019

Oracle Database - 19c - RAC Silent Disk Group Creation

In this blog, I am going to talk about Disk Group Creation in RAC 18c in silent mode. (no UI)

First I am going to create the disks at the OS level and discover it in oracleasm. 


1. Create Partition for New Disks. Do this for all the disks you have attached to your system. Make sure disks are attached to both nodes and partition is created on only one Node. 
Details on Creating the partition are present in end of the blog.

2.  Create Disks using oracleasm on Node 1

$ oracleasm createdisk FRA001 /dev/xvdf1
Writing disk header: done
Instantiating disk: done

$ oracleasm createdisk FRA002 /dev/xvdg1
Writing disk header: done
Instantiating disk: done

$ oracleasm createdisk FRA003 /dev/xvdh1
Writing disk header: done

Instantiating disk: done

3.  Scan for disks using oracleasm on Node 2

$ oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "FRA001"
Instantiating disk "FRA002"

Instantiating disk "FRA003"

4. Login as Grid and set the environment run asmca  and create Disk Group 

 asmca -silent -sysAsmPassword Oracle123 -asmsnmpPassword Oracle123 -createDiskGroup -diskGroupName FRA -diskList  /dev/oracleasm/disks/FRA001,/dev/oracleasm/disks/FRA002,/dev/oracleasm/disks/FRA003 -redundancy EXTERNAL -au_size 4 -compatible.asm 19.0.0.0.0 -compatible.rdbms 19.0.0.0.0


[INFO] [DBT-30001] Disk groups created successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-190614AM043742.log for details.


Disk group creation complete. Verify using asmcmd (lsdg command)

New Disk Partition Creation 
$ fdisk /dev/xvdf
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xc0515184.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-251658239, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-251658239, default 251658239):
Using default value 251658239
Partition 1 of type Linux and of size 120 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.

Friday, May 31, 2019

Oracle Database: How to relocate tablespaces to different Diskgroup (except SYS)

in this blog, I list out steps for Oracle RAC relocating tablespaces to different diskgroups with partial downtime only 

Step1 - 
backup tablespaces to new diskgroup - 

run 
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
allocate channel c8 type disk;
backup as copy tablespace TB1,TB2,TB3 format '+DATA2';
}

test

Repeat for each tablespaces
1. SQL> 
     alter tablespace TB1 offline;
2. rman  
     switch tablespace TB1 to copy;
     run {
    allocate channel c1 type disk;
    recover tablespace TB1;
    }
3. SQL> 
    alter tablespace TB1 online;

This completes the relocation.
If you want to do it for datafile level (in case your tabelspace is large)
You can follow same steps (with minor modifications from tablespace to datafile )

Oracle Database: RAC - Relocate UNDO to different Diskgroup (and Standby)

In this blog I discuss steps to relocate Undotablespaces on a 2 node rac cluster.

Currently tablespaces are
Node 1 - undotbs1
Node 2 - undotbs2


Step 1 - Create Undotablespaces (as per the size required) 
(Note the name difference) 

 CREATE UNDO TABLESPACE "UNDOTBS11" DATAFILE '+DATA2' SIZE 209715200 AUTOEXTEND ON NEXT 52428800 MAXSIZE 32767M,
  BLOCKSIZE 8192
  EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

 CREATE UNDO TABLESPACE "UNDOTBS22" DATAFILE '+DATA2' SIZE 209715200 AUTOEXTEND ON NEXT 52428800 MAXSIZE 32767M,

  BLOCKSIZE 8192

  EXTENT MANAGEMENT LOCAL AUTOALLOCATE;


Next set the undo tablespace parameter 

  alter system set undo_tablespace=UNDOTBS11 scope=spfile sid='NODE1';  
  alter system set undo_tablespace=UNDOTBS22 scope=spfile sid='NODE2';


Next drop the the undo tablespace after undo retention has expired
Drop tablespace UNDOTBS1 including contents and datafiles;
Drop tablespace UNDOTBS2 including contents and datafiles;

This completes the relocation.

In case you are running a standby RAC, then you will need to set these a well, however these parameters are not dynamic, so you will have to set it to spfile and restart the standby DB (not just instance)

Saturday, April 6, 2019

Oracle Database: Lower Compatibility / Recreate Disk Groups RAC

In this blog, I talk about recreation of Diskgroups, the reason can be any  like you want to change the name, or any other.
(remember data will be lost, so if you are doing this just for fun, don't on a production cluster)

Below are the Steps 

Step 1 - Free the Diskgroup
Shutdown all the Databases and remove any open files from the diskgroup (oracle user)
You can lsof command to check open files in asmcmd prompt. (grid user)

Relocate any OCR copy if there (root user)

Step 2 - Dismount the Diskgroup from Node 1 (grid user)
alter diskgroup <name> dismount;

Step 3- Drop the Diskgroup from Node 2 (grid user)
drop diskgroup <name>;

Step 4 - Free the disks to system (root user)
oracleasm delete disk <name>

Step 5 - Rescan the disk on the other node (root user)
oracleasm scandisks

Step 6  - Recreate the disk (root user)
oracleasm create disk <path> <name>

Step 7 - Rescan the disk on the other node (root user)
oracleasm scandisks

Step 8 - Recreate the diskgroup (grid user)
asmca -silent -sysAsmPassword mypassword -asmsnmpPassword mypassword -createDiskGroup -diskGroupName DATA -diskList  /dev/oracleasm/disks/DISK_DATA -redundancy EXTERNAL -au_size 4 -compatible.asm 18.0.0.0.0 -compatible.rdbms 11.2.0.0.0


Step 9 - Add ocr if required
ocrconfig add <DG_NAME>


Tuesday, April 2, 2019

Oracle Database: ASRU Utility

In this blog I detail what is ASRU and where it can be used. 

ASRU is Oracle Automatic Storage Management and Thin Reclamation Utility. 

It is used for thin storages
Details of utility and its stages can be found here 
https://www.oracle.com/technetwork/database/oracle-automatic-storage-management-132797.pdf
https://www.oracle.com/technetwork/database/oracle-asru-3par.pdf

ASRU is a very old utility from time of 11g, however it is still valid for 12c/18c/19c version of cluster 

You can download AS
http://www.oracle.com/technetwork/database/database-technologies/cloud-storage/asru-175568.zip

ASRU can be very useful in lot of vases

Doc ID's for reference
How To Validate ASM Diskgroup Consistency/State After ASM Reclamation Utility (ASRU) Execution Aborted. (Doc ID 1668673.1)

To run ASRU
As Grid Infra Ower
ASRU <DG_NAME>

Tuesday, March 19, 2019

Oracle Database 12,18,19: Practices for using ASMLib with Multipath Devices (Linux 7)

In this document I list out the key things to keep in mind when using ASMLib with Multipathed devices

 1. Ensure to have the right Scan order (ORACLEASM_SCANORDER AND EXCLUDE)
to find out the right configuration for your type of multipathing you can refer

Remember you will need to put the right value as per the type of your multipathing - Linux Native, Multipathd, Emc etc


2. Ensure to create file /etc/udev/rules.d/99-oracle-asmdevices.rules
This file is used to set the right permissions on reboot of the node.
For this you can refer - 
https://access.redhat.com/solutions/272153
or 
Redhat Reference Document: https://access.redhat.com/sites/default/files/attachments/deploying_oracle_rac_12c_rhel7_v1.2_updated_08-01-2016.pdf 

3. Ensure to start oracleasm.service after multipathd and iscsci
$ cat /usr/lib/systemd/system/oracleasm.service
[Unit]
Description=Load oracleasm Modules
Requires=multipathd.service iscsi.service

After=multipathd.service iscsi.service

The configuration can be quite complex when using multipath devices. In case you are facing any issues you can contact me, I will be glad to help. 

Thursday, February 28, 2019

Oracle Database: 19c - Knowledge Base