• 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. Declaring PL/SQL Variables
  2. How to Install/Uninstall/Upgrade Oracle SQLTXPLAIN (SQLT) Tool
  3. Oracle Data Guard 12c New Feature: Far Sync Standby
  4. ORA-27125: unable to create shared memory segment; Error: 28: No space left on device
  5. DNS and DHCP Setup Example for Oracle Grid Infrastructure GNS
  6. How to Configure client connectivity in Oracle Data Guard configuration (Implement failover procedures)
  7. How to Modify an Existing ASM Spfile in a RAC Environment
  8. What is Thread Dump in WebLogic
  9. How to check which options or features are used in the Oracle database
  10. Find Oracle RAC OCR & voting disk location

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright