客戶端工具plsql developer 鏈接Windows上的tnsname - NEW ,再通過NEW去鏈接linux上的監(jiān)聽。去鏈接數(shù)據(jù)庫
創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供吳川網(wǎng)站建設(shè)、吳川做網(wǎng)站、吳川網(wǎng)站設(shè)計(jì)、吳川網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、吳川企業(yè)網(wǎng)站模板建站服務(wù),10年吳川做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
1 查看監(jiān)聽狀態(tài)
[oracle@dan ~]$ lsnrctl status
監(jiān)聽中3個(gè)必不可少的:ip、端口號(hào)、service。說明linux監(jiān)聽正常。所以我們通過xshall是通過密碼文件可以鏈接進(jìn)入數(shù)據(jù)庫的
[oracle@dan ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Mar 8 20:59:48 2020
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
如果要走網(wǎng)絡(luò)的話,就需要下面的tnsnames.ora
2 查看linux上的listener.ora
[oracle@dan admin]$ pwd
/u01/app/oracle/product/11.2/db_1/network/admin/
[oracle@dan admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = dan)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
從listener.ora可以看出ip和端口號(hào),但是看不到服務(wù)
2 查看linux上的tnsnames.ora,沒有的話,可以手工添加
NEW=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
192.168.56.56)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME =
orcl)
)
)
走網(wǎng)絡(luò)驗(yàn)證:
[oracle@dan admin]$ sqlplus system/oracle@NEW
SQL*Plus: Release 11.2.0.4.0 Production on Sun Mar 8 21:22:53 2020
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
SQL>
能進(jìn)入 ,說明tnsnames.ora沒有問題。
如果不能進(jìn)入,先查看防火墻,
service iptables status
sestatus
如果都關(guān)閉了,再就需要驗(yàn)證ip、端口、服務(wù)
[oracle@dan admin]$ pin
g 192.168.56.56
[oracle@dan admin]$ telnet 192.168.56.56 1521
服務(wù)的話,就通過查看監(jiān)聽lsnrctl stauts 中的service 查看。
同樣也可以驗(yàn)證串名:
[oracle@dan admin]$ tnspin g NEW
最后的最后。文件名一定要記住是tnsnames.ora 。。。。。。是有s的。這個(gè)搞了很傻
1 在本地的E:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN 也有個(gè)tnsnames.ora文件??蛻舳斯ぞ呔褪峭ㄟ^Windows的tnsnames去鏈接的linux的監(jiān)聽,再 去鏈接數(shù)據(jù)庫
2 查看Windows的tnsnames
NEW=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.56)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
這里其實(shí)和linux上的一致,其實(shí)要鏈接psd的話,沒有l(wèi)inux上的tnsnames也可以,因?yàn)閃indows是鏈接的linu上的監(jiān)聽。監(jiān)聽的3要素:ip、端口、service
3 如果psd鏈接不通,就要驗(yàn)證ip、端口、service
a)驗(yàn)證ip。沒有問題
b)驗(yàn)證端口號(hào),從上面linux上的監(jiān)聽狀態(tài)lsnrctl status,知道端口號(hào)是1521。能進(jìn)入說明端口號(hào)1521也沒有問題。
c)服務(wù)
本地中的(SERVICE_NAME = orcl) 和linux上的監(jiān)聽狀態(tài)中的series是一致的。
這時(shí)候,psd就能通過本地的鏈接串NEW鏈接到數(shù)據(jù)庫了
但是sys用戶始終是不能鏈接
[oracle@dan admin]$ sqlplus sys/oracle@NEW as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Mar 8 21:46:41 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
Enter user-name: EXIT
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
難道是sys密碼錯(cuò)誤?
SQL> alter user sys identified by oracle;
User altered.
[oracle@dan admin]$ sqlplus sys/oracle@NEW as sysdba
但是還是同樣的錯(cuò)誤,后來,sys用戶是特殊的用戶。是需要特殊的密碼文件,在$ORALE_HOME/dbs里
[oracle@dan admin]$ cd $ORACLE_HOME/dbs
[oracle@dan dbs]$ ll
total 97884
-rw-rw----. 1 oracle dba 1544 Mar 8 16:56 hc_orcl.dat
-rw-r--r--. 1 oracle dba 2851 May 15 2009 init.ora
-rw-r-----. 1 oracle dba 24 Mar 8 12:06 lkORCL
-rw-r-----. 1 oracle dba 3584 Mar 8 16:26 spfileorcl.ora
里面就沒有orapw文件。所以通過網(wǎng)絡(luò)一直登陸不上
[oracle@dan dbs]$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=oracle force=y;
驗(yàn)證
[oracle@dan dbs]$ sqlplus sys/oracle@NEW as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Mar 8 21:55:05 2020
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
應(yīng)該是沒有問題了,去psd驗(yàn)證一下
也可以用 ip:端口號(hào)/service name
完成
網(wǎng)頁名稱:psd鏈接本地tnsnames
文章起源:http://jinyejixie.com/article12/jdohdc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、定制網(wǎng)站、網(wǎng)站收錄、虛擬主機(jī)、響應(yīng)式網(wǎng)站、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)