Blog

How to Add a Disk into ASM DiskGroup Safely

For a client, there are situations when adding a disk into ASM disk group failed, finally rebooting the server is required to resolve this issue.

According to Oracle support suggestion, we can create a test diskgroup by using this new disk, if everything is successful, then we can drop this test diskgroup, and add the new disk into target diskgroup.

It is a good practice specially for critical production environment.

Check the new disk is a “CANDIDATE”

$sqlplus / as sysasm 


SQL>select INST_ID,GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,
MODE_STATUS,STATE,REDUNDANCY,OS_MB,OS_MB,TOTAL_MB,NAME,
FAILGROUP,PATH
from gv$asm_disk
where PATH like '/dev/mapper/prod_data_303p1'
order by 1,2,3;

Create a Test Diskgroup

Create a test diskgroup “TEMP_TEST”, and check disk status is “MEMBER”

SQL> CREATE DISKGROUP TEMP_TEST EXTERNAL REDUNDANCY disk '/dev/mapper/prod_data_303p1' NAME TEMP_TEST_0001;


Diskgroup created.
SQL>select INST_ID,GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,
MODE_STATUS,STATE,REDUNDANCY,OS_MB,OS_MB,TOTAL_MB,NAME,
FAILGROUP,PATH
from gv$asm_disk
where PATH like '/dev/mapper/prod_data_303p1'
order by 1,2,3;

Mount the Test Diskgroup on Other Nodes

Mount the test diskgrop on all the rest ASM nodes to make sure all working fine.

$sqlplus / as sysasm

SQL>set pagesize 100
SQL>set linesize 300
SQL>select INST_ID,GROUP_NUMBER,NAME,STATE,TOTAL_MB,FREE_MB,
COMPATIBILITY,DATABASE_COMPATIBILITY
from gv$asm_diskgroup
where name='TEMP_TEST'
order by 1,2;
SQL> alter diskgroup TEMP_TEST mount;


Diskgroup altered.
SQL>select INST_ID,GROUP_NUMBER,NAME,STATE,TOTAL_MB,FREE_MB,
COMPATIBILITY,DATABASE_COMPATIBILITY
from gv$asm_diskgroup
where name='TEMP_TEST'
order by 1,2;

Dismount the Test Diskgroup on Other Nodes

Dismount the test diskgroup on all the other nodes except the first node for dropping in the next step.

SQL> alter diskgroup TEMP_TEST dismount;


Diskgroup altered.

SQL>select INST_ID,GROUP_NUMBER,NAME,STATE,TOTAL_MB,FREE_MB,
COMPATIBILITY,DATABASE_COMPATIBILITY
from gv$asm_diskgroup
where name='TEMP_TEST'
order by 1,2;

Drop the Test Diskgroup

Drop the test diskgroup on first node where the test diskgroup is still mounted.

SQL> DROP DISKGROUP  TEMP_TEST ;


Diskgroup dropped.

And check the new disk header status is “FORMER”, which is available for adding into target diskgroup now.

SQL>select INST_ID,GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,
MODE_STATUS,STATE,REDUNDANCY,OS_MB,OS_MB,TOTAL_MB,NAME,
FAILGROUP,PATH
from gv$asm_disk
where PATH like '/dev/mapper/prod_data_303p1'
order by 1,2,3;

Add Disk into Target Diskgroup

Now it is time to add the new disk into target diskgroup.

SQL> set time on

08:08:17 SQL> ALTER DISKGROUP PROD_DATA ADD DISK '/dev/mapper/prod_data_303p1' NAME PROD_DATA_0012;

Diskgroup altered.

Then check disk and diskgroup status

09:09:01 SQL>select INST_ID,GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,
HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
OS_MB,OS_MB,TOTAL_MB,NAME,FAILGROUP,PATH
from gv$asm_disk
where PATH like '%prod_data%'
order by 1,2,3;
09:09:14 SQL>  select INST_ID,GROUP_NUMBER,NAME,STATE,TOTAL_MB,FREE_MB,
COMPATIBILITY,DATABASE_COMPATIBILITY
from gv$asm_diskgroup
where name='PROD_DATA' ;

Monitor and Check Rebalance

00:10:35 SQL> select GROUP_NUMBER,OPERATION,STATE,POWER,ACTUAL,
SOFAR,EST_WORK,EST_RATE,EST_MINUTES
from v$asm_operation;

How to Find DBID from OEM Repository

A client has drooped an Oracle database, and client wants to know DBID of the dropped database.

From OEM repository, we can query some tables or views to get DBID for a specific database. for example :

 SQL> select HOST_NAME,TARGET_NAME,TARGET_TYPE,TARGET_GUID,DBID,VERSION        from  MGMT$DB_CPU_USAGE where upper(TARGET_NAME)='DB_NAME';

RMAN command to list dbid of the database:

$ rman catalog rman@rmancatalog
RMAN> list incarnation of database TESTDB;

[FATAL] [INS-32042] The Installer has detected that the user (oracle) is not member of the central inventory group

Silent installation of Oracle client 19c gets the following fatal error:

[FATAL] [INS-32042] The Installer has detected that the user (oracle) is not member of the central inventory group:
   ACTION: Make sure that the user (oracle) is member of the central inventory group ().
INFO:  [Nov 26, 2023 12:08:20 PM] Advice is ABORT

CAUSE

Check oraInst.loc file, and found inst_group is empty for some reason.

$ cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=

SOLUTION

Gives inst_group variable in /etc/oraInventory the right value.

$ cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

Increase Voting Diskgroup Size

Here is an example of how to increase GI voting disk group size.

  1. Add a new disk with bigger size into current voting disk group.
  2. Drop the old small size disk.
SQL> select NAME, STATE,VOTING_FILES,total_mb, free_mb 
     from v$asm_diskgroup
     where NAME='VOTE_OCR";

NAME     STATE  VOTING_FILES TOTAL_MB FREE_MB
VOTE_OCR MOUNTED Y              51196    6352
SQL> alter diskgroup VOTE_OCR add disk '/dev/ASM/VOTE_OCR_002' NAME VOTE_OCR_002;

Diskgroup altered.
SQL> select NAME, STATE,VOTING_FILES,total_mb, free_mb 
     from v$asm_diskgroup
     where NAME='VOTE_OCR";

NAME     STATE  VOTING_FILES TOTAL_MB FREE_MB
VOTE_OCR MOUNTED Y           153592   108736 

SQL> alter diskgroup VOTE_OCR drop disk 'VOTE_OCR_001';

Diskgroup altered.

ORA-20247: EMD_URL is Invalid: Cannot provide null emd url

When adding a cluster database into OEM, and click “Submit” , the following error occurs:

ORA-20247: EMD_URL is Invalid: Cannot provide null emd url

SOLUTION

First of the first is to make sure the host name with domain name, we have a couple of situations when domain name is added into host name, then everything is working fine.

Otherwise go to next step for workaround.

Manually add the cluster database into OEM by using emcli on OMS server:

$ emcli login -username=sysman
Enter password :

Login successful

Add first instance target of the cluster database first

$ emcli add_target -name="TESTDB_TESTDB1" -type="oracle_database" -host="racnode1" -credentials="UserName:dbsnmp;password:XXXXXXXXXX;Role:Normal" -properties="SID:TESTDB1;Port:1521;OracleHome:/u01/app/oracle/product/19.0.0/dbhome_1;MachineName:racnode1-vip" 

Target "TESTDB_TESTDB1:oracle_database" added successfully

Add the rest instance(s)

$ emcli add_target -name="TESTDB_TESTDB2" -type="oracle_database" -host="racnode2" -credentials="UserName:dbsnmp;password:XXXXXXXXXX;Role:Normal"  -properties="SID:TETSTDB2;Port:1521;OracleHome:/u01/app/oracle/product/19.0.0/dbhome_1;MachineName:racnode2-vip" 

Target "TESTDB_TESTDB2:oracle_database" added successfully

Add the cluster database

$ emcli add_target -name="TESTDB" -type="rac_database" -host="racnode1" -monitor_mode="1" -properties="ServiceName:TESTDB;ClusterName:CLSTEST" -instances="TESTDB_TESTDB1:oracle_database;TESTDB_TESTDB2:oracle_database"

Target "TESTDB:rac_database" added successfully

Go to OEM console to check the cluster database .