移動ASM的spfile到一個新的disk group

qqmengxue發表於2010-11-12

在初始安裝完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)


[@more@]1、透過建立一箇中間的PFILE檔案來達到移動的效果

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部落格 ” ,連結:http://blog.itpub.net/10130206/viewspace-1041368/,如需轉載,請註明出處,否則將追究法律責任。

相關文章