SID是数据库的唯一标识符
SERVICENAME是网络服务名,可以随意设置,相当于某个数据库实例的别名方,便记忆和访问
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.254.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl) // SID
)
SERVICENAME是网络服务名,可以随意设置,相当于某个数据库实例的别名方,便记忆和访问
例如:在机器A上装了oracle 10g,如何在机器B上用SQLPlus登陆?
答:B机安装Oracle客户端,使用Net Configuration Assistant配置一个本地服务名,也可以在tnsnames.ora中配置
NETWORKSERVICE =(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.254.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl) // SID
)
)
然后在cmd中输入:sqlplus username/password@NETWORKSERVICE
例如:使用expdb导出数据库
expdp ubssdic/ubssdic@NETWORKSERVICE DIRECTORY=expdp DUMPFILE=dumpfile.dmp FULL=y LOGFILE=logger.log
如果在Oracle服务器上配置了系统变量set ORACLE_SID=orcl,则在Oracle服务器本机上可以不通过网络服务名进行导出
expdp ubssdic/ubssdic DIRECTORY=expdp DUMPFILE=dumpfile.dmp FULL=y LOGFILE=logger.log