我在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
都会收到。
我已经尝试过了:
TNS_ADMIN
ORACLE_HOME/network/admin
添加到PATH
的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状态
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
我可以做些什么来解决这个问题?
答案 0 :(得分:1)
您的CONN sys@pdb1 AS SYSDBA
正在尝试连接到具有pdb1
的SID(或tnsnames条目)的实例,但在多租户环境中,所有数据库共享相同的SID(cdb1
in您的情况),并且您的tnsnames中没有pdb1
条目。连接到PDB时,您需要使用连接字符串中的服务名称。
你可以像这样更新你的tnsnames:
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,然后启动脚本。如果您想了解有关该选项的更多详细信息,请与我们联系。