• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to move ASM spfile to a different disk group

by admin

Question

When the ASM was first installed the spfile was placed in the default Disk Group (e.g. +DATA). The requirement now is to move the spfile to a different diskgroup.

Method 1 : Using “asmcmd spcopy”

Copying the spfile

Shown below is an example of moving spfile with the “asmcmd spcopy” utility on Oracle Restart environment.

1. List out the current spfile being used in the database with “asmcmd spget” command.

$ asmcmd spget
+DATA/asm/asmparameterfile/registry.253.722601213

Verify the disk group where you want to move the spfile to. In our example we will move the spfile to disk group “+PLAY”

$ asmcmd lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Votin g_files Name
MOUNTED EXTERN N 512 4096 1048576 14658 9814 0 9814 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 9772 8507 0 8507 0 N PLAY/
MOUNTED EXTERN N 512 4096 1048576 9772 9212 0 9212 0 N RECO/

Copy spfile with -u option to update GPnP profile in RAC environment

$ asmcmd spcopy -u +DATA/asm/asmparameterfile/registry.253.722601213 +PLAY/spfileASM.ora

Restarting the HA stack

1. Next step is to restart the HA stack to verify that ASM starts up fine with copiedspfile. Restart the “has” resource with crsctl.

$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '[server]'
...
CRS-4133: Oracle High Availability Services has been stopped.
$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.

Verify the new localtion of spfile with “asmcmd spget” command again.

$ asmcmd spget
+PLAY/spfileASM.ora

Remove the old spfile

You may also want to remove the old spfile, so that no one uses it by mistake. To do so, use the “asmcmd rm” command.

$ asmcmd ls -l +DATA/asm/asmparameterfile
Type Redund Striped Time Sys Name
ASMPARAMETERFILE UNPROT COARSE JUN 25 10:00:00 Y REGISTRY.253.722601213
$ asmcmd rm +DATA/asm/asmparameterfile/registry.253.722601213

Method 2 : Using intermediate pfile

This is an example of moving ASM spfile in a single instance environment, by making use of intermediate pfile.

Create intermediate pfile

1. Verify the location of the current spfile.

$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on [date]
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL> show parameter spfile

NAME    TYPE    VALUE
------- ------- --------------------------------------------------
spfile  string  +DATA/asm/asmparameterfile/registry.253.715881237

2. Next is to create an intermediate pfile from spfile using the command shown below.

SQL> create pfile='/tmp/pfile+ASM.ora' from spfile;

File created.

Create new spfile

1. Create a new spfile in the new disk group using the intermediate pfile we just created in step 1 above.

SQL> create spfile='+PLAY' from pfile='/tmp/pfile+ASM.ora';

File created.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

Restart the HA stack

1. Restart the HA stack to verify that ASM starts up fine with moved spfile.

$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '[server]'
...
CRS-4133: Oracle High Availability Services has been stopped.
$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.

2. Verify that the new spfile is being used by the database using the below command.

$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.1.0 Production on [date]
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL> show parameter spfile

NAME    TYPE    VALUE
------- ------- --------------------------------------------------
spfile  string  +PLAY/asm/asmparameterfile/registry.253.715963539

3. Also verify if the disk groups +DATA and +PLAY are in mounted state.

SQL> select name, state from v$asm_diskgroup;

NAME  STATE
----- -----------
DATA  MOUNTED
PLAY  MOUNTED

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

4. The use of new spfile can also be verified with asmcmd as follows:

$ asmcmd spget
+PLAY/asm/asmparameterfile/registry.253.715963539

Remove old spfile

You may want to remove the old spfile so that no one uses it by mistake. Use the “asmcmd rm” command to remove the old spfile.

$ asmcmd rm +DATA/asm/asmparameterfile/registry.253.715881237
NOTE: The ASM instance has to be restarted for this change to take effect. In a cluster environment, all ASM instances in the cluster have to be restarted and that can be done in a rolling fashion – one ASM instance at the time.
How to Move a Datafile from Filesystem to ASM Using ASMCMD CP Command
How to move a datafile from file system to ASM

Filed Under: ASM, oracle

Some more articles you might also be interested in …

  1. Oracle Database : Shutdown Basics (How to Shutdown Oracle Database)
  2. How to delete archives from only 1 archive destination when 2 or more are in use
  3. Understanding Oracle Database Automatic SGA Memory Tuning
  4. Oracle Database : Startup basics (How to start Oracle Database)
  5. How to Configure Device File owner/group with udev rules
  6. How to Use Udev Rules to Create oracleasm Disks in CentOS/RHEL 8
  7. How to add and drop online redo log members and groups in Oracle
  8. Script to monitor RMAN Backup and Restore Operations
  9. How to use Flashback Database in Oracle Data Guard Configuration
  10. How to Shrink the datafile of Undo Tablespace in Oracle Database

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright