创建数据库test
1.打开Oracle net manager
2.服务命名:test
tcpip 主机:127.0.0.1 端口:1521
3.监听程序
选择 监听位置
网络地址:localhost
端口:1521
选择 数据库服务
全局数据库名 SID: test
4.停止监听服务 启动监听服务
# listener.ora Network Configuration File: E:appAdministratorproduct11.1.0db_1NETWORKADMINlistener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(SID_NAME = test)
)
(SID_DESC =
(GLOBAL_DBNAME = NBS)
(SID_NAME = NBS)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
2个数据库服务一个test,一个NBS,公用一个监听
# tnsnames.ora Network Configuration File: E:appAdministratorproduct11.1.0db_1NETWORKADMIN nsnames.ora
# Generated by Oracle configuration tools.
test=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test)
)
)
NBS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NBS)
)
)
客户端无法访问服务器 Oracle 出现12541错误
C:WindowsSystem32driversetc
修改hosts
10.50.180.123 andyzc
服务器ip 主机名
然后在listener.ora将localhost改为andyzc
cmd-》tsnping andyzc
出现ok就可以用客户端连接到服务器了