Oracle 11gR2 restart 單機使用asm儲存 主機名發生更改處理過程 (文件 ID 986740.1)

lhrbest發表於2017-03-10

How to Reconfigure Oracle Restart (文件 ID 986740.1)

In this Document

Goal
Solution
  1. Remove Oracle Restart configuration
  2. Reconfigure Oracle Restart
  3. Add ASM back to Oracle Restart configuration
  4. Start up ASM instance
  5. Recreate ASM server parameter file (SPFILE)
  6. Restart HAS stack
  7. Add components back to Oracle Restart Configuration
  7.1. Add database component
  7.2. Add listener component
  7.3. Add other components


APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.2 to 12.1.0.2 [Release 11.2 to 12.1]
Information in this document applies to any platform.

GOAL

This document is about reconfiguring Oracle Restart. One reason for such action might be if the server (host) was renamed. If that was the case and the server was rebooted, the ASM startup would fail with ORA-29701.

The solution is to reconfigure Oracle Restart.

SOLUTION

1. Remove Oracle Restart configuration

This step should be performed as privileged (root) user.

# $GRID_HOME/crs/install/roothas.pl -deconfig -force

The expected result is "Successfully deconfigured Oracle Restart stack".

2. Reconfigure Oracle Restart

This step should also be performed as privileged (root) user.

# $GRID_HOME/crs/install/roothas.pl

The expected result is "Successfully configured Oracle Grid Infrastructure for a Standalone Server"

3. Add ASM back to Oracle Restart configuration

This step should be performed as Grid Infrastructure owner (grid user).

$ srvctl add asm

The expected result is no output, just a return to the operating system prompt.

4. Start up ASM instance

This step should be performed as Grid Infrastructure owner (grid user).

$ srvctl start asm
That should start ASM. Note that at this time there will be no ASM initialization or server  parameter file.

5. Recreate ASM server parameter file (SPFILE)

This step should be performed as Grid Infrastructure owner (grid user).

Create a temporary initialization parameter file (e.g. /tmp/init+ASM.ora) with the following content (specify your own disk group names):
asm_diskgroups='DATA','RECO'
instance_type='asm'
large_pool_size=12M
remote_login_passwordfile='EXCLUSIVE'
Mount the disk group where the new server parameter file (SPFILE) will reside (e.g. DATA) and create SPFILE:
$ sqlplus / as sysasm

SQL> alter diskgroup DATA mount;
Diskgroup altered.

SQL> create spfile='+DATA' from pfile='/tmp/init+ASM.ora';
File created.

SQL> show parameter spfile
NAME TYPE VALUE
------- ------- -------------------------------------------------
spfile string +DATA/asm/asmparameterfile/registry.253.707737977

6. Restart HAS stack

crsctl stop has
crsctl start has

7. Add components back to Oracle Restart Configuration

If you had the database, listener and other components, add them back to the Oracle Restart Configuration.

7.1. Add database component

This step should be performed as RDBMS owner (oracle user).

srvctl add database -d -o

7.2. Add listener component

This step should be performed as Grid Infrastructure owner (grid user).

srvctl add listener

7.3. Add other components

For information on how to add back additional components, please review:
Oracle Database Administrator's Guide 11g Release 2 (11.2)
Chapter 4 Configuring Automatic Restart of an Oracle Database
Section Configuring Oracle Restart




How to change Hostname / IP for a Grid Infrastructure Oracle Restart Standalone Configuration (SIHA) (文件 ID 1552810.1)

In this Document

Goal
Solution
  Community Discussions
References


APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.1 to 12.1.0.2 [Release 11.2 to 12.1]
Information in this document applies to any platform.

GOAL

This document provides (in detail) the required & mandatory steps that need to be executed after the hostname was updated/changed/modified.

If you intend to change only the IP address then we dont need to do anything such as deconfig/reconfig.
 

SOLUTION

 Therefore, please perform the next steps after the hostname was updated/changed/modified in the Oracle Restart configuration:

1) Configure the CSS & OHAS services as root user as follows:

# <11.2 Grid Infrastructure Oracle Home>/crs/install/roothas.pl -deconfig -force

# <11.2 Grid Infrastructure Oracle Home>/crs/install/roothas.pl
# cd <12.1 Grid infrastructure Oracle Home>/crs/install
# perl roothas.sh -deconfig -force
--This removes any configuration on the system that referenced the old host name.
# cd <12.1 Grid infrastructure Oracle Home>
# ./root.sh

Go to the grid home's bin directory. Use the srvctl add database command with the -c SINGLE flag to add the database in an Oracle Restart configuration.
Also use the srvctl add command to add the listener, the Oracle ASM instance, all Oracle ASM disk groups, and any database services to the Oracle Restart configuration.

  
2) Please perform the next steps as oracle or grid OS user (as the Grid Infrastructure OS owner):  

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl modify resource "ora.cssd" -init -attr "AUTO_START=1"  

  
3) Restart the OHAS stack as grid or oracle OS user (as the Grid Infrastructure OS owner):

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl stop has

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl start has


4) Check the CSS & OHAS state as grid or oracle OS user (as the Grid Infrastructure OS owner):

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl check has

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl check css

$> <11.2 Grid Infrastructure Oracle Home>/bin/ crsctl stat resource

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl stat res -t


Note: If the CSS & OHAS service did NOT start, then you will need to reboot the Linux/unix box and check them again.

5) Recreate the default listener (LISTENER) using port 1521 (or using your desired port), thru the NETCA GUI located on the new Grid Infrastructure Oracle Home (or manually if you do not have graphical access) as grid or oracle OS user (as the Grid Infrastructure OS owner):

$> srvctl add listener

$> srvctl start listener


6) Please create the init+ASM.ora file on the <11.2 Grid Infrastructure Oracle Home>/dbs directory with the next parameters:

asm_diskgroups= <list of diskgroups>

asm_diskstring= '/dev/oracleasm/disks/*'  

instance_type='asm'

large_pool_size=12M


7) Add the ASM instance as grid or oracle OS user (as the Grid Infrastructure OS owner):

$> <11.2 Grid Infrastructure Oracle Home>/bin/srvctl add asm
$> <12.1 Grid Infrastructure Oracle Home>/bin/srvctl add asm


8) Enable ASM instance Auto Start as grid or oracle OS user (as the Grid Infrastructure OS owner) as follow:  

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl modify resource "ora.asm" -attr "AUTO_START=1"   


9) Make sure the disks are discovered by kfod as grid or oracle OS user (as the Grid Infrastructure OS owner) as follow:

Example:

$> <11.2 Grid Infrastructure Oracle Home>/bin/kfod asm_diskstring='ORCL:*' disks=all


Or

$> <11.2 Grid Infrastructure Oracle Home>/bin/kfod asm_diskstring='<full path ASM disks location>/*' disks=all


10) If so, then startup the ASM instance as grid or oracle OS user (as the Grid Infrastructure OS owner) as follow:

$> export ORACLE_SID=+ASM

$> <11.2 Grid Infrastructure Oracle Home>/bin/sqlplus “/as sysasm”

SQL> startup pfile=init+ASM.ora --#init file from point #6

SQL> show parameter asm


11) Validate that the candidate disks are being discovered:

SQL> select  path  from v$asm_disk;


12) Create a new ASM instance spfile:

SQL> create spfile from pfile;


13) Add the new ASM spfile and listener to the new ASM instance resource:

$> <11.2 Grid Infrastructure Oracle Home>/bin/srvctl modify asm  -p <spfile full path>

$> <11.2 Grid Infrastructure Oracle Home>/bin/srvctl modify asm  -l LISTENER


14) Validate the OHAS (Oracle Restart) services start as follows:  

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl  stop has

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl  start has

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl  stat res

$> <11.2 Grid Infrastructure Oracle Home>/bin/crsctl  stat res -t

 

MOS 上有參考文件 How to change Hostname/ IP in GI standalone (SIHA) (文件 ID 1552810.1)。    
文件中對於ASM是採用新建立的PFILE來重新新增ASM例項。其實就使用以前的SPFILE,也可以,只需要記下來,重新配置SPFILE的位置引數就行了。

點選(此處)摺疊或開啟

  1. // #行都使用root使用者執行, $行使用對應使用者執行
  2. # $GI_HOME/bin/crsctl status resource ora.asm -f
  3. // 記錄以下兩個引數的值
  4.                         ASM_DISKSTRING=/dev/UPRR*
  5.                         SPFILE=+UPRRDB_DATA/asm/asmparameterfile/registry.253.832110249

  6. # $GI_HOME/crs/install/roothas.pl -deconfig -force

  7. Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
    CRS resources for listeners are still configured
    PRKO-2573 : ONS 守護程式已停止。
    CRS-2673: Attempting to stop 'ora.UPRRDB_DATA.dg' on 'uprr1'
    CRS-2677: Stop of 'ora.UPRRDB_DATA.dg' on 'uprr1' succeeded
    CRS-2673: Attempting to stop 'ora.asm' on 'uprr1'
    CRS-2677: Stop of 'ora.asm' on 'uprr1' succeeded
    CRS-2673: Attempting to stop 'ora.cssd' on 'uprr1'
    CRS-2677: Stop of 'ora.cssd' on 'uprr1' succeeded
    CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'uprr1'
    CRS-2673: Attempting to stop 'ora.evmd' on 'uprr1'
    CRS-2677: Stop of 'ora.evmd' on 'uprr1' succeeded
    CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'uprr1' has completed
    CRS-4133: Oracle High Availability Services has been stopped.
    Successfully deconfigured Oracle Restart stack

  8. //改主機名
  1. # hostname uprr.phanx.com
  2. # vim /etc/hosts
  3. # vim /etc/sysconfig/network
  4. # service network restart


  5. //重新登入   Logout and re-login.

  6. # $GI_HOME/crs/install/roothas.pl

  7. Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
    LOCAL ADD MODE 
    Creating OCR keys for user 'grid', privgrp 'oinstall'..
    Operation successful.
    LOCAL ONLY MODE 
    Successfully accumulated necessary OCR keys.
    Creating OCR keys for user 'root', privgrp 'root'..
    Operation successful.
    CRS-4664: Node uprr successfully pinned.
    Adding Clusterware entries to upstart


    uprr     2014/06/30 14:48:16     /u01/app/grid/product/11.2.0/grid/cdata/uprr/backup_20140630_144816.olr
    Successfully configured Oracle Grid Infrastructure for a Standalone Server

  8. # crs_stat -t

  9. Name           Type           Target    State     Host        
    ------------------------------------------------------------
    ora.cssd       ora.cssd.type  OFFLINE   OFFLINE               
    ora.diskmon    ora....on.type OFFLINE   OFFLINE               
    ora.evmd       ora.evm.type   ONLINE    ONLINE    uprr        
    ora.ons        ora.ons.type   OFFLINE   OFFLINE   

  10. su - grid
  11. $ vim $GI_HOME/network/admin/listener.ora
  12. $ $GI_HOME/bin/srvctl add asm
  13. $ $GI_HOME/bin/crsctl modify resource "ora.asm" -attr "AUTO_START=1"
  14. $ $GI_HOME/bin/srvctl modify asm -p '+UPRRDB_DATA/asm/asmparameterfile/registry.253.832110249' -d '/dev/UPRR*'

  15. //檢查監聽是否已經啟動,如果啟動了就停止。 check if listener is active, if yes kill it.

  16. $  ps -ef|grep tnslsnr|grep -v grep | awk '{print $2}'|xargs -L1 kill -9



  17. $ $GI_HOME/bin/srvctl add listener -l LISTENER -o $GI_HOME
  18. $ $GI_HOME/bin/lsnrctl start
  19. $ crsctl start resource ora.cssd

  20. CRS-2672: Attempting to start 'ora.cssd' on 'uprr'
    CRS-2672: Attempting to start 'ora.diskmon' on 'uprr'
    CRS-2676: Start of 'ora.diskmon' on 'uprr' succeeded
    CRS-2676: Start of 'ora.cssd' on 'uprr' succeeded

  21. $ sqlplus / as sysasm
  22. SQL> startup
  23. SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=uprr.phanx.com)(PORT=1521))))';


  24. # su - oracle
  25. $ srvctl add database -d UPRR -o $ORACLE_HOME
  26. $ sqlplus / as sysdba
  27. SQL> startup
  28. SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=uprr.phanx.com)(PORT=1521))))';
  29. # $GI_HOME/bin/crs_stat -t
  30. Name           Type           Target    State     Host        
    ------------------------------------------------------------
    ora....ER.lsnr ora....er.type ONLINE    ONLINE    uprr        
    ora....DATA.dg ora....up.type ONLINE    ONLINE    uprr        
    ora.asm        ora.asm.type   ONLINE    ONLINE    uprr        
    ora.cssd       ora.cssd.type  ONLINE    ONLINE    uprr        
    ora.diskmon    ora....on.type OFFLINE   OFFLINE               
    ora.evmd       ora.evm.type   ONLINE    ONLINE    uprr        
    ora.ons        ora.ons.type   OFFLINE   OFFLINE               
    ora.uprr.db    ora....se.type ONLINE    ONLINE    uprr


如果還有其它地方,像 tnsnames.ora, sqlnet.ora 中,如果有主機名的地方,對應修改以下。
我沒有用DB Control,如果有的話,還需要重建DB Control,參考 MOS 文件 Note 278100.1 How To Drop, Create And Recreate the Database Control (DB Control) Release 10g and 11g  Oracle 11gR2 restart 單機使用asm儲存 主機名發生更改處理過程 (文件 ID 986740.1)278100.pdf



How to Migrate an ASM Oracle Restart Configuration from One Host to Another Host on Unix/Linux on 11.2 or 12c Releases. (文件 ID 2015797.1)

In this Document

Goal
Solution
  Community Discussions
References


APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.1 to 12.1.0.2 [Release 11.2 to 12.1]
Information in this document applies to any platform.

GOAL

 The present document provides the example about how to migrate an ASM Oracle Restart configuration from one host to another host on Unix/Linux.

SOLUTION

You need to follow the next steps to migrate an ASM Oracle Restart configuration from one host to another host on Unix/Linux on 11.2 or 12c releases:

1) Shutdown all the Oracle Services as follows:

$> crsctl stop has


2) Then shutdown the source Linux/Unix host.

3) Disconnect/unplug your Storage and connect it to the new Linux host.

4) Install the ASMLIB on the new hosts (this installation will scan the original disks).

Note: This steps is only required if ASMLIB API was present on the original source host.

5) Then Install the 11.2 Grid Infrastructure Standalone "Software Only" + any required GIPSU    on the new hosts to match the original release.

6) Then Install the 11.2 RDBMS Standalone "Software Only" + any required RDBMS PSU   on the new hosts to match the original release.

7) Then configure the CSS & OHAS services as root user:

# $<New 11.2 Grid Infrastructure Oracle Home>/crs/install/roothas.pl


8) Please perform the next steps as oracle or grid OS user (Grid Infrastructure OS owner):

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl modify resource "ora.cssd" -attr "AUTO_START=1"

 

Note: On 12c release you will need to add the  -unsupported parameter as follows:

$> $<New 12.1 Grid Infrastructure Oracle Home>/bin/crsctl modify resource "ora.cssd" -attr "AUTO_START=1"  -unsupported

 

9) Restart the OHAS stack as grid or oracle OS user:

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl stop has

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl start has


10) Check the CSS & OHAS state as grid or oracle OS user:

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl check has

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl check css

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/ crsctl stat resource

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl stat res -t


Note: If the CSS & OHAS service did NOT start, then you will need to reboot the Linux box and check them again.

11) Remove the Old listener running under the old Grid Infrastructure Oracle Home, thru the NETCA GUI (from the old Grid Infrastructure Oracle Home).

12) Recreate the default listener (LISTENER) using port 1521, thru the NETCA GUI located on the new Grid Infrastructure Oracle Home.

13) Please create the init+ASM.ora file on the $<New 11.2 Grid Infrastructure Oracle Home>/dbs directory with the next parameters:

asm_diskgroups= <list of diskgroups>

asm_diskstring= 'ORCL:*' or '/dev/oracleasm/disks/*'

instance_type='asm'

large_pool_size=12M


14) Add the ASM instance as grid or oracle user or the Grid Infrastructure installation owner and execute:

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/srvctl add asm


15) Enable ASM instance Auto Start as follow:

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl modify resource "ora.asm" -attr "AUTO_START=1"

 

Note: On 12c release you will need to add the  -unsupported parameter as follows:  

$> $<New 12.1 Grid Infrastructure Oracle Home>/bin/crsctl modify resource "ora.asm" -attr "AUTO_START=1"  -unsupported

  

16) Make sure the disks are discovered by kfod:

Example:

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/kfod asm_diskstring='ORCL:*' disks=all


Or

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/kfod asm_diskstring='/dev/oracleasm/disks/*' disks=all


17) If so, then startup the ASM instance as follow:

$> export ORACLE_SID=+ASM

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/sqlplus "/as sysasm"

SQL> startup pfile=init+ASM.ora --#init file from point #13

SQL> show parameter asm


18) Validate that the original diskgroup(s) were mounted:

SQL> select name, state from v$asm_diskgroup;


19) Create a new ASM instance spfile:

SQL> create spfile from pfile;


20) Add the new ASM spfile and listener to the new ASM instance resource:

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/srvctl modify asm  -p <ASM spfile full path>

$> $<New 11.2 Grid Infrastructure Oracle Home>/bin/srvctl modify asm  -l LISTENER


21) Finally validate the OHAS (autostart) services start as follow:

$><New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl stop has

$><New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl start has

$><New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl stat res

$><New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl stat res -t


22) Check the new HAS version as well as follow:

$><New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl query has releaseversion
$><New 11.2 Grid Infrastructure Oracle Home>/bin/crsctl query has softwareversion


23) If you need to add additional OHAS/Restart/SIHA resources (e.g. database instances), then please follow the steps described in the next note (I wrote it):

-O-  Reconfiguring & Recreating The 11gR2 Restart/OHAS/SIHA Stack Configuration (Standalone). Document 1422517.1

 


 






About Me

...............................................................................................................................

本文來自MOS (文件 ID 986740.1)

小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● QQ群:230161599     微信群:私聊

聯絡我請加QQ好友(642808185),註明新增緣由

文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

版權所有,歡迎分享本文,轉載請保留出處

...............................................................................................................................

拿起手機使用微信客戶端掃描下邊的左邊圖片來關注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的資料庫技術。

 Oracle 11gR2 restart 單機使用asm儲存 主機名發生更改處理過程 (文件 ID 986740.1)  DBA筆試面試講解

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

相關文章