Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Oracle [игнор отключен] [закрыт для гостей] / ORA-12154: TNS:could not resolve the connect identifier specified / 9 сообщений из 9, страница 1 из 1
11.09.2017, 14:58
    #39519229
Петров Андрей
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Настраиваю клиента на виртуалке.
TNSPing проходит.
Но при попытке соединиться через SQLPLus получаю: ORA-12154: TNS:could not resolve the connect identifier specified
С другой машины спокойно соединяюсь.
Куда смотреть?
...
Рейтинг: 0 / 0
11.09.2017, 15:07
    #39519238
Vadim Lejnin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Петров АндрейНастраиваю клиента на виртуалке.
TNSPing проходит.
Но при попытке соединиться через SQLPLus получаю: ORA-12154: TNS:could not resolve the connect identifier specified
С другой машины спокойно соединяюсь.
Куда смотреть?
Сколько ORACLE_HOME на клиенте?
tnsping откуда вызывается,
сколько TNSnames.ora ?

Ну и как обгонял, как подрезал...
Команды, вывод, файлы sqlnet.ora, tnsnames.ora
Не в пересказе, а в виде текста оформленного ТЭГами форума SRC/spoiler - если большие
...
Рейтинг: 0 / 0
11.09.2017, 15:42
    #39519272
Петров Андрей
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
авторСколько ORACLE_HOME на клиенте?
3

авторtnsping откуда вызывается,
Из командной строки.

авторсколько TNSnames.ora ?
1


# sqlnet.ora Network Configuration File: C:\ORacle\product\11.2.0\client_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)



DATA1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.43)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = app)
)
)
...
Рейтинг: 0 / 0
11.09.2017, 16:07
    #39519289
Vadim Lejnin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Петров Андрей,

sqlplus не может разрешить TNS строку соединения
ошибка парсинга файла, или его нет совсем

Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
$ oerr ora 12154
12154, 00000, "TNS:could not resolve the connect identifier specified"
// *Cause:  A connection to a database or other service was requested using
// a connect identifier, and the connect identifier specified could not
// be resolved into a connect descriptor using one of the naming methods
// configured. For example, if the type of connect identifier used was a
// net service name then the net service name could not be found in a
// naming method repository, or the repository could not be
// located or reached.
// *Action:
//   - If you are using local naming (TNSNAMES.ORA file):
//      - Make sure that "TNSNAMES" is listed as one of the values of the
//        NAMES.DIRECTORY_PATH parameter in the Oracle Net profile
//        (SQLNET.ORA)
//      - Verify that a TNSNAMES.ORA file exists and is in the proper
//        directory and is accessible.
//      - Check that the net service name used as the connect identifier
//        exists in the TNSNAMES.ORA file.
//      - Make sure there are no syntax errors anywhere in the TNSNAMES.ORA
//        file.  Look for unmatched parentheses or stray characters. Errors
//        in a TNSNAMES.ORA file may make it unusable.
//   - If you are using directory naming:
//      - Verify that "LDAP" is listed as one of the values of the
//        NAMES.DIRETORY_PATH parameter in the Oracle Net profile
//        (SQLNET.ORA).
//      - Verify that the LDAP directory server is up and that it is
//        accessible.
//      - Verify that the net service name or database name used as the
//        connect identifier is configured in the directory.
//      - Verify that the default context being used is correct by
//        specifying a fully qualified net service name or a full LDAP DN
//        as the connect identifier
//   - If you are using easy connect naming:
//      - Verify that "EZCONNECT" is listed as one of the values of the
//        NAMES.DIRETORY_PATH parameter in the Oracle Net profile
//        (SQLNET.ORA).
//      - Make sure the host, port and service name specified
//        are correct.
//      - Try enclosing the connect identifier in quote marks.
//
//   See the Oracle Net Services Administrators Guide or the Oracle
//   operating system specific guide for more information on naming.



причина:
Либо нет файла tnsnames.ora в соответствующей ORACLE_HOME либо нет такой записи (она, или предыдущая запись кривая) tnsnames.ora

Как вариант

Почему tnsping работает, а sqlplus - нет
Либо
tnsping и sqlplus у тебя вызываются из разных ORACLE_HOME и у них разные tns файлы

Покажи как вызываешь
tnsping и sqlplus

правильно (для твоего примера):
Код: plsql
1.
2.
3.
4.
tnsping DATA1
sqlplus user/pass@DATA1
sqlplus user/pass@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.20.43)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=app)))"



Последняя строчка tns файлы не использует совсем и служит для проверки синтаксиса записи


Либо скопируй tnsnames во все файлы
Либо определи в переменных окружения системы
Код: plsql
1.
TNS_ADMIN=<директория где oracle будет искать TNS файлы>



В этом случае, все ORACLE_HOME будут использовать одни файлы
(есть нюансы с sqlnet.ora)
...
Рейтинг: 0 / 0
11.09.2017, 17:31
    #39519376
Петров Андрей
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Неправильно написал, SQLPlus тоже коннектится.
Но вот при коннекте ADO из VBS получаю: TNS-12154
Коннект прописан вот так:
Код: vbnet
1.
strCon = "Driver={Oracle in OraClient11g_home1};Dbq=DATA1;Uid=Login;Pwd=Pass;"



При этом на соседней машине работает...
...
Рейтинг: 0 / 0
11.09.2017, 17:38
    #39519387
Vadim Lejnin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Петров АндрейНеправильно написал, SQLPlus тоже коннектится.
Но вот при коннекте ADO из VBS получаю: TNS-12154
Коннект прописан вот так:
Код: vbnet
1.
strCon = "Driver={Oracle in OraClient11g_home1};Dbq=DATA1;Uid=Login;Pwd=Pass;"



При этом на соседней машине работает...

OraClient11g_home1 - смотри в ней TNSNAMES.ora

Для проверки


Код: plsql
1.
2.
3.
4.
cmd.exe
set ORACLE_HOME=<Директория OraClient11g_home1>
set PATH=%ORACLE_HOME%\bin;%PATH%
sqlplus user/pass@data1




Либо попробуй явно:

Код: plsql
1.
strCon = "Driver={Oracle in OraClient11g_home1};Dbq=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.20.43)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=app)));Uid=Login;Pwd=Pass;"
...
Рейтинг: 0 / 0
11.09.2017, 18:08
    #39519413
Петров Андрей
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
sqlplus коннектится и без шаманства.
А вот из ADO что с прописыванием полной строки без TNSNames что с ней дает TNS-12154
Может куда достпов не хватает? Или пути не прописаны именно для ADO?
...
Рейтинг: 0 / 0
11.09.2017, 18:19
    #39519421
Vadim Lejnin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Петров Андрейsqlplus коннектится и без шаманства.
А вот из ADO что с прописыванием полной строки без TNSNames что с ней дает TNS-12154
Может куда достпов не хватает? Или пути не прописаны именно для ADO?
sqlplus из какой директории?
Еще раз:
1) Каждая ORACLE_HOME, по умолчанию имеет свои собственные настройки
%ORACLE_HOME%\NETWORK\ADMIN

2) Когда ты вызываещь sqlplus - то вызывается первый sqlplus.exe найденный либо в текущей директории, либо в PATH
не факт что это будет sqlplus из OraClient11g_home1

Именно поэтому я и предлагал запустить проверку как указал выше
...
Рейтинг: 0 / 0
11.09.2017, 18:39
    #39519441
Vadim Lejnin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ORA-12154: TNS:could not resolve the connect identifier specified
Ага, все просто:
Длинную строку не есть из-за BUG

MOS Note: ORA-12154 When Using Long SQLNET Alias in DBQ Property of ODBC Connection String or TNS Service Name of DSN (Doc ID 1340407.1)...
BUG:12780172 - PASSING A LONG SQL NET ALIAS IN THE DBQ PROPERTY CAUSES A ORA-12154
BUG:6272483 - PASSING A LONG SQL NET ALIAS IN THE DBQ PROPERTY CAUSES AN ACCVIO
NOTE:239175.1 - Example Connection Strings for use With Oracle Programmatic Interfaces on Windows
...


так что настраивай либо tnsnames.ora либо EZConnect string:

Код: plsql
1.
2.
192.168.20.43/app
strCon = "Driver={Oracle in OraClient11g_home1};Dbq=//192.168.20.43:1521/app;Uid=Login;Pwd=Pass;"
...
Рейтинг: 0 / 0
Форумы / Oracle [игнор отключен] [закрыт для гостей] / ORA-12154: TNS:could not resolve the connect identifier specified / 9 сообщений из 9, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]