[20180222]改變oracle執行時的引數0.txt
[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))
--//我的測試好像僅僅配置靜態監聽可以實現.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2151134/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 未初始化變數引發執行時故障變數
- 檢視JVM執行時引數JVM
- Oracle 通過註釋改變執行計劃Oracle
- Lcust 分散式執行時的引數化問題分散式
- Solaris 執行等級的改變(轉)
- Android的文字框內容改變的時候執行指定方法Android
- 改變無法改變的Query 變數變數
- vue 變數賦值同時改變的問題Vue變數賦值
- Oracle可變引數的優化Oracle優化
- 在Java程式中列印java執行時引數Java
- CNN實現手寫數字識別並改變引數進行分析CNN
- sql執行計劃是否改變SQL
- 使用hint改變執行計劃
- job中執行帶有引數的procedure 時的寫法
- 解決 Retrofit 多 BaseUrl 及執行時動態改變 BaseUrl ?
- Java調優—Btrace監控Java執行緒/方法執行引數、執行時間(Windows)Java執行緒Windows
- 解決Retrofit多BaseUrl及執行時動態改變BaseUrl(二)
- Solaris如何改變系統執行級
- Oracle 執行計劃中一些引數的含義Oracle
- react路由引數改變不重新渲染頁面React路由
- Vue獲取位址列引數並做改變Vue
- 如何在程式執行時動態修改它的引數(狀態)?
- CentOS升級核心與容器執行時核心引數的關係CentOS
- Pytest(1) - 執行引數的使用
- 11g 改變SQL執行計劃SQL
- Oracle優化案例-改變那些CBO無能為力的執行計劃(一)Oracle優化
- Pytest 順序執行,依賴執行,引數化執行
- kettle 引數——變數引數和常量引數變數
- oracle 執行計劃變更Oracle
- Jmeter將token設定為全域性變數並跨執行緒進行傳遞引數JMeter變數執行緒
- 安裝oracle時核心引數的含義Oracle
- Oracle安裝時shmmax引數的設定OracleHMM
- spark job執行引數優化Spark優化
- [20160713]改變引數在另外的會話.txt會話
- iOS可變引數(不定引數)的用法iOS
- 迴圈建立多執行緒時保證引數的有效性 (轉)執行緒
- 在執行時使用滑鼠移動控制元件和改變控制元件的大小 (轉)控制元件
- [一分鐘知識]改變無法改變的Query 變數變數