Google it ....

Thursday, April 2, 2015

ASM is not working after change hostname

On my test environment I changed hostname of Linux machine and after restart ASM did not start.
environment:
OS : Oracle Linux 6.5
DB : Oracle database 11g(11.2.0.3)

so let's simulate changing hostname and see results:
[root@oel6 ~]# hostname
oel6
[root@oel6 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=testdb
[root@oel6 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.220.128 testdb

[root@oel6 ~]# reboot

our hostname changed after restart we can check it and try to start ASM instance.
old hostname --- oel6 new hostname --- testdb
[root@testdb ~]# hostname
testdb
su - grid
-bash-4.1$ srvctl start asm
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd

sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 2 14:05:38 2015

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

Connected to an idle instance.

SQL> startup;
ORA-01078: failure in processing system parameters
ORA-29701: unable to connect to Cluster Synchronization Service

Solution:
ok, ASM will not start because we need to reconfigure HAS(High Availability Service).
with root user go to $GRID_HOME/crs/install and run roothas.pl script for deconfiguration.
cd /u01/app/grid/product/11.2.0/grid/crs/install/
./roothas.pl -deconfig -force

Using configuration parameter file: ./crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
Successfully deconfigured Oracle Restart stack

with root user go to $GRID_HOME/crs/install directory and run the roothas.pl script for reconfiguration
./roothas.pl

Using configuration parameter file: ./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 testdb successfully pinned.
Adding Clusterware entries to upstart

testdb     2015/04/02 14:29:27     
/u01/app/grid/product/11.2.0/grid/cdata/testdb/backup_20150402_142927.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

with grid user Register and start the resources
crsctl start resource ora.cssd
CRS-2672: Attempting to start 'ora.cssd' on 'testdb'
CRS-2672: Attempting to start 'ora.diskmon' on 'testdb'
CRS-2676: Start of 'ora.diskmon' on 'testdb' succeeded
CRS-2676: Start of 'ora.cssd' on 'testdb' succeeded

now we can add the listener as a resource and after that we can start it
srvctl add listener -l LISTENER
srvctl start listener
srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): testdb

now we can add the asm we do not need to create spfile for asm. we can use the one before.
if you haven't spfile you can simple create pfile and then create spfile from this pfile for example create pfile - init+ASM.ora in $GRID_HOME/dbs with parameters:
instance_type=ASM
asm_diskstring='/dev/oracleasm/disks/DATA01'
asm_diskgroups='DG01'

sqlplus / as sysasm
SQL> startup pfile=init+ASM.ora;
SQL> create spfile='+DG01' from pfile='init+ASM.ora';
SQL> shutdown immediate;

with grid user
srvctl add asm -l LISTENER -p "/u01/app/grid/product/11.2.0/grid/dbs/init+ASM.ora"
srvctl start asm
srvctl status asm
ASM is running on testdb

at last we can add database
srvctl add database -d testdb -o /u01/app/oracle/product/11.2.0/dbhome_1 -p 
+DG01/spfiletestdb.ora -r PRIMARY -s open -t immediate -a "DG01"
srvctl start database -d testdb
srvctl status database -d testdb
Database is running.

that's all, now we have new hostname and asm is up and running.
srvctl status asm
ASM is running on testdb

No comments:

Post a Comment