[Oracle 11.2.0.3] Modify Hostname on GI (standalone server)
来源:互联网 发布:ubuntu vnc客户端 编辑:程序博客网 时间:2024/06/06 09:32
本文目的:
本文源自于Oracle 11.2.0.3 GI Standalone 数据迁移之后,由于GI管理方式下网络IP地址和主机名迁移之前无法变更【更改后CRS服务无法启动,
顾官方不提供也不推荐相关更改方法】。故编写此文记录如何在GI管理单实例的情况下更改主机名和[IP], 整体更改过程:
- 更改主机名(CRS服务因此会无法启动)
- 停止GI (HAS)服务
- 使用roothas.pl 重新配置GI(HAS)(更改OCR中相关注册信息)
- 重新手动添加CRS资源(listener/asm/diskgroup/db)
1. 原有环境
1.1 主机名和IP
#hostname
#test1
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:89:61:70
inet addr:192.168.1.196 Bcast:10.64.37.255 Mask:255.255.255.128
inet6 addr: fe80::250:56ff:fe89:6170/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25000682 errors:0 dropped:20244 overruns:0 frame:0
TX packets:15881315 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7392294006 (7049.8 Mb) TX bytes:6365551420 (6070.6 Mb)
#more /etc/hosts
192.168.1.196 test1
2. 更改后环境
#hostname
#test2
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:89:61:70
inet addr:192.168.2.196 Bcast:10.64.37.255 Mask:255.255.255.128
……
#more /etc/hosts
……
192.168.2.196 test2
3. 更改过程
3.1 记录更改前CRS Resource 信息
【实验】故可以预先保存CRS Resource
#su – grid
grid@test1:~> pwd
grid@test1:~>/home/grid
grid@test1:~>mkdir test1
grid@test1:~> for x in `$GRID_HOME/bin/crsctl stat res | grep NAME\= | awk -F\= '{print $2}'`; do $GRID_HOME/bin/crsctl stat res $x -p > mytest/$x.txt ; done
grid@test1:~>cd test1
grid@test1:~>ls -al
drwxr-xr-x 2 grid oinstall 4096 Sep 9 10:09 .
drwxr-x--- 3 grid oinstall 12288 Sep 9 10:08 ..
-rw-r--r-- 1 grid oinstall 912 Sep 9 10:09 ora.asm.txt
-rw-r--r-- 1 grid oinstall 1693 Sep 9 10:09 ora.orcl.db.txt
-rw-r--r-- 1 grid oinstall 1407 Sep 9 10:09 ora.cssd.txt
-rw-r--r-- 1 grid oinstall 760 Sep 9 10:09 ora.DATA.dg.txt
-rw-r--r-- 1 grid oinstall 1046 Sep 9 10:09 ora.diskmon.txt
-rw-r--r-- 1 grid oinstall 1249 Sep 9 10:09 ora.evmd.txt
-rw-r--r-- 1 grid oinstall 759 Sep 9 10:09 ora.FRA.dg.txt
-rw-r--r-- 1 grid oinstall 827 Sep 9 10:09 ora.LISTENER.lsnr.txt
-rw-r--r-- 1 grid oinstall 672 Sep 9 10:09 ora.ons.txt
grid@test1:~>more ora.asm.txt
NAME=ora.asm
TYPE=ora.asm.type
ACL=owner:grid:rwx,pgrp:oinstall:rwx,other::r--
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
ALIAS_NAME=
ASM_DISKSTRING=/dev/oracleasm/disks
AUTO_START=restore
CHECK_INTERVAL=1
CHECK_TIMEOUT=30
DEFAULT_TEMPLATE=PROPERTY(RESOURCE_CLASS=asm) ELEMENT(INSTANCE_NAME= %GEN_USR_ORA_INST_NAME%)
DEGREE=1
DESCRIPTION=Oracle ASM resource
ENABLED=1
GEN_USR_ORA_INST_NAME=+ASM
LOAD=1
LOGGING_LEVEL=1
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=60
SPFILE=
START_DEPENDENCIES=hard(ora.cssd) weak(ora.LISTENER.lsnr)
START_TIMEOUT=900
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=hard(ora.cssd)
STOP_TIMEOUT=600
TYPE_VERSION=1.2
UPTIME_THRESHOLD=1d
USR_ORA_ENV=
USR_ORA_INST_NAME=+ASM
USR_ORA_OPEN_MODE=mount
USR_ORA_OPI=false
USR_ORA_STOP_MODE=immediate
VERSION=11.2.0.3.0
3.2 Change hostname
[root@test 1~]hostname test2
[root@test2]vi /etc/hosts
…..
#more /etc/hosts
192.168.1.196 test2
3.3 Stop Has 并检查是否还存在has服务
【注意】如果还存在ohasd.bin reboot service则会出现3.5小节的错误
[root@test 1~]# /opt/app/oracle/product/11.2/grid/bin/crsctl stop has –f
[root@test 1~]#ps –ef|grep grid
grid 5474 1 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/evmd.bin
grid 5507 5474 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/evmlogger.bin -o /opt/app/oracle/product/11.2/grid/evm/log/evmlogger.info -l /opt/app/oracle
/product/11.2/grid/evm/log/evmlogger.log
grid 5661 1 0 15:31 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/oraagent.bin
grid 5706 1 50 15:31 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/ohasd.bin restart
grid 5741 1 11 15:31 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/cssdagent
grid 5743 1 15 15:31 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/orarootagent.bin
grid 5746 1 13 15:31 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/oraagent.bin
root 5782 4366 0 15:31 pts/0 00:00:00 grep grid
3.4 以root用户执行roothas.pl 重新配置has
#id
#uid=0(root) gid=0(root) groups=0(root)
#cd /opt/app/oracle/product/11.2/grid/crs/install
test2:/opt/app/oracle/product/11.2/grid/crs/install#/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
# ./roothas.pl -verbose -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.
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
Successfully deconfigured Oracle Restart stack
3.5 使用roothas.pl重新注册主机名等相关信息到OCR和inittab
# pwd
#/opt/app/oracle/product/11.2/grid/crs/install
#./roothas.pl -verbose
Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
Failed to write the checkpoint:'ROOTCRS_OLR' with status:SUCCESS.Error code is 256
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node test1 successfully pinned.
Failed to write the checkpoint:'ROOTCRS_OHASD' with status:SUCCESS.Error code is 256
Adding Clusterware entries to inittab
Failed to write the checkpoint:'ROOTCRS_INITRES' with status:SUCCESS.Error code is 256
【注意】此时主机名理应更改过了,应为test2,说明在注册过程中 还有没有读取到/etc/hosts中的test2,
而是从crs某些服务直接取得的hostname,故检查此时是否还存在运行的HAS服务:
# ps -aef | grep grid
grid 5283 1 2 15:29 ? 00:00:01 /opt/app/oracle/product/11.2/grid/bin/ohasd.bin reboot
grid 5460 1 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/oraagent.bin
grid 5474 1 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/evmd.bin
grid 5507 5474 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/evmlogger.bin -o /opt/app/oracle/product/11.2/grid/evm/log/evmlogger.info-l/opt/app/oracle/product/11.2/grid/evm/log/evmlogger.log
root 5521 4366 0 15:30 pts/0 00:00:00 grep grid
【注意】在3.3小节中停止HAS后,需要检查该服务是否未停干净,如果没有,执行3.6操作
3.6 KILL has service
【注意】杀完后需要重新检查,直到ohasd.bin reboot"消失
Test2:/opt/app/oracle/product/11.2/grid/crs/install # kill -9 5283
Test2:/opt/app/oracle/product/11.2/grid/crs/install # ps -aef | grep grid
grid 5474 1 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/evmd.bin
grid 5507 5474 0 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/evmlogger.bin -o /opt/app/oracle/product/11.2/grid/evm/log/evmlogger.info -l /opt/app/oracle
/product/11.2/grid/evm/log/evmlogger.log
grid 5536 1 27 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/ohasd.bin restart
grid 5571 1 5 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/cssdagent
grid 5573 1 5 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/orarootagent.bin
grid 5575 1 7 15:30 ? 00:00:00 /opt/app/oracle/product/11.2/grid/bin/oraagent.bin
root 5612 4366 0 15:30 pts/0 00:00:00 grep grid
3.7 重新执行roothas.pl配置oracle (has) restart
Test2:#id
Test2:#uid=0(root) gid=0(root) groups=0(root)
Test2:#cd /opt/app/oracle/product/11.2/grid/crs/install
Test2:/opt/app/oracle/product/11.2/grid/crs/install # ./roothas.pl -verbose –deconfig
Using configuration parameter file: /opt/app/oracle/product/11.2/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
Test2:/opt/app/oracle/product/11.2/grid/crs/install # ./roothas.pl -verbose
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 test2 successfully pinned.
Adding Clusterware entries to inittab
3.8 检查crs信息
test2:/opt/app/oracle/product/11.2/grid/bin # ./crsctl stat res | grep NAME\=
NAME=ora.cssd
NAME=ora.diskmon
NAME=ora.evmd
NAME=ora.ons
3.9 添加CRSResource
- 添加监听
grid@test2:~> srvctl add listener -l LISTENER -p "TCP:1521" –o /opt/app/oracle/product/11.2/grid/
grid@test2:~> srvctl start listener
grid@test2:~> srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): test2
grid@test2:~> crs_stat -t
Name Type Target State Host
----------------------------------------------------------------------------------------------
ora....ER.lsnr ora....er.type ONLINE ONLINE test2
ora.cssd ora.cssd.type OFFLINE OFFLINE
ora.diskmon ora....on.type OFFLINE OFFLINE
ora.evmd ora.evm.type ONLINE ONLINE test2
ora.ons ora.ons.type OFFLINE OFFLINE
- 添加asm资源
grid@test2:/opt/app/oracle/product/11.2/grid/dbs> srvctl -h | grep asm | grep add
Usage: srvctl add asm [-l <lsnr_name>] [-p <spfile>] [-d <asm_diskstring>]
grid@test2:/opt/app/oracle/product/11.2/grid/dbs>srvctl add asm -l LISTENER -p '' -d '/dev/oracleasm/disks'
grid@test2:/opt/app/oracle/product/11.2/grid/dbs> srvctl start asm
grid@test2:/opt/app/oracle/product/11.2/grid/dbs> srvctl status asm
ASM is running on test2
grid@test2:/opt/app/oracle/product/11.2/grid/dbs> sqlplus
SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 24 16:27:00 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter user-name: /as sysasm
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option
SQL> select name from v$asm_diskgroup;
NAME
--------------
FRA
DATA
SQL> alter diskgroup DATA mount;
Diskgroup altered.
SQL> alter diskgroup FRA mount;
Diskgroup altered.
grid@test2:/opt/app/oracle/product/11.2/grid> crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE test2
ora.FRA.dg ora....up.type ONLINE ONLINE test2
ora....ER.lsnr ora....er.type ONLINE ONLINE test2
ora.asm ora.asm.type ONLINE ONLINE test2
ora.cssd ora.cssd.type ONLINE ONLINE test2
ora.diskmon ora....on.type OFFLINE OFFLINE
【注意】此部操作 –d后需要当初选择ASM磁盘时候的磁盘位置,如果手动【change Path】过,
记得填上如:“/dev/oracleasm/disks”
- 添加db资源
Test2:~ #su - oracle
oracle@test2:/opt/app/oracle/product/11.2/grid/bin> ./srvctl add database -d cdcrm01 -o /opt/app/oracle/product/11.2/db -p /opt/app/oracle/product/11.2/db/dbs/initcdcrm01
oracle@test2:/opt/app/oracle/product/11.2/grid/bin> srvctl start database -d orcl
- 查看crs资源信息
grid@TEST2:~> crs_stat -t
Name Type Target State Host
--------------------------------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE test2
ora.FRA.dg ora....up.type ONLINE ONLINE test2
ora....ER.lsnr ora....er.type ONLINE ONLINE test2
ora.asm ora.asm.type ONLINE ONLINE test2
ora....us01.db ora....se.type OFFLINE OFFLINE
ora.cssd ora.cssd.type ONLINE ONLINE test2
ora.diskmon ora....on.type OFFLINE OFFLINE
ora.evmd ora.evm.type ONLINE ONLINE test2
ora.ons ora.ons.type OFFLINE OFFLINE
完成更改!
- [Oracle 11.2.0.3] Modify Hostname on GI (standalone server)
- Modify the VIP or VIP Hostname for a 10g Oracle Clusterware
- configuration Oracle Grid Infrastructure for a Standalone Server
- selenium-server-standalone
- Set Hostname on CentOS
- Oracle 11g R2 GI and DB Installation on AIX 6.1L
- 11gR2 GI standalone环境(即:GI 单机环境)中asm spfile的位置信息
- Oracle 11.2 GI中OLR损坏的修复方法
- Modify the server ports
- Oracle ADF的History Column(ADF框架提供5个默认的History属性:Create On,Create By,Modify On,Modify By,Vers)
- [Haskell on HackerEarth] Modify Sequence
- Oracle CRS/GI 进程介绍
- Oracle CRS/GI 进程介绍
- Oracle CRS/GI 进程介绍
- oracle 11g GI deinstall
- Jersey创建standalone server 一
- Jersey创建standalone server 二
- Too many processes on hostname
- java 九九乘法表
- CentOS下安装QT5
- C# 多维数组
- 推荐系统的循序进阶读物(从入门到精通)
- Linux下c开发 之 线程通信(转)
- [Oracle 11.2.0.3] Modify Hostname on GI (standalone server)
- Uninstall Skype with WindowsUninstaller.Org Removal Tips
- PASCAL VOC
- 设计模式之Observer
- urlrewrite重写
- 模板的Traits
- Myeclipse7.5安装FindBugs检查代码Bug
- Unity3D协同程序(Coroutine)
- ios 动画