find & vi

After grid control sccessfully install on server db2 , I added  listener1 using port 1821 and modified tnsnames.ora using the new listener.

then the repostory couldn't be connected , I then go to sysman log files and found many error saying it still using port 1521 .

 

lack of knowledge where the port number 1521 is stored in some config file (I knew there must be)

 

firstly I use find * -exec grep 1521 {} \;which I used alot in the past but this command didn't return the file name I needed.

 

then I baidued and find http://blog.csdn.net/duguduchong/article/details/7716908   by using find . | xargs grep -ri 1521 -l  can return the file name which I want

in the command , -r means recursive -i means case insentive -l only print the find name

 

here I print the context of the file : emoms.properties  after modify the port number the oms can be started

#Sun Apr 14 05:39:05 EDT 2013
oracle.sysman.emSDK.svlt.ConsoleServerName=db2.localdomain\:4889_Management_Service
oracle.sysman.eml.mntr.emdRepPwd=789991115e7f322a
emdrep.ping.pingCommand=/bin/ping -c 3 -w 30 <hostname>
em_oob_shutdown=false
LargeRepository=false
oracle.sysman.eml.mntr.emdRepPort=1821
em_email_address=
oracle.sysman.eml.mntr.emdRepPwdSeed=7595875322002216448
em_oob_crash=false
em.oms.dumpModules=omsThread,repos
oracle.sysman.emRep.dbConn.statementCacheSize=50
oracle.sysman.db.isqlplusUrl=%ISQLPLUS_PROTOCOL%\://%ISQLPLUS_HOST%\:%ISQLPLUS_PORT%/isqlplus/dynamic
em_oob_startup=false
oracle.sysman.emSDK.svlt.ConsoleServerPort=4889
em_from_email_address=_NOT_AVAILABLE_
oracle.sysman.eml.mntr.emdRepPwdEncrypted=TRUE
oracle.sysman.db.isqlplusWebDBAUrl=%ISQLPLUS_PROTOCOL%\://%ISQLPLUS_HOST%\:%ISQLPLUS_PORT%/isqlplus/dba/dynamic
oracle.sysman.emSDK.svlt.ConsoleServerHost=db2.localdomain
em_from_email_name=_NOT_AVAILABLE_
oracle.sysman.emSDK.svlt.ConsoleServerHTTPSPort=1159
em_email_gateway=
oracle.sysman.eml.mntr.emdRepServer=db2.localdomain
oracle.sysman.eml.mntr.emdRepSID=repdb
oracle.sysman.eml.mntr.emdRepConnectDescriptor=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=db2.localdomain)(PORT\=1821)))(CONNECT_DATA\=(SID\=repdb)))
oracle.sysman.emkeyfile=/u01/oracle/OracleHomes/oms10g/sysman/config/emkey.ora
em.ip.ui.enable=true
oracle.sysman.eml.mntr.emdRepUser=sysman
oracle.sysman.emSDK.svlt.PublicServletEnabled=true

 

something is stupid for oracle still using the sid rather than service name . 

 

[oracle@db2 config]$ find . | xargs grep -ri "1521" -l
./emoms.properties
./emoms.properties

 


[oracle@db2 config]$ find * -exec grep "1521" {} \;
oracle.sysman.eml.mntr.emdRepPort=1521
oracle.sysman.eml.mntr.emdRepConnectDescriptor=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=db2.localdomain)(PORT\=1521)))(CONNECT_DATA\=(SID\=repdb)))

 

 

also the agent should be modified too , the key word 1521 is in agent10g/sysman/emd/targets.xml file.

 

an awk sample below

ps -fe | grep lsnr | grep -v "grep" |  kill -9 `awk '{ print $2 }' `

 

awk ' patten { command } ' input

[oracle@db2 dbs]$ awk '/dest/' initdb.ora
background_dump_dest=/u01/oracle/admin/db/bdump
core_dump_dest=/u01/oracle/admin/db/cdump
user_dump_dest=/u01/oracle/admin/db/udump
audit_file_dest=/u01/oracle/admin/db/adump
#log_archive_dest_1='location=/u01/oracle/arch/db valid_for=(all_logfiles,all_roles) db_unique_name=db'
#log_archive_dest_2='service=db valid_for=(online_logfiles,primary_role) db_unique_name=db lgwr sync'

 

[oracle@db2 dbs]$ awk  -F "=" '/dest/ {print $1}' initdb.ora
background_dump_dest
core_dump_dest
user_dump_dest
audit_file_dest
#log_archive_dest_1
#log_archive_dest_2

 

vi command

1) add a # in front of all lines below 34  : 34,$s/^/#/  -- add comment to tnsname.ora

2) goto line  34  : 34

3) delete all empty rows below line 34    :34,$s/^\n==g :g/^s*$/d

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值