11gR2修改Grid軟體ASM例項引數檔案位置

kunlunzhiying發表於2017-01-04

相關文章:
《11gR2手動建立的ASM例項無法被Clusterware管理的問題的解決》:http://space.itpub.net/23135684/viewspace-743090

《11gR2手動建立ASM例項ORA-29786錯誤解決方法》:
http://space.itpub.net/23135684/viewspace-743018

1.Standalone環境。
cd /u01/app/11.2.0/grid/bin
# ./crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA01.dg
               ONLINE  ONLINE       ncappweb2                                    
ora.LISTENER.lsnr
               ONLINE  ONLINE       ncappweb2                                    
ora.OCRVDISK.dg
               ONLINE  ONLINE       ncappweb2                                    
ora.asm
               ONLINE  ONLINE       ncappweb2                Started             
ora.ons
               OFFLINE OFFLINE      ncappweb2                                    
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.mtorcl.db
      1        ONLINE  ONLINE       ncappweb2                Open

        上面是使用預設方式建立好的Standalone單資料庫環境,使用ASM作為儲存方式,OCRVDISK儲存了ASM例項的引數檔案。

        如果想Standalone單例項資料庫環境中不使用ASM作為ASM例項引數檔案的存放方式,推薦的做法是先按照預設的要求,建立好ASM磁碟組,ASM例項的引數檔案會存放到該ASM磁碟組中,例如上面的OCRVDISK磁碟組。之後再透過下面的方式將ASM例項的引數檔案遷移到本地檔案系統。

2.使用srvctl modify asm修改SPFILE位置。
# pwd
/u01/app/11.2.0/grid/bin
# ./srvctl modify asm -h

Modifies the configuration for ASM.

Usage: srvctl modify asm [-l <lsnr_name>] [-p <spfile>] [-d <asm_diskstring>]
    -l <lsnr_name>           Listener name
    -p <spfile>              Server parameter file path
    -d <asm_diskstring>      ASM diskgroup discovery string
    -h                       Print usage
# ./srvctl config asm
ASM home: /u01/app/11.2.0/grid
ASM listener: LISTENER
Spfile: +OCRVDISK/asm/asmparameterfile/registry.253.793652513
ASM diskgroup discovery string: 
# su - grid
$ cd /u01/app/11.2.0/grid/dbs/
$ ls
ab_+ASM.dat  hc_+ASM.dat  init.ora     orapw+ASM

        當前並沒有ASM例項的SPFILE引數檔案。

$ srvctl modify asm -p /u01/app/11.2.0/grid/dbs/spfile+ASM.ora

        srvctl modify asm的操作必須在grid使用者下完成。

3.重啟Grid,檢驗modify效果。
# ./crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.OCRVDISK.dg' on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.mtorcl.db' on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ncappweb2'
CRS-2677: Stop of 'ora.mtorcl.db' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.DATA01.dg' on 'ncappweb2'
CRS-2677: Stop of 'ora.DATA01.dg' on 'ncappweb2' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ncappweb2' succeeded
CRS-2677: Stop of 'ora.OCRVDISK.dg' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'ncappweb2'
CRS-2677: Stop of 'ora.asm' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'ncappweb2'
CRS-2677: Stop of 'ora.cssd' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'ncappweb2'
CRS-2677: Stop of 'ora.evmd' on 'ncappweb2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ncappweb2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
# ./crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA01.dg
               ONLINE  ONLINE       ncappweb2                                    
ora.LISTENER.lsnr
               ONLINE  ONLINE       ncappweb2                                    
ora.OCRVDISK.dg
               ONLINE  ONLINE       ncappweb2                                    
ora.asm
               ONLINE  ONLINE       ncappweb2                Started             
ora.ons
               OFFLINE OFFLINE      ncappweb2                                    
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.mtorcl.db
      1        ONLINE  ONLINE       ncappweb2                Open                
# ./srvctl config asm
ASM home: /u01/app/11.2.0/grid
ASM listener: LISTENER
Spfile: /u01/app/11.2.0/grid/dbs/spfile+ASM.ora
ASM diskgroup discovery string: 
# su - grid
$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 11 09:50:55 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL> show parameter spfile

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string

        連線到ASM例項,但是並看不到SPFILE引數被指定了值。

4.刪除儲存ASM例項引數檔案的磁碟組。
# ./srvctl remove diskgroup -g ocrvdisk -f
$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 11 09:54:08 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL> drop diskgroup ocrvdisk including contents;

Diskgroup dropped.

        刪除OCRVDISK磁碟組。

5.DROP OCRVDISK磁碟組之後觀察Grid重啟效果。
# ./crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.mtorcl.db' on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ncappweb2'
CRS-2677: Stop of 'ora.mtorcl.db' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.DATA01.dg' on 'ncappweb2'
CRS-2677: Stop of 'ora.DATA01.dg' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'ncappweb2'
CRS-2677: Stop of 'ora.asm' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'ncappweb2'
CRS-2677: Stop of 'ora.cssd' on 'ncappweb2' succeeded
CRS-5014: Agent "/u01/app/11.2.0/grid/bin/oraagent.bin" timed out starting process "/u01/app/11.2.0/grid/bin/lsnrctl" for action "stop": details at "(:CLSN00009:)" in "/u01/app/11.2.0/grid/log/ncappweb2/agent/ohasd/oraagent_grid/oraagent_grid.log"
CRS-5017: The resource action "ora.LISTENER.lsnr stop" encountered the following error: 
(:CLSN00009:)Utils:execCmd aborted. For details refer to "(:CLSN00108:)" in "/u01/app/11.2.0/grid/log/ncappweb2/agent/ohasd/oraagent_grid/oraagent_grid.log".

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ncappweb2' succeeded
CRS-2679: Attempting to clean 'ora.LISTENER.lsnr' on 'ncappweb2'
CRS-2681: Clean of 'ora.LISTENER.lsnr' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'ncappweb2'
CRS-2677: Stop of 'ora.evmd' on 'ncappweb2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ncappweb2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
#./crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA01.dg
               ONLINE  ONLINE       ncappweb2                                    
ora.LISTENER.lsnr
               ONLINE  ONLINE       ncappweb2                                    
ora.asm
               ONLINE  ONLINE       ncappweb2                Started             
ora.ons
               OFFLINE OFFLINE      ncappweb2                                    
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.mtorcl.db
      1        ONLINE  ONLINE       ncappweb2                Open                
        ASM例項正常啟動。

$ cd $GRID_HOME/dbs
$ ls
ab_+ASM.dat  hc_+ASM.dat  init.ora     orapw+ASM

        從上面的輸出可以看出,srvctl modify asm命令並不會建立例項的SPFILE引數檔案,但是srvctl add asm命令會為ASM例項建立預設值的引數檔案,這點是有差別的,所以我們還可以透過執行srvctl remove asm和srvctl add asm命令實現對ASM引數檔案位置的修改,且還建立相應位置的引數檔案。

        從上面的例子看出,即使沒有ASM例項的引數檔案,ASM例項依然可以正常啟動,Oracle應該為ASM例項設定了預設的啟動引數。
# su - grid
$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 11 09:57:49 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL> show parameter spfile

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string

        SPFILE引數值依然不存在。

6.手動建立SPFILE檔案。
SQL> create spfile from memory;

File created.

$ ls
ab_+ASM.dat     hc_+ASM.dat     init.ora        orapw+ASM       spfile+ASM.ora
$ strings spfile*.ora
*.__large_pool_size=12M
*._aggregation_optimization_settings=0
*._always_anti_join='CHOOSE'
*._always_semi_join='CHOOSE'
*._and_pruning_enabled=TRUE
*._b_tree_bitmap_plans=TRUE
*._bloom_filter_enabled=TRUE
*._bloom_folding_enabled=TRUE
*._bloom_pruning_enabled=TRUE
*._complex_view_merging=TRUE
*._compression_compatibility='11.2.0'
*._connect_by_use_union_all='TRUE'
*._convert_set_to_join=FALSE
*._cost_equality_semi_join=TRUE
*._cpu_to_io=0
*._dimension_skip_null=TRUE
*._eliminate_com
mon_subexpr=TRUE
......

7.重啟Grid。
# ./crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.mtorcl.db' on 'ncappweb2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ncappweb2'
CRS-2677: Stop of 'ora.mtorcl.db' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.DATA01.dg' on 'ncappweb2'
CRS-2677: Stop of 'ora.DATA01.dg' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'ncappweb2'
CRS-2677: Stop of 'ora.asm' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'ncappweb2'
CRS-2677: Stop of 'ora.cssd' on 'ncappweb2' succeeded
CRS-5014: Agent "/u01/app/11.2.0/grid/bin/oraagent.bin" timed out starting process "/u01/app/11.2.0/grid/bin/lsnrctl" for action "stop": details at "(:CLSN00009:)" in "/u01/app/11.2.0/grid/log/ncappweb2/agent/ohasd/oraagent_grid/oraagent_grid.log"
CRS-5017: The resource action "ora.LISTENER.lsnr stop" encountered the following error: 
(:CLSN00009:)Utils:execCmd aborted. For details refer to "(:CLSN00108:)" in "/u01/app/11.2.0/grid/log/ncappweb2/agent/ohasd/oraagent_grid/oraagent_grid.log".

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ncappweb2' succeeded
CRS-2679: Attempting to clean 'ora.LISTENER.lsnr' on 'ncappweb2'
CRS-2681: Clean of 'ora.LISTENER.lsnr' on 'ncappweb2' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'ncappweb2'
CRS-2677: Stop of 'ora.evmd' on 'ncappweb2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ncappweb2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
# ./crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA01.dg
               ONLINE  ONLINE       ncappweb2                                    
ora.LISTENER.lsnr
               ONLINE  ONLINE       ncappweb2                                    
ora.asm
               ONLINE  ONLINE       ncappweb2                Started             
ora.ons
               OFFLINE OFFLINE      ncappweb2                                    
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       ncappweb2                                    
ora.mtorcl.db
      1        ONLINE  ONLINE       ncappweb2                Open                
# su - grid
$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 11 10:06:20 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL> show parameter spfile

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string
/u01/app/11.2.0/grid/dbs/spfil
e+ASM.ora
SQL> show parameter disk

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
asm_diskgroups                       string
DATA01
asm_diskstring                       string

SQL> alter system set asm_diskstring='/dev/rhdisk*';

System altered.

SQL> show parameter disk

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
asm_diskgroups                       string
DATA01
asm_diskstring                       string
/dev/rhdisk*
        從這個例子可以看出,修改現存環境的ASM引數檔案位置,首先是建立新位置的SPFILE檔案,之後使用srvctl modify asm命令調整SPFILE的位置,最後重啟Grid軟體以驗證ASM引數位置修改效果。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28211342/viewspace-2131869/,如需轉載,請註明出處,否則將追究法律責任。

相關文章