Friday, November 04, 2011

Fun!!! - Changed hostname on GI (Standalone Server)

Changed hostname on Grid Infrastructure for a Standalone Server. why did I talk about this? I just changed hostname in my virtualbox and rebooted it. I got error in /var/log/messages file(The Grid Infrastructure didn't start).

Oct 27 16:20:07 new_mytest logger: Oracle Cluster Ready Services startup disabled.
Oct 27 16:20:07 new_mytest logger: Could not access /etc/oracle/scls_scr/mylinux/oracle/ohasdstr.
Oct 27 16:20:13 new_mytest logger: autorun file for ohasd is missing
Oct 27 16:20:23 new_mytest logger: autorun file for ohasd is missing

So, I just tested/wrote about changed hostname on Grid Infrastructure for a Standalone Server. Not serious, just fun!!!
Example to change hostname from "mytest" to "mylinux" :)
*** Keep some resource informations ***
[root@mytest ~]# mkdir mytest
[root@mytest ~]# for x in ` /u01/app/oracle/product/11.2.0/grid/bin/crsctl stat res | grep NAME\= | awk -F\= '{print $2}'`; do /u01/app/oracle/product/11.2.0/grid/bin/crsctl stat res $x -p > mytest/$x.txt ; done
[root@mytest ~]# ls mytest
ora.asm.txt ora.DATA.dg.txt ora.evmd.txt ora.ons.txt
ora.cssd.txt ora.diskmon.txt ora.LISTENER.lsnr.txt ora.orcl.db.txt
A. Stopped HAS
[root@mytest ~]# /u01/app/oracle/product/11.2.0/grid/bin/crsctl stop has -f
B. Changed hostname
[root@mytest ~]# vi /etc/sysconfig/network
[root@mytest ~]# vi /etc/hosts
[root@mytest ~]# vi /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
[root@mytest ~]# hostname
mytest
[root@mytest ~]# hostname mylinux
[root@mylinux ~]# hostname
mylinux
C. Started to change hostname with Grid Infrastructure for a Standalone Server.
[root@mytest ~]# /u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl -h
Option hahome requires an argument
Usage:
roothas.pl [-verbose] [-upgrade | -patch]
[-paramfile <parameter-file>] [-deconfig] [-force]
[-unlock [-hahome <path to Oracle Restart home>]]

Options:
-verbose Run this script in verbose mode
-upgrade Oracle HA is being upgraded from previous version
-patch Oracle HA is being upgraded to a patch version
-paramfile Complete path of file specifying HA parameter values
-deconfig To deconfigure Oracle Restart
-force To deconfigure Oracle Restart when configuration is in a good condition
-unlock Unlock Oracle Restart home
-hahome Complete path of Oracle HA home

If neither -upgrade nor -patch is supplied, a new install is performed

To see the full manpage for this program, execute:
perldoc roothas.pl
[root@mytest ~]# /u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl -verbose -deconfig -force
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/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

[root@mylinux ~]# /u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl -verbose
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'oracle', 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 mylinux successfully pinned.
Adding Clusterware entries to inittab
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow:
Oracle Database 11g Clusterware Release 11.2.0.3.0 - Production Copyright 1996, 2011 Oracle. All rights reserved.
[client(3619)]CRS-10001:27-Oct-11 18:54 ACFS-9201: Not Supported
2011-10-27 18:56:06.170
[client(3703)]CRS-2101:The OLR was formatted using version 3.
2011-10-27 18:56:09.776
[client(3727)]CRS-1001:The OCR was formatted using version 3.
[client(3770)]CRS-10001:CRS-6021: No msg for has:crs-6021 [l][unlimited]
[client(3771)]CRS-10001:CRS-6021: No msg for has:crs-6021 [n][65536]
*** Fixed them (ulimit) and fixed some... ***
[root@mylinux ~]# ps -aef | grep grid
oracle 3768 1 0 18:56 ? 00:00:00 /u01/app/oracle/product/11.2.0/grid/bin/ohasd.bin reboot
oracle 4213 1 0 19:05 ? 00:00:00 /u01/app/oracle/product/11.2.0/grid/bin/ohasd.bin reboot
oracle 4659 1 0 19:12 ? 00:00:00 /u01/app/oracle/product/11.2.0/grid/bin/ohasd.bin reboot

[root@mylinux ~]# kill -9 3768 4213 4659
[root@mylinux ~]# ps -aef | grep grid
oracle 4875 1 4 19:16 ? 00:00:00 /u01/app/oracle/product/11.2.0/grid/bin/ohasd.bin restart
*** After error and then run script again!!! Just make sure, NO "ohasd.bin reboot" on OS processes ***
*** De-configuration and run "roothas.pl" script again. ***
[root@mylinux ~]# /u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl -verbose -deconfig
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
CRS-2613: Could not find resource 'ora.cssd'.
CRS-4000: Command Stop failed, or completed with errors.
CRS-2613: Could not find resource 'ora.cssd'.
CRS-4000: Command Delete failed, or completed with errors.
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle Restart stack

[root@mylinux ~]# /u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl -verbose
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'oracle', 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 mylinux successfully pinned.
Adding Clusterware entries to inittab

mylinux 2011/10/27 19:20:36 /u01/app/oracle/product/11.2.0/grid/cdata/mylinux/backup_20111027_192036.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
[root@mytest ~]# /u01/app/oracle/product/11.2.0/grid/bin/crsctl check has
CRS-4638: Oracle High Availability Services is online

[root@mytest ~]# /u01/app/oracle/product/11.2.0/grid/bin/crsctl stat res | grep NAME\=
NAME=ora.cssd
NAME=ora.diskmon
NAME=ora.evmd
NAME=ora.ons
*** Checked in backup for resource informations ***
[root@mytest ~]# ls mytest
ora.asm.txt ora.DATA.dg.txt ora.evmd.txt ora.ons.txt
ora.cssd.txt ora.diskmon.txt ora.LISTENER.lsnr.txt ora.orcl.db.txt
Reviewed resources what was not register.
*** Try to use crsctl add res resource_name -type type_name -file mytest/file.txt ***
*** But Error - CRS-0175: Resource type 'type_name' either doesn't exist or cannot be accessed. ***
*** OK use "srvctl" for manual ***

D. Added other resources by manual (srvctl)
- Added Listener (changed listener.ora file before)
[root@mytest ~]# su - oracle
[oracle@mylinux ~]$ srvctl -h | grep listener | grep add
Usage: srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>]
[oracle@mylinux ~]$ srvctl add listener -l LISTENER -p "TCP:1521" -o /u01/app/oracle/product/11.2.0/grid
[oracle@mylinux ~]$ srvctl start listener
[oracle@mylinux ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): mylinux
- Added ASM
[root@mytest ~]# grep DISK mytest/ora.asm.txt
ASM_DISKSTRING=DATA
[root@mytest ~]# grep ASM_DISKSTRING mytest/ora.asm.txt
ASM_DISKSTRING=DATA
[root@mytest ~]# grep SP mytest/ora.asm.txt
SPFILE=
[root@mytest ~]# su - oracle
[oracle@mylinux ~]$ srvctl -h | grep asm | grep add
Usage: srvctl add asm [-l <lsnr_name>] [-p <spfile>] [-d <asm_diskstring>]
[oracle@mylinux ~]$ srvctl add asm -l LISTENER -p '' -d 'DATA'
[oracle@mylinux ~]$ srvctl start asm
[oracle@mylinux ~]$ srvctl status asm

[oracle@mylinux ~]$ /u01/app/oracle/product/11.2.0/grid/bin/crsctl stat res | grep NAME\=
NAME=ora.LISTENER.lsnr
NAME=ora.asm
NAME=ora.cssd
NAME=ora.diskmon
NAME=ora.evmd
NAME=ora.ons

[oracle@mylinux ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
[oracle@mylinux ~]$ export ORACLE_SID=+ASM
[oracle@mylinux ~]$ sqlplus / as sysasm

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
DATA

SQL> alter diskgroup DATA mount;

Diskgroup altered.

[oracle@mylinux ~]$ /u01/app/oracle/product/11.2.0/grid/bin/crsctl stat res | grep NAME\=
NAME=ora.DATA.dg
NAME=ora.LISTENER.lsnr
NAME=ora.asm
NAME=ora.cssd
NAME=ora.diskmon
NAME=ora.evmd
NAME=ora.ons
- Added Database
[root@mytest ~]# grep SPFILE mytest/ora.orcl.db.txt
SPFILE=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/spfileorcl.ora
[root@mytest ~]# grep ORACLE_HOME\= mytest/ora.orcl.db.txt
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_2

[oracle@mylinux ~]$ srvctl -h | grep database | grep add
Usage: srvctl add database -d <db_unique_name> -o <oracle_home> [-m <domain_name>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-n <db_name>] [-i <inst_name>] [-y {AUTOMATIC | MANUAL | NORESTART}] [-a "<diskgroup_list>"]
[oracle@mylinux ~]$ srvctl add database -d orcl -o /u01/app/oracle/product/11.2.0/dbhome_2 -p /u01/app/oracle/product/11.2.0/dbhome_2/dbs/spfileorcl.ora
[oracle@mylinux ~]$ srvctl start database -d orcl
I learned some when I used "crsctl add res resource_name -type type_name -file mytest/file.txt". I got error "CRS-0175: Resource type 'type_name' either doesn't exist or cannot be accessed", that mean I have to add "resource type" before. But "srvctl" command, that will add "resource type" automatic.

Related Post:
Just Test - Install Oracle GI (standalone server) on OL6
Upgrade Grid Infrastructure for cluster (11.2.0.2 to 11.2.0.3)
11.2.0.3 GI diskmon will be OFFLINE by default in Non-Exadata

2 comments:

Sunil said...

I cloned my VM install with Oracle install and this was helpful. Thank you.

Unknown said...

Thanks man,, for sharing your post..

[]

Samuel