在初始安装完ASM后,ASM的spfile文件默认在默认的盘组,现在需要将ASM的spfile文件移入另一个新的盘组内,以下有两种方式以供实现。
在ASM的文档中说是使用asmcmd spmove来移动,但是在实际的使用过程中会报错 :
$ asmcmd spmove +DATA/asm/asmparameterfile/REGISTRY.253.715881237 +PLAY/spfileASM.ora
ORA-15032: not all alterations performed
ORA-15028: ASM file '+DATA/asm/asmparameterfile/REGISTRY.253.715881237' not dropped; currently being accessed (DBD ERROR: OCIStmtExecute)a、从当前的spfile创建pfile
b、通过新创建的pfile在新的磁盘组创建spfile
c、使用新创建的spfile来验证HA是否正常
d、删除先前的spfile
2、使用asmcmd spcopy命令:
a、通过指定-u参数来拷贝spfile,以更新GPnP pfile在RAC环境中
b、通过新的spfile来重启HA以验证是否可用
c、移除以前的spfile
以下为在单节点环境中的示例:
1、创建pfile文件
$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on
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
SQL> create pfile='/tmp/pfile+ASM.ora' from spfile;
File created.
2、通过以上新创建的pfile在新的盘组内创建spfile:
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
3、使用新创建的spfile来重启HA验证环境:
$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '
...
CRS-4133: Oracle High Availability Services has been stopped.
$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
4、验证新的spfile已经使用:
$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on
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
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
5、也可以使用asmcmd来验证:
$ asmcmd spget
+PLAY/asm/asmparameterfile/registry.253.715963539
6、移除旧的spfile:
$ asmcmd rm +DATA/asm/asmparameterfile/registry.253.715881237
以下为使用asmcmd spcopy的示例:
1、通过指定-u参数来拷贝,以此来更新GPnP pfile,在RAC环境中
$ asmcmd spget
+DATA/asm/asmparameterfile/registry.253.722601213
$ 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/
$ asmcmd spcopy -u +DATA/asm/asmparameterfile/registry.253.722601213 +PLAY/spfileASM.ora
2、重启HA以验证新的spfile使用正常:
$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on ''
...
CRS-4133: Oracle High Availability Services has been stopped.
$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
$ asmcmd spget
+PLAY/spfileASM.ora
3、移除旧的spfile文件:
$ 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来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10130206/viewspace-1041368/ ,如需转载,请注明出处,否则将追究法律责任。