oracle 配置服务端,类似我们配置java环境一样
防止乱码的配置:
变量名:NLS_LANG
变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK
选择数据库的配置(重要):
变量值:TNS_ADMIN
变量名:D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN(就是你的oracle安装的目录)
这是我的path配置:
D:\app\Administrator\product\11.2.0\dbhome_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
oracle有两个文件特别重要 listener,和tnsnames,在D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN文件夹下
修改后的文件:
listener:
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST =wangPC)(PORT = 1521))
)
)
ADR_BASE_LISTENER = D:\app\Administrator
tnsnames:
# tnsnames.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLE_105 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_117 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_j1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_164 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_130 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_211 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_135 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_136 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orclapp)
)
)
ORCL_200 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_j1200 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 公司数据库地址)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORACLE_204 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =公司数据库地址)(PORT = 1515))
)
(CONNECT_DATA =
(SERVICE_NAME = j1rep)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = wangPC)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
其中HOST=wangPC ,指的是计算机名,修改计算机名可自行百度,如有疑问可以给我留言
验证path的配置:
输入sqlplus
用户名:scott
口令(密码):tiger
注意,只要修改了这两个配置文件,一定要重启oracle服务,记住,一定要先启动OracleServiceORCL 再去启动OracleOraDb11g_home1TNSListener
顺序一定不能变,否则服务不能正常启动,会报监听找不到