Bajwa Consulting Need senior Oracle DBA help? Performance tuning, Cloud migrations, GoldenGate, backup and DR. Plus 70+ free DBA scripts.
Visit bajwaconsulting.com →

Wednesday, January 21, 2015

AWR explained

Originally posted in 2015. Updated November 2026 for Oracle Database 19c and 21c.

Automatic Workload Repository (AWR)

AWR keeps a history of database performance. Every hour (by default) Oracle takes a snapshot of statistics from memory and stores it in the SYSAUX tablespace. AWR reports, ADDM findings and many tuning tools are built on these snapshots.

Each snapshot includes:

  1. Wait events and time model statistics (where database time is spent)
  2. System and session statistics
  3. Top SQL by elapsed time, CPU, I/O and executions
  4. Object statistics, such as segments with the most reads or changes
  5. Active Session History (ASH) samples

First: check your license

AWR, ADDM and ASH are part of the Oracle Diagnostics Pack, a paid option of Enterprise Edition. Running AWR or ADDM reports, or querying the DBA_HIST_* views, counts as using the pack. If the pack is not licensed, that usage can show up in an Oracle license audit.

The CONTROL_MANAGEMENT_PACK_ACCESS parameter records which packs you intend to use:

SHOW PARAMETER control_management_pack_access

-- Licensed for the Diagnostics Pack (and the Tuning Pack):
ALTER SYSTEM SET control_management_pack_access = 'DIAGNOSTIC+TUNING' SCOPE=BOTH;

-- Not licensed: turn the pack features off
ALTER SYSTEM SET control_management_pack_access = 'NONE' SCOPE=BOTH;

Without the Diagnostics Pack, including on Standard Edition, use Statspack (?/rdbms/admin/spcreate.sql), which is free.

Also leave STATISTICS_LEVEL at its default of TYPICAL. Setting it to BASIC stops AWR snapshots.

Snapshot interval and retention

The defaults are a snapshot every 60 minutes, kept for 8 days. Eight days is often too short to compare this week with the same day last month.

-- Current settings
SELECT snap_interval, retention FROM dba_hist_wr_control;

-- Snapshot every 30 minutes, keep 31 days (both values in minutes)
BEGIN
  DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(
    interval  => 30,
    retention => 31 * 24 * 60);
END;
/

-- Take an extra snapshot by hand, for example before and after a test
EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT;

Generating AWR reports

Run these scripts in SQL*Plus. Each one asks for the report type (HTML or text), the number of days to list and the begin and end snapshots.

@?/rdbms/admin/awrrpt.sql     -- current database and instance
@?/rdbms/admin/awrrpti.sql    -- choose a specific DBID and instance (RAC, or a loaded AWR dump)
@?/rdbms/admin/awrgrpt.sql    -- RAC: global report for all instances
@?/rdbms/admin/awrddrpt.sql   -- compare two time periods
@?/rdbms/admin/awrsqrpt.sql   -- one SQL_ID across a snapshot range
@?/rdbms/admin/addmrpt.sql    -- ADDM findings and recommendations

Pick snapshots that tightly surround the problem. A one-hour window around a slowdown tells you far more than a 24-hour average.

CDB and PDB snapshots (19c and 21c)

In a container database, the automatic snapshots are taken in CDB$ROOT and cover the whole CDB. Since 12.2 you can also take snapshots inside each PDB:

-- Connected to the PDB
ALTER SYSTEM SET awr_pdb_autoflush_enabled = TRUE;
EXEC DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(interval => 60);

When you run awrrpt.sql inside a PDB, it asks whether to use AWR_PDB (the PDB's own snapshots) or AWR_ROOT (the CDB-level data). The matching views are AWR_PDB_*, AWR_ROOT_* and AWR_CDB_*. PDB snapshots also use space, so turn them on only for the PDBs you need to tune.

AWR space in SYSAUX

SELECT occupant_name, ROUND(space_usage_kbytes/1024) AS mb
FROM   v$sysaux_occupants
WHERE  occupant_name IN ('SM/AWR','SM/ADVISOR','SM/OPTSTAT')
ORDER  BY 2 DESC;

-- Full breakdown of what AWR stores
@?/rdbms/admin/awrinfo.sql

If SYSAUX is filling up, shorten the retention first. To remove a range of old snapshots right away:

-- List snapshots, then drop the oldest range
SELECT MIN(snap_id), MAX(snap_id) FROM dba_hist_snapshot;

EXEC DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(low_snap_id => 1000, high_snap_id => 1200);

Keep any snapshots you may still need. A baseline (DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE) keeps a known-good period from being purged, so you can compare against it later.

Related post

SQL plan baselines also live in SYSAUX. See my updated post on SQL Plan Management (cleanup of SYSAUX) on this blog.

More current DBA scripts are in my GitHub repository: github.com/sbajwa55/dba-scripts. For help with Oracle performance, migrations or AWS, visit Bajwa Consulting Services.

Temporary tablespace with $DELETED

Originally posted in 2015. Updated November 2026 for Oracle Database 19c and 21c.

Sometimes a user's temporary tablespace shows a strange name such as _$deleted$12$0. You may notice it when:

  • A user's TEMPORARY_TABLESPACE in DBA_USERS shows a _$deleted$ name.
  • A Data Pump import fails because the user's tablespace does not exist (ORA-00959).
  • Scripts that recreate users or grants fail with the same name.

Why it happens

Oracle keeps every tablespace in the data dictionary table SYS.TS$, including dropped ones that something still points to. If you drop a tablespace that users still use as their temporary tablespace, and then create or rename another tablespace with the same name, Oracle renames the old dictionary entry to _$deleted$<ts#>$<n> so the two names do not clash. The users still point to the old, dropped one.

Never update or delete rows in SYS.TS$ yourself. Oracle does not support it, and it can corrupt the dictionary. The fix is always to move the users to a real tablespace.

Reproducing it

I first ran this test on 11g. Try it on a test database for your version; the cleanup steps below are the same in 19c and 21c. In a container database, run it inside a PDB.

-- 1. Check for existing deleted entries (connected as SYS)
SELECT ts#, name FROM sys.ts$ WHERE UPPER(name) LIKE '%DELETED%';

no rows selected

-- 2. Create two temporary tablespaces
CREATE TEMPORARY TABLESPACE temp2 TEMPFILE '/u01/oradata/TESTDB/temp201.dbf' SIZE 100M;
CREATE TEMPORARY TABLESPACE temp3 TEMPFILE '/u01/oradata/TESTDB/temp301.dbf' SIZE 100M;

-- 3. Create a user whose temporary tablespace is TEMP2
CREATE USER junk123 IDENTIFIED BY "Junk#2026" TEMPORARY TABLESPACE temp2;

-- 4. Drop TEMP2, then rename TEMP3 to TEMP2
DROP TABLESPACE temp2;
ALTER TABLESPACE temp3 RENAME TO temp2;

-- 5. The old TEMP2 entry has been renamed in TS$
SELECT ts#, name FROM sys.ts$ WHERE UPPER(name) LIKE '%DELETED%';

       TS# NAME
---------- ------------------------------
        12 _$deleted$12$0

-- 6. The user still points to the dropped tablespace
SELECT username, temporary_tablespace FROM dba_users WHERE username = 'JUNK123';

USERNAME   TEMPORARY_TABLESPACE
---------- ------------------------------
JUNK123    _$deleted$12$0

Finding affected users (19c and 21c)

-- In one database or PDB
SELECT username, default_tablespace, temporary_tablespace
FROM   dba_users
WHERE  temporary_tablespace LIKE '\_$DELETED$%' ESCAPE '\'
OR     default_tablespace   LIKE '\_$DELETED$%' ESCAPE '\';

-- Across all PDBs, from CDB$ROOT
SELECT con_id, username, temporary_tablespace
FROM   cdb_users
WHERE  temporary_tablespace LIKE '\_$DELETED$%' ESCAPE '\'
ORDER  BY con_id, username;

The fix

Move each user to a real temporary tablespace:

ALTER USER junk123 TEMPORARY TABLESPACE temp2;

-- Or generate the statements for every affected user
SELECT 'ALTER USER "' || username || '" TEMPORARY TABLESPACE temp;'
FROM   dba_users
WHERE  temporary_tablespace LIKE '\_$DELETED$%' ESCAPE '\';

Once no user points to it any more, the _$deleted$ entry stops causing problems. It may stay in TS$, and that is harmless.

Data Pump imports

My 2015 post suggested OBJECT_EXISTS_ACTION. That parameter does not exist; the correct ways are:

  • Fix the user in the source database before exporting, using the ALTER USER above.
  • Or remap the tablespace during import: REMAP_TABLESPACE=_$deleted$12$0:TEMP (put it in a parameter file to avoid shell quoting problems with the $ signs).
  • Or create the user in the target first, then import with EXCLUDE=USER. If the tables already exist, TABLE_EXISTS_ACTION=APPEND adds the rows.

How to avoid it

Before dropping any tablespace, move its users first:

SELECT username FROM dba_users
WHERE  temporary_tablespace = 'TEMP2' OR default_tablespace = 'TEMP2';

-- Make sure the database default temporary tablespace is a real one
SELECT property_value FROM database_properties
WHERE  property_name = 'DEFAULT_TEMP_TABLESPACE';

In 19c and 21c, Oracle will not let you drop the database default temporary tablespace (ORA-12906), but it will still let you drop one that individual users point to. Users you then forget about get the _$deleted$ name.

More current DBA scripts are in my GitHub repository: github.com/sbajwa55/dba-scripts. For help with Oracle administration or migrations to AWS, visit Bajwa Consulting Services.

Redo logs in RAC environment

Originally posted in 2015. Updated November 2026 for Oracle Database 19c and 21c.

How Oracle writes to the online redo log

Each database instance writes its redo to its own set of online redo log groups, called a redo thread. A single-instance database has one thread. In Oracle RAC every instance has its own thread, so the instances never compete for the same log files.

Each thread needs at least two redo log groups, so that one group can be written while the previous one is archived (in ARCHIVELOG mode). The log writer process (LGWR) writes to one group at a time, called the CURRENT group. When it fills up, a log switch happens and LGWR moves to the next group in the thread, going round in a circle.

Group status values in V$LOG:

  • CURRENT: LGWR is writing to this group now.
  • ACTIVE: no longer current, but still needed for instance recovery (or not yet archived).
  • INACTIVE: no longer needed for instance recovery and can be reused.
  • UNUSED: never written to, such as a newly added group.

What it looks like in a 4-node RAC

Here each of the 4 instances has 2 groups of 100 MB. Notice that every thread has its own CURRENT group and its own sequence numbers:

racdb1> SELECT group#, thread#, sequence#, bytes/1024/1024 AS mb, members, status
        FROM   v$log ORDER BY thread#, group#;

    GROUP#    THREAD#  SEQUENCE#         MB    MEMBERS STATUS
---------- ---------- ---------- ---------- ---------- --------
         1          1        115        100          1 INACTIVE
         2          1        116        100          1 CURRENT
         3          2         87        100          1 ACTIVE
         4          2         88        100          1 CURRENT
         5          3         67        100          1 INACTIVE
         6          3         68        100          1 CURRENT
         7          4         79        100          1 CURRENT
         8          4         78        100          1 INACTIVE

Now switch the log on instance 1 and check again:

racdb1> ALTER SYSTEM SWITCH LOGFILE;
racdb1> SELECT group#, thread#, sequence#, status FROM v$log ORDER BY thread#, group#;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- --------
         1          1        117 CURRENT    <-- thread 1 moved to group 1
         2          1        116 ACTIVE     <-- previous log, still needed
         3          2         87 ACTIVE
         4          2         88 CURRENT    <-- threads 2-4 unchanged
         5          3         67 INACTIVE
         6          3         68 CURRENT
         7          4         79 CURRENT
         8          4         78 INACTIVE

ALTER SYSTEM SWITCH LOGFILE switches only the thread of the instance you are connected to. Threads 2, 3 and 4 did not change; each moves on by itself when its own instance fills its current log. To switch and archive every thread at once, for example before a backup or when testing Data Guard, use:

ALTER SYSTEM ARCHIVE LOG CURRENT;

Checking redo across all instances (19c and 21c)

-- Groups and members for every thread
SELECT l.thread#, l.group#, l.sequence#, l.bytes/1024/1024 AS mb, l.status, f.member
FROM   v$log l JOIN v$logfile f ON f.group# = l.group#
ORDER  BY l.thread#, l.group#;

-- Log switches per hour, per thread, for the last 2 days
SELECT TRUNC(first_time,'HH24') AS hour, thread#, COUNT(*) AS switches
FROM   v$log_history
WHERE  first_time > SYSDATE - 2
GROUP  BY TRUNC(first_time,'HH24'), thread#
ORDER  BY 1, 2;

19c and 21c notes

  • Multitenant: redo belongs to the CDB. In a container database, all PDBs share the CDB's redo threads. A PDB has no redo logs of its own, so add, resize or drop redo log groups while connected to CDB$ROOT. From 21c onward, every database is a CDB, because non-CDB architecture is desupported.
  • Scalable LGWR. Since 12c, LGWR can hand work to helper processes (LG00, LG01 and so on) on busy systems. You will see them in ps -ef and V$PROCESS; they are normal.
  • Watch commit waits. High log file sync or log file parallel write wait times in AWR mean redo writes are slow. Check the storage first: put redo on fast disks or flash, not on the same busy disks as the data files.
  • Use GV$ views to see all instances at once. V$LOG already shows every thread, but GV$INSTANCE and GV$SYSSTAT (statistic "redo size") show which instance is generating the most redo.
-- Redo generated per instance since startup (GB)
SELECT i.instance_name, i.thread#, ROUND(s.value/1024/1024/1024, 1) AS redo_gb
FROM   gv$sysstat s JOIN gv$instance i ON i.inst_id = s.inst_id
WHERE  s.name = 'redo size'
ORDER  BY i.thread#;

Good practice today

  • Size the logs so that each thread switches roughly every 15 to 20 minutes at peak load. Many switches per minute means the logs are too small. The 100 MB groups above would be far too small for most production systems now; 1 to 4 GB is common.
  • Use at least 3 groups per thread, not 2, so LGWR never waits for a group that is still ACTIVE or being archived ("checkpoint not complete" in the alert log).
  • Multiplex each group with 2 members in different disk groups, such as +DATA and +FRA. The example above has only 1 member per group, so losing one disk could lose a current log.
  • Set ARCHIVE_LAG_TARGET (for example 900 seconds) so a quiet instance still switches regularly. This matters with Data Guard, so the standby never falls far behind.
  • With Data Guard, create standby redo logs for every thread, the same size as the online logs, with one more group per thread than the online logs.

Adding a redo thread for a new RAC instance

ALTER DATABASE ADD LOGFILE THREAD 5
  GROUP 9  ('+DATA','+FRA') SIZE 2G,
  GROUP 10 ('+DATA','+FRA') SIZE 2G,
  GROUP 11 ('+DATA','+FRA') SIZE 2G;

ALTER DATABASE ENABLE PUBLIC THREAD 5;

When you add an instance with DBCA or srvctl, the thread is usually created for you. Check it afterwards with the queries above.

More current DBA scripts are in my GitHub repository: github.com/sbajwa55/dba-scripts. For help with RAC, Data Guard or migrations to AWS, visit Bajwa Consulting Services.

How Oracle RAC starts with clusterware and voting files in ASM



When considering how Oracle Clusterware is able to store vital files (OCR and Voting Files) in an ASM Diskgroup, and while ASM is itself dependent on Oracle Clusterware, it would appear that there is a Chicken and the egg dilemma. The following is a brief overview of the logic used for starting Oracle Clusterware with ASM when clusterware files; OCR and Voting Files, are stored in an ASM Diskgroup. Note, that there are configuration dependent variations to the following logic, but what is described is the most common case.
1. When a node of an Oracle Clusterware cluster restarts, OHASD is started by platform-specific means. OHASD is the root for bringing up Oracle Clusterware. OHASD has access to the OLR (Oracle Local Registry) stored on the local file system. OLR provides needed data to complete OHASD initialization
2. OHASD brings up GPNPD and CSSD. CSSD has access to the GPNP Profile stored on the local file system. This profile contains the following vital bootstrap data;
                a. ASM Diskgroup Discovery String
                b. ASM SPFILE location (Diskgroup name)
                c. Name of the ASM Diskgroup containing the Voting Files
3. The Voting Files locations on ASM Disks are accessed by CSSD with well-known pointers in the ASM Disk headers and CSSD is able to complete initialization and start or join an existing cluster.
4. OHASD starts an ASM instance and ASM can now operate with CSSD initialized and operating. The ASM instance uses special code to locate the contents of the ASM SPFILE, assuming it is stored in a Diskgroup.
5. With an ASM instance operating and its Diskgroups mounted, access to Clusterware’s OCR is available to CRSD.
6. OHASD starts CRSD with access to the OCR in an ASM Diskgroup.
7. Clusterware completes initialization and brings up other services under its control.

RAC network bonding



1.  cat /proc/net/bonding/bond0 will show you the VIPs and physical ethernet cards
2.  cat /proc/net/bonding/bond1will show you the interconnect ethernet card.

[oracle@prdrac-a-01] cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

Bonding Mode: transmit load balancing
Primary Slave: None
Currently Active Slave: eth4
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0  <----- This is the second network card  waiting for first to fail
MII Status: up
Link Failure Count: 0
Permanent HW addr: a4:ba:db:12:06:5a

Slave Interface: eth4  <---- This is the first Network Card which is running as explained above "Currently Active Slave"
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1b:21:65:70:78

Move voting disk, OCR to new Diskgroup

Originally posted in 2015 (Grid Infrastructure 11.2). Updated November 2026 for Grid Infrastructure 19c and 21c.

This post moves the Oracle Cluster Registry (OCR), the voting files and the ASM spfile from an old disk group (+OCR_VOTE) to a new NORMAL redundancy disk group (+VOTE_OCR). I did this on a 4-node RAC cluster. The steps are the same in 19c and 21c, and all of it can be done online; the databases do not need to be shut down. Still, do it in a maintenance window and take an OCR backup first.

Plan the new disk group

  • Redundancy decides how many disks you need. Voting files need 3 failure groups in a NORMAL redundancy disk group and 5 in a HIGH redundancy one. Use 3 (or 5) small LUNs of the same size, ideally from different storage paths.
  • Keep it small and separate. A dedicated disk group for OCR, voting files and the ASM spfile is easy to protect and move. Add a second OCR copy in another disk group, such as +DATA.
  • 19c and 21c only need about 1 GB per disk for these files, unless you also keep the Grid Infrastructure Management Repository (GIMR) there. GIMR is optional from 19c and often not installed.

1. Prepare the disks

Present the LUNs to every node. If you partition them, start the partition at 1 MB (sector 2048) so it is aligned with the storage. With multipath, partition the multipath device, not the individual paths:

# As root, on one node
parted /dev/mapper/mpath45 --script mklabel gpt mkpart primary 1MiB 100%
parted /dev/mapper/mpath46 --script mklabel gpt mkpart primary 1MiB 100%
parted /dev/mapper/mpath47 --script mklabel gpt mkpart primary 1MiB 100%

# Make the new partitions visible on every node
partprobe /dev/mapper/mpath45      # or: kpartx -a /dev/mapper/mpath45

In 2015, only a reboot made the new partitions show up cleanly on all four nodes. On current kernels, partprobe or kpartx is usually enough, but reboot the nodes one at a time if a disk still does not appear.

2. Label the disks for ASM

Use the same method as the rest of your cluster. In 19c and 21c the options are ASM Filter Driver (AFD), udev rules, or ASMLib:

# ASM Filter Driver (as the grid owner, Grid home in PATH)
asmcmd afd_label VOTE_OCR01 /dev/mapper/mpath45p1
asmcmd afd_label VOTE_OCR02 /dev/mapper/mpath46p1
asmcmd afd_label VOTE_OCR03 /dev/mapper/mpath47p1
asmcmd afd_lsdsk

# Or ASMLib (as root)
oracleasm createdisk VOTE_OCR01 /dev/mapper/mpath45p1
oracleasm createdisk VOTE_OCR02 /dev/mapper/mpath46p1
oracleasm createdisk VOTE_OCR03 /dev/mapper/mpath47p1
oracleasm listdisks
# then on every other node:
oracleasm scandisks

3. Create the disk group

Use asmca (NORMAL redundancy, one failure group per disk), or SQL*Plus connected to the ASM instance as SYSASM:

CREATE DISKGROUP VOTE_OCR NORMAL REDUNDANCY
  FAILGROUP fg1 DISK 'AFD:VOTE_OCR01'      -- 'ORCL:VOTE_OCR01' with ASMLib
  FAILGROUP fg2 DISK 'AFD:VOTE_OCR02'
  FAILGROUP fg3 DISK 'AFD:VOTE_OCR03'
  ATTRIBUTE 'compatible.asm' = '19.0.0.0.0';

Then mount it on the other nodes: srvctl start diskgroup -diskgroup VOTE_OCR.

4. Check what is where, and back up the OCR

# As root, with the Grid home's bin directory in PATH
which crsctl              # must be the Grid home, e.g. /u01/app/19.0.0/grid/bin/crsctl
ocrcheck -config          # OCR locations
crsctl query css votedisk # voting files
asmcmd spget              # ASM spfile location (as the grid owner)

ocrconfig -manualbackup   # take a backup before changing anything
ocrconfig -showbackup

5. Move the OCR

You can have up to 5 OCR locations, one per disk group. Add the new locations first, then remove the old one:

ocrconfig -add +VOTE_OCR
ocrconfig -add +DATA          # a second copy in another disk group
ocrcheck

ocrconfig -delete +OCR_VOTE
ocrcheck

Every listed location should show "Device/File integrity check succeeded", followed by "Cluster registry integrity check succeeded" and "Logical corruption check succeeded".

6. Move the voting files

crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   865f20aae69f4fb1bf5fea01bccb68d0 (ORCL:OCR_VOTE01) [OCR_VOTE]
Located 1 voting disk(s).

crsctl replace votedisk +VOTE_OCR
Successful addition of voting disk 7013dd89496e4f81bf97ffc588dad3bc.
Successful addition of voting disk 9062abc1f8e24f04bf90049e84da1a70.
Successful addition of voting disk 818ea7b5d5ee4fc1bf919ffeed602bea.
Successful deletion of voting disk 865f20aae69f4fb1bf5fea01bccb68d0.
Successfully replaced voting disk group with +VOTE_OCR.
CRS-4266: Voting file(s) successfully replaced

crsctl query css votedisk
 1. ONLINE   7013dd89496e4f81bf97ffc588dad3bc (ORCL:VOTE_OCR01) [VOTE_OCR]
 2. ONLINE   9062abc1f8e24f04bf90049e84da1a70 (ORCL:VOTE_OCR02) [VOTE_OCR]
 3. ONLINE   818ea7b5d5ee4fc1bf919ffeed602bea (ORCL:VOTE_OCR03) [VOTE_OCR]
Located 3 voting disk(s).

A NORMAL redundancy disk group with 3 failure groups gives you 3 voting files, so the cluster survives the loss of any one disk.

7. Move the ASM spfile and password file

# As the grid owner
asmcmd spget
asmcmd spmove +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/registry.253.734782115 +VOTE_OCR/spfileASM.ora
asmcmd spget

# 12c and later keep the ASM password file in a disk group too
asmcmd pwget --asm
asmcmd pwmove --asm +OCR_VOTE/orapwasm +VOTE_OCR/orapwasm

If spmove reports that the file is in use, copy it with asmcmd spcopy -u instead; the new spfile is used from the next ASM restart.

8. Verify with a restart

Restart the stack one node at a time (rolling), so the cluster stays up:

crsctl stop crs      # as root, on one node
crsctl start crs
crsctl check cluster -all
crsctl query css votedisk
ocrcheck
cluvfy comp ocr -n all -verbose

When everything reports healthy on all nodes, and nothing is left in +OCR_VOTE (check with asmcmd ls -l +OCR_VOTE), you can drop the old disk group and release its LUNs.

Lessons from the original move

  • Always confirm crsctl and ocrconfig come from the Grid home, not a database home.
  • Take a manual OCR backup first. In 12.2 and later you can keep OCR backups in a disk group with ocrconfig -backuploc +DATA.
  • Test the whole procedure on a test cluster, including a rolling restart, before production.

More current DBA scripts are in my GitHub repository: github.com/sbajwa55/dba-scripts. For help with RAC, Grid Infrastructure or migrations to AWS, visit Bajwa Consulting Services.

Add new Disk to ASM on RAC (11gR2)



 HOW ADD DISK TO ASM on RAC
After SAN administrator attaches the disks to the server you will get the name of the disks as following
SVC-UID                           Vdisk-name       Mpath name   SCSI-ID  Size-GB
6005076801908208A0000000000002C6  devrac-a-qadt11  mpath14      13       250
6005076801908208A0000000000002C7  devrac-a-qadt12  mpath15      14       250
6005076801908208A0000000000002CE  devrac-a-qafr11  mpath22      21       512
6005076801908208A0000000000002D4  devrac-a-qafr17  mpath28      27       512

A friendly name mapping file is located on each host under: /var/lib/multipath/bindings or /etc/multipath/bindings


1.       Login as root and run ls –l /dev/mapper/Mpath_name  from above list and make sure that disks look exactly like the others.

[root@devrac-a-01 ~]# ls -l /dev/mapper/mpath14p1
brw-rw---- 1 root disk 253, 25 Mar 25 10:52 /dev/mapper/mpath14p1
[root@devrac-a-01 ~]# ls -l /dev/mapper/mpath22
brw-rw---- 1 root disk 253, 33 Mar 25 08:59 /dev/mapper/mpath22p22

2.                   Login as root and Partition the shared disks by running the fdisk command with first sector being 2048 and last sector being default (maximum) of the disk.  A 1MB offset is to be set on each SAN device presented.  Below is an example of commands to be used to configure this (for more detail see Rac11gR2OnLinux document):  fdisk command has to be run at one level above then the partition if partition is /dev/mapper/mpath14p1 then run the command at /dev/mapper/mpath14
# fdisk /dev/mapper/mpath14
Command: u
Command: n
Command action: p
Partition Number: 1
First Sector: 2048
Last Sector: (use default)
Command: w

Load it by running:
/sbin/partprobe
Reboot machines.
Or do this kpartx command
[root@devrac-a-01 ~]# ls -l /dev/mapper/mpath40*
brw-rw---- 1 root disk 253, 77 Mar  6 14:34 /dev/mapper/mpath40
[root@devrac-a-01 ~]# kpartx -l /dev/mapper/mpath40
mpath40p1 : 0 8386560 /dev/mapper/mpath40 2048
[root@devrac-a-01 ~]# kpartx -a /dev/mapper/mpath40
[root@devrac-a-01 ~]# ls -l /dev/mapper/mpath40*
brw-rw---- 1 root disk 253, 77 Mar  6 14:34 /dev/mapper/mpath40
brw-rw---- 1 root disk 253, 78 Mar  6 16:42 /dev/mapper/mpath40p1

3.       Then you can create the disk as root user (using oracleasm commands) Since we do not have root access logon as your userid (ssb14) and then run the sudo command i.e.


-bash-3.2$ sudo /usr/sbin/oracleasm createdisk DEVT9ACFS01 /dev/mapper/mpath40p1

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for ssb14:
Writing disk header: done
Instantiating disk: done
-bash-3.2$ /usr/sbin/oracleasm listdisks | grep DEVT9ACFS01


# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
# /etc/init.d/oracleasm configure
Default user to own the driver interface [grid]:
Default group to own the driver interface [oinstall]:
Start Oracle ASM library driver on boot (y/n) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
# /usr/sbin/oracleasm createdisk OCR_VOTE01 /dev/mapper/mpath3p1
# /usr/sbin/oracleasm createdisk OCR_VOTE02 /dev/mapper/mpath4p1
# /usr/sbin/oracleasm createdisk OCR_VOTE03 /dev/mapper/mpath5p1
# /usr/sbin/oracleasm createdisk DEVT2DATA01 /dev/mapper/mpath0p1
# /usr/sbin/oracleasm createdisk DEVT2FRA01 /dev/mapper/mpath1p1
# /usr/sbin/oracleasm createdisk DEVT2FRA02 /dev/mapper/mpath2p1
# /usr/sbin/oracleasm listdisks


4.      From all other nodes:
# /etc/init.d/oracleasm configure
Default user to own the driver interface [grid]:
Default group to own the driver interface [oinstall]:
Start Oracle ASM library driver on boot (y/n) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
# /usr/sbin/oracleasm scandisks
# /usr/sbin/oracleasm listdisks