搜尋
首頁資料庫mysql教程Oracle中tnsnames.ora的作用

tnsnames.ora 在listener的作用,数据库只是在启动的过程中会读到tnsnames.ora中的内容去解析LOCAL_LISTENER,之后tnsnames的变化

1、tnsnames.ora 在listener的作用
数据库只是在启动的过程中会读到tnsnames.ora中的内容去解析LOCAL_LISTENER,之后tnsnames的变化和侦听无关


---设置了LOCAL_LISTENER,1522端口
SQL> show parameter list


NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string LISTENER_1
remote_listener string


---listener.ora里面的内容
[Oracle@node1 admin]$ more listener.ora
# listener.ora Network Configuration File: /oracle/app/oracle/db/network/admin/listener.ora
# Generated by Oracle configuration tools.


LISTENER_1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.10)(PORT = 1522))
)


ADR_BASE_LISTENER_1 = /oracle/app/oracle


---tnsnames.ora里面的内容
LISTENER_1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.10)(PORT = 1522))
)
)
目前数据库状态正常

 


现在删除tnsnames。ora,启动数据库
SQL> ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_1
数据库报错,说明数据库在启动的时候是通过tnsnames.ora去解析LOCAL_LISTENER的


step2:修改tnsnames。ora的内容给他一个错误的IP地址
[oracle@node1 admin]$ vi tnsnames.ora


LISTENER_1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.17)(PORT = 1522))
)
)
1.1.1.17为错误的IP
SQL> startup
ORACLE instance started.


Total System Global Area 1054593024 bytes
Fixed Size 1349616 bytes
Variable Size 507512848 bytes
Database Buffers 541065216 bytes
Redo Buffers 4665344 bytes
Database mounted.
Database opened.
SQL>
数据库能正常启动

 


SQL> !ps -ef | grep tns
oracle 3219 1 0 21:26 ? 00:00:00 /oracle/app/oracle/db/bin/tnslsnr LISTENER_1 -inherit
oracle 4125 3881 0 21:40 pts/1 00:00:00 /bin/bash -c ps -ef | grep tns
oracle 4127 4125 0 21:40 pts/1 00:00:00 /bin/bash -c ps -ef | grep tns


SQL> !lsnrctl status LISTENER_1


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 30-SEP-2013 21:40:25


Copyright (c) 1991, 2011, Oracle. All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=1.1.1.10)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER_1
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 30-SEP-2013 21:26:50
Uptime 0 days 0 hr. 13 min. 34 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/db/network/admin/listener.ora
Listener Log File /oracle/app/oracle/diag/tnslsnr/node1/listener_1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=1.1.1.10)(PORT=1522)))
The listener supports no services
The command completed successfully


SQL>

 


没有服务注册到listener


step3:修改tnsnames.ora的内容为正确的IP


重新启动listener
[oracle@node1 admin]$ lsnrctl stop LISTENER_1
[oracle@node1 admin]$ lsnrctl start LISTENER_1


SQL> alter system register;


System altered.


SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@node1 admin]$ lsnrctl status LISTENER_1


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 30-SEP-2013 21:43:03


Copyright (c) 1991, 2011, Oracle. All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=1.1.1.10)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER_1
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 30-SEP-2013 21:42:30
Uptime 0 days 0 hr. 0 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/db/network/admin/listener.ora
Listener Log File /oracle/app/oracle/diag/tnslsnr/node1/listener_1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=1.1.1.10)(PORT=1522)))
The listener supports no services
The command completed successfully


还是不行
[oracle@node2 admin]$ sqlplus vic@vic2


SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 30 21:43:32 2013


Copyright (c) 1982, 2011, Oracle. All rights reserved.


Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


客服端也无法连接,说明重启listner对不会读取tnsnames。ora的内容。

接下来请看第2页精彩内容

 

相关阅读:

Oracle数据库中listener.ora sqlnet.ora tnsnames.ora的区别

Oracle RAC 下非缺省端口监听配置(listener.ora tnsnames.ora) 

Oracle RAC 监听配置 (listener.ora tnsnames.ora)

Oracle: listener.ora 、sqlnet.ora 、tnsnames.ora的配置及例子

Oracle本地命名服务tnsnames.ora配置

linux

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
在MySQL中使用視圖的局限性是什麼?在MySQL中使用視圖的局限性是什麼?May 14, 2025 am 12:10 AM

mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

確保您的MySQL數據庫:添加用戶並授予特權確保您的MySQL數據庫:添加用戶並授予特權May 14, 2025 am 12:09 AM

porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

哪些因素會影響我可以在MySQL中使用的觸發器數量?哪些因素會影響我可以在MySQL中使用的觸發器數量?May 14, 2025 am 12:08 AM

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

mysql:存儲斑點安全嗎?mysql:存儲斑點安全嗎?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

mySQL:通過PHP Web界面添加用戶mySQL:通過PHP Web界面添加用戶May 14, 2025 am 12:04 AM

通過PHP網頁界面添加MySQL用戶可以使用MySQLi擴展。步驟如下:1.連接MySQL數據庫,使用MySQLi擴展。 2.創建用戶,使用CREATEUSER語句,並使用PASSWORD()函數加密密碼。 3.防止SQL注入,使用mysqli_real_escape_string()函數處理用戶輸入。 4.為新用戶分配權限,使用GRANT語句。

mysql:blob和其他無-SQL存儲,有什麼區別?mysql:blob和其他無-SQL存儲,有什麼區別?May 13, 2025 am 12:14 AM

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

mySQL添加用戶:語法,選項和安全性最佳實踐mySQL添加用戶:語法,選項和安全性最佳實踐May 13, 2025 am 12:12 AM

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

MySQL:如何避免字符串數據類型常見錯誤?MySQL:如何避免字符串數據類型常見錯誤?May 13, 2025 am 12:09 AM

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollat​​ionsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具