本文介紹了ORA-12154 TNS:無法解析安裝APEX時指定的連接標識符的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在Azure上有RHEL 6.8 Oracle版本,我按照Microsoft的教程Create an Oracle Database in an Azure VMe在上面安裝了數據庫。教程進行得很順利。現在我嘗試用這個Oracle Application Express (APEX) 5.x Installation安裝APEX,但我在CONN sys@pdb1 AS SYSDBA
行被卡住了。
輸入密碼(是否正確無關緊要)后,我每次都會收到ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
。
我已嘗試:
創(chuàng)建變量TNS_ADMIN
將ORACLE_HOME/network/admin
添加到PATH
創(chuàng)建和編輯文件:
listener.ora:
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = OracleDbVm)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
sqlnet.ora:
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
tnsnames.ora:
WINDOWNETSERVICE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = OracleDbVm)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = cdb1)
)
)
lsnrctl狀態(tài)輸出
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 26-JUL-2017 09:02:06
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=OracleDbVm)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 25-JUL-2017 23:19:33
Uptime 0 days 9 hr. 42 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/OracleDbVm/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=OracleDbVm.{some_values}.ax.internal.cloudapp.net)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=OracleDbVm.{some_values}.ax.internal.cloudapp.net)(PORT=5502))(Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0/dbhome_1/admin/cdb1/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "cdb1" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb1XDB" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
The command completed successfully
我的env輸出:
[oracle@OracleDbVm admin]$ env
HOSTNAME=OracleDbVm
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
OLDPWD=/home/oracle
USER=oracle
LS_COLORS={colors_long_values}
ORACLE_SID=cdb1
TNS_ADMIN=/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
MAIL=/var/spool/mail/oracle
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin:/u01/app/oracle/product/12.1.0/dbhome_1/bin:/home/oracle/bin
PWD=/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
LANG=en_US.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HISTCONTROL=ignoredups
SHLVL=1
HOME=/home/oracle
LOGNAME=oracle
LESSOPEN=||/usr/bin/lesspipe.sh %s
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
G_BROKEN_FILENAMES=1
_=/bin/env
我還能做些什么來解決該問題?
推薦答案
您的CONN sys@pdb1 AS SYSDBA
正在嘗試使用pdb1
的SID(或tnsname條目)連接到一個實例,但在多租戶環(huán)境中,您的所有數據庫共享相同的SID(在您的情況下為cdb1
),并且您的tnsname中沒有pdb1
條目。連接到PDB時,您需要在連接字符串中使用服務名稱。
您可以這樣更新您的tnsname:
WINDOWNETSERVICE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = OracleDbVm)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = cdb1)
)
)
pdb1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=OracleDbVm)
(PORT=1521)
)
(CONNECT_DATA=
(SERVICE_NAME=pdb1)
)
)
然后重試CONN sys@pdb1 AS SYSDBA
…
或者您可以嘗試使用帶有服務名稱的完整連接字符串,如:
conn sys@OracleDbVm:1521/pdb1 as sysdba
我認為您也可以連接到CDB,切換到pdb1,然后啟動腳本。如果您需要有關該選項的更多詳細信息,請與我聯(lián)系。
這篇關于ORA-12154 TNS:無法解析安裝APEX時指定的連接標識符的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,