我已經成功設定了我的資料庫,我可以透過我的網站 wxplorer 進行一些查詢
http://localhost:8080/apex/f?p=4500:1003:1042268341573744::否:::
但是,當我下載帶有 jdk 包的 4.1.5 Sql Developer 時,當我單擊“新建連接”時,我輸入: 連接名稱:MYONLINEEDU_XE 用戶名:MYONLINEEDU 密碼:admin123
當我單擊“連接”時,出現錯誤:
狀態:失敗 - 測試失敗:偵聽器拒絕連接,並出現以下錯誤:ORA-12505,TNS:偵聽器目前不知道連接描述符中給出的 SID
在我的路徑 C:\app\Stefan\product\11.2.0\dbhome_1\NETWORK\ADMIN 這是我的 tnsnames (我新增了 orcl 設定):
# tnsnames.ora Network Configuration File: C:\app\Stefan\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE NAME = orcl)
)
)
我甚至嘗試啟動 LSNRCTL 服務,但它已經啟動了。
LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:16 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: STEFAN-PC, pid: 2664>
(ADDRESS=(PROTOCOL=tcp)(HOST=STEFAN-PC)(PORT=18879))
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:71 refused:0 state:ready
LOCAL SERVER
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: STEFAN-PC, pid: 5228>
(ADDRESS=(PROTOCOL=tcp)(HOST=STEFAN-PC)(PORT=1547))
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
另外在我的 system32/hosts 中我加入了 127.0.0.1 localhost
如何消除此錯誤並連接到我的資料庫?
謝謝!
答案1
將 Oracle SQL Developer 連線到資料庫時可能會遇到的錯誤:
無效的使用者名稱/密碼 - 確保您使用
uname/pwd
用於存取資料庫的slqplus
.字串索引超出範圍 - 您是否嘗試連接到錯誤的連接埠?也許22?檢查監聽埠/轉送埠
偵聽器拒絕連線。未知的 SID。 - 確保您使用正確的系統 ID。
透過 SSH 進入遠端資料庫並切換到資料庫使用者。檢查 Oracle SID:
echo $ORACLE_SID
啟動 Oracle SQL Developer
點擊綠色的+號會彈出新的連接選單。
Connection Name: XYZ_Oracle
Username: Oracle_db_username
Password: pwd_for_db_username
Connection type: Basic
Role: Default
Hostname: XXX.XX.XX.XX (Remote IP)
Port: 1521 (the forwarded port)
SID: the Odarcle SID of the particular DB you want to access aka db name
按Test
按Connect