sqlplus user/passwd@server_name @filename
server_name 是配置在tnsname.ora中,也可以用net manager配置
APLOI2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = fitwsnydb1d.nam.nsroot.net)(PORT = 1523))
)
(CONNECT_DATA =
(SID = APLOI2)
)
)filename中的内容每个语句应该以斜杠'/'结束
bat例子:
echo process %1 %2
set SERVER=%1
set DB=%2
set SQLPATH=tbl
echo process %SQLPATH%
sqlplus运行sql文件后自动退出的方法
很简单,不过在批处理中很容易写成
sqlplus username/[email protected]
exit
结果sqlplus没有退出,exit这个动作并没有被执行。
正确的写法应该是
echo exit | sqlplus username/[email protected]
cd %SQLPATH%\
for %%f in (*.tbl) do #isql -Uusername -Ppassword -S%SERVER% -D%DB% -i%%f
#sqlplus username/password@server_name @f
cd ..\
pause
标签:username,sqlplus,set,name,osql,echo,isql,Oracle,password
From: https://blog.51cto.com/u_16174476/6615907