我在服务器上安装了oracle 11.2.0。直到星期一,一切都很好。 现在我无法通过客户端,SQL Developer,SQL Plus连接到数据库。
服务器上的lsnrctl status :
#include <iostream>
#include <string.h>
#include <stdio.h>
void print(std::string var_name, const std::string &s)
{
const char *ps = s.c_str();
printf("[%s] value=%s, address=%p\n", var_name.c_str(), s.c_str(), ps);
}
int main()
{
std::string a = "ab;cd;ef;gh";
const std::string &b = a;
std::string c;
c = b;
print("a", a);
print("b", b);
print("c", c);
c[2] = 'z';
//char *temp = (char*)c.c_str();
//temp[2] = 'z';
print("a", a);
print("b", b);
print("c", c);
#if 0
std::cout << "a=" << a << std::endl;
std::cout << "b=" << b << std::endl;
std::cout << "c=" << c << std::endl;
//c[0] = 'z';
std::cout << "after change";
char *temp = (char*)c.c_str();
temp[2] = '1';
std::cout << "a=" << a << std::endl;
std::cout << "b=" << b << std::endl;
std::cout << "c=" << c << std::endl;
#endif
return 0;
}
tnsping DB:
C:\Users\User1>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 14-JAN-2016 09:21
:14
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVERNAME.DOMAIN)(PORT=1
521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 61: Unknown error
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Produ
ction
Start Date 13-JAN-2016 21:36:13
Uptime 0 days 11 hr. 48 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Administrator\product\11.2.0\dbhome_2\network\a
dmin\listener.ora
Listener Log File c:\app\administrator\diag\tnslsnr\SERVERNAME\listener\
alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(SERVERNAME.DOMAIN)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 2 handler(s) for this service...
Service "LAND3XDB" has 1 instance(s).
Instance "land3", status READY, has 1 handler(s) for this service...
Service "TEST3XDB" has 1 instance(s).
Instance "test3", status READY, has 1 handler(s) for this service...
Service "TESTT10XDB" has 1 instance(s).
Instance "testt10", status READY, has 1 handler(s) for this service...
Service "TESTXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "TEST_T10" has 1 instance(s).
Instance "testt10", status READY, has 1 handler(s) for this service...
Service "land3" has 1 instance(s).
Instance "land3", status READY, has 1 handler(s) for this service...
Service "test" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test3" has 1 instance(s).
Instance "test3", status READY, has 1 handler(s) for this service...
The command completed successfully
的 LISTENER.ORA
C:\Users\USER1>tnsping TEST3
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 14-JAN-2
016 09:25:55
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = SERVERNAME.DOMAIN)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (S
ERVICE_NAME = TEST3)))
TNS-12541: TNS:no listener
SQLNET.ORA
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_2)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_2\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_2)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_2\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME.DOMAIN)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = C:\app\Administrator
的tnsnames.ora
SQLNET.AUTHENTICATION_SERVICES = (NONE)
在日志C:\ app \ Administrator \ diag \ tnslsnr \ SERVERNAME \ listener \ alert:
TEST3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME.DOMAIN)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TEST3)
)
)
TEST_T10 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME.DOMAIN)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TEST_T10)
)
)
TEST3_X64 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME.DOMAIN)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TEST3)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LAND3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = LAND3)
)
)
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME.DOMAIN)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TEST)
)
)
所有服务都被删除了。 我不知道这有什么不妥。
答案 0 :(得分:1)
请做:
- 检查操作系统的主机名状态。
- 检查防火墙,Windows 64不禁止端口访问。
醇>
答案 1 :(得分:0)
此设置存在许多问题 - 例如,listener.ora中test3的侦听器SID / SERVICE_NAME定义在哪里?无论如何,你可以在Windows下没有特定的监听器定义而离开。
但是我觉得你的问题解决起来很简单,线索在这里:
Service "test3" has 1 instance(s).
Instance "test3", status READY, has 1 handler(s) for this service...
您的tnsnames.ora正在寻找服务名称TEST3
TEST3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME.DOMAIN)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TEST3)
)
)
替换
(SERVICE_NAME = TEST3)
带
(SID = test3)