[20180222]改变oracle执行时的参数0.txt
--//春节放假,看了链接https://blog.dbi-services.com/server-process-name-in-postgres-and-oracle/
--//里面提到postgres数据库可以显示执行时参数,作者想到oracle如何修改参数0.真心佩服这家伙Franck Pachot 的技术功底.
--//里面提到使用top,ps 显示参数的方法:例子:
# top -c -U oracle
$ ps -u oracle -o pid,comm,cmd,args
--//但是我一直认为oracle连接无法改变的参数显示,实际上作者给出了例子,我仅仅重复测试:
sqlplus scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book)))
sqlplus scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=book)(SERVICE_NAME=book)))
--//以上两个方式都可以连接数据库,但是加入(ARGV0=aaaa)无效.
1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.测试bed连接方式:
sqlplus scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book)))
sqlplus scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=book)(SERVICE_NAME=book)))
sqlplus scott/book@"(DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oraclebook)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')(ENVS='ORACLE_SID=book,ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1')))"
sqlplus scott/book@"(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oraclebook)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')(ENVS='ORACLE_SID=book,ORACLE_HOME=$ORACLE_HOME'))"
--//4个都可以,另外说明一下使用bed链接不用引号出现如下错误ora-12547:
$ rlwrap sqlplus scott/book@(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=testtest)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')(ENVS='ORACLE_SID=book,ORACLE_HOME=$ORACLE_HOME'))
SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 22 09:06:14 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
$ oerr ora 12547
12547, 00000, "TNS:lost contact"
// *Cause: Partner has unexpectedly gone away, usually during process
// startup.
// *Action: Investigate partner application for abnormal termination. On an
// Interchange, this can happen if the machine is overloaded.
--//不知道为什么?
$ rlwrap sqlplus scott/book@"(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oraclebook)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')(ENVS='ORACLE_SID=book,ORACLE_HOME=$ORACLE_HOME'))"
SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 22 08:54:21 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
string beginning "'SCOTT@(AD..." is too long. maximum size is 50 characters.
SQL> show user;
USER is "SCOTT"
--//实际上已经连上,至于报这个错误,我在链接blog.itpub.net/267265/viewspace-2140401/上有说明,不过这里没有服务名大小写问题.不知道那里有出现错误.
$ rlwrap sqlplus "scott/book@(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=testtest)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')(ENVS='ORACLE_SID=book,ORACLE_HOME=$ORACLE_HOME'))"
SQL> host ps -u oracle -o pid,comm,cmd,args | grep testtes[t]
33906 rlwrap rlwrap sqlplus -L scott/boo rlwrap sqlplus -L scott/book@(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=testtest)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')(ENVS='ORACLE_SID=book,ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1'))
33909 oracle testtest (DESCRIPTION=(LOCA testtest (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))
---//修改参数开头testtest.
$ rlwrap sqlplus scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)(ARGV0=testtest))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book)))
SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 22 09:10:30 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SCOTT@book> host ps -u oracle -o pid,comm,cmd,args | grep testtes[t]
33971 rlwrap rlwrap sqlplus scott/book@( rlwrap sqlplus scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)(ARGV0=testtest))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book)))
--//这样不行.
3.测试远程连接如何修改:
--//The remote connection can have the name changed from the static registration, adding an ARVG0 value on the listener side:
--//修改监听配置:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = gxqyydg4)(PORT = 1521))
# (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
# (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
--//再次佩服这家伙技术功底,主机IP写入0.0.0.0就是表示在全部接口上接听.
--//再加入服务如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = book)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME=book)
)
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = book123)
(ARGV0=myapp0)
~~~~~~~~~~~~~~~~~~
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME=book)
)
)
$ sqlplus scott/book@192.168.100.78:1521/book123
SCOTT@192.168.100.78:1521/book123> host ps -u oracle -o pid,comm,cmd,args | grep myap[p]
34274 oracle myapp0 (DESCRIPTION=(LOCAL= myapp0 (DESCRIPTION=(LOCAL=NO)(SDU=32767))
--//我的测试好像仅仅配置静态监听可以实现.