数据库
首页 > 数据库> > Oracle 11gR2 restart 单机使用asm存储 主机名发生更改处理过程 (文档 ID 986740.1)

Oracle 11gR2 restart 单机使用asm存储 主机名发生更改处理过程 (文档 ID 986740.1)

作者:互联网

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. //改主机名
  9. # hostname uprr.phanx.com
  10. # vim /etc/hosts
  11. # vim /etc/sysconfig/network
  12. # service network restart


  13. //重新登录   Logout and re-login.

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

  15. 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

  16. # crs_stat -t

  17. 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   

  18. su - grid
  19. $ vim $GI_HOME/network/admin/listener.ora
  20. $ $GI_HOME/bin/srvctl add asm
  21. $ $GI_HOME/bin/crsctl modify resource "ora.asm" -attr "AUTO_START=1"
  22. $ $GI_HOME/bin/srvctl modify asm -p '+UPRRDB_DATA/asm/asmparameterfile/registry.253.832110249' -d '/dev/UPRR*'

  23. //检查监听是否已经启动,如果启动了就停止。 check if listener is active, if yes kill it.

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



  25. $ $GI_HOME/bin/srvctl add listener -l LISTENER -o $GI_HOME
  26. $ $GI_HOME/bin/lsnrctl start
  27. $ crsctl start resource ora.cssd

  28. 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

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


  32. # su - oracle
  33. $ srvctl add database -d UPRR -o $ORACLE_HOME
  34. $ sqlplus / as sysdba
  35. SQL> startup
  36. SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=uprr.phanx.com)(PORT=1521))))';
  37. # $GI_HOME/bin/crs_stat -t
  38. 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  fj.png278100.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           



标签:bin,11gR2,986740.1,主机名,ASM,Oracle,crsctl,asm,ora
来源: https://blog.51cto.com/lhrbest/2695719