使用TWO_TASK或者LOCAL环境变量?

简介: 前一阵子,我遇到一个问题:rman target /链接如下:http://www.itpub.net/thread-1167136-1-1.html执行错误,必须输入rman target sys/xxx@yyy 我记得我以前学习安装oracle 8i的时候,...
前一阵子,我遇到一个问题:
rman target /
链接如下:
http://www.itpub.net/thread-1167136-1-1.html
执行错误,必须输入rman target sys/xxx@yyy

我记得我以前学习安装oracle 8i的时候,遇到的一个问题,就是ora-12560错误,就是在通过远程桌面登录服务器执行无法执行sqlplus user/passwd,必须加入sqlplus user/passwd@net_name.

关于这个问题,如果google,在许多地方都可以看到这个问题的解决ora-12560,实际上当时我测试过,许多是无效的.如果使用远程桌面,至少在当时我没有解决这个问题的.今天测试终于知道答案,链接如下:

http://davidyu720.itpub.net/post/31716/470434
ORACLE8i本地登录错误ORA-12560: TNS: 协议适配器错误
Windows2003上的ORACLE817,在服务器上不使用连接串登录,直接用SQLPLUS或SVRMGRL本地登录,却报错误ORA-12560: TNS: 协议适配器错误。
找到原因:这是一台终端服务器,在远处终端中登录OS--再登录数据库时,会提示ORA-12560错误。直接在控制台中登录OS--再登录数据库时就正常。
解决办法:无--也许这是8i自己的问题吧。同样的Windows环境下,9i就没有问题--因此就懒得找解决办法了。

我通过vnc登录服务器,确实可以在服务端执行sqlplus user/passwd.而通过远程桌面确实不行.

我记得当时在新闻组提问,对方给出的解决就是定义LOCAL环境变量,当时一试验真的可以,也没有再去想这个问题.

这样在执行rman出错的时候,我自己也习惯的采用定义LOCAL变量的方式,至于这个变量的值是什么我自己也不清楚,我一直以为是oracle_sid. 在sqlplus时发现我发现连接的数据库是远程的数据库,因为我本机的10g,而远程的数据库是8i.

当时事情太多,心里仅仅想着快点解决rman target /的问题.

今天看书,才发现P428页:
有如下论述:

Using the TWO_TASK Environment Variable
You can bypass the use of an Oracle Net name by setting the TWO_TASK environment variable (on UNIX/Linux) or the LOCAL environment variable (on Windows).
The TWO_TASK environment variable specifies the connect string for connecting to a remote machine. SQL*Net will check the value of the TWO_TASK environment variable and automatically
add it to your connect string, as shown in the following example:
$ export TWO_TASK=mydb
Once you set the TWO_TASK environment variable, you can connect to the mydb database in the
following way:
$ sqlplus scott/tiger
Note that you didn’t have to use the specification sqlplus scott/tiger@mydb, since you’re using the TWO_TASK variable.On a Windows server, the following is the equivalent for setting the TWO_TASK environment variable:
$ SET LOCAL=
$ sqlplus scott/tiger

按照这个的介绍,如果我定义TWO_TASK(linux)或者LOCAL(windows)等于某个net_name,就可以实现在输入sqlplus 不需要在输入@net_name参数(当然服务端监听一定要起来的情况修下).测试一下,果然可以!

目录
相关文章
Cannot lock pid file /usr/local/freeswitch/run/freeswitch.pid.
Cannot lock pid file /usr/local/freeswitch/run/freeswitch.pid.
189 0
|
9天前
|
Linux 网络安全 iOS开发
/config --prefix=/usr/local/ssl --shared 命令里的参数的作用
【4月更文挑战第18天】/config --prefix=/usr/local/ssl --shared 命令里的参数的作用
21 3
|
11月前
执行 `s local invoke` 命令时,如果出现报错
执行 `s local invoke` 命令时,如果出现报错
25 1
|
Java 应用服务中间件
VM启动tomcat /usr/local/tomcat/bin/catalina.sh: line 501: /usr/local/jdk/bin/java: Permission denied
VM启动tomcat /usr/local/tomcat/bin/catalina.sh: line 501: /usr/local/jdk/bin/java: Permission denied
116 0
VM启动tomcat /usr/local/tomcat/bin/catalina.sh: line 501: /usr/local/jdk/bin/java: Permission denied
未解决:lrelease: could not exec ‘/usr/lib/qt5/bin/lrelease‘: No such file or directory
未解决:lrelease: could not exec ‘/usr/lib/qt5/bin/lrelease‘: No such file or directory
143 0
|
JavaScript 测试技术
env文件里小心$
env文件里小心$
79 0
env->FindClass()为NULL的一种解决办法
env->FindClass()为NULL的一种解决办法
80 0
|
开发工具 git
/usr/bin/env: escript: No such file or directory的解决办法
/usr/bin/env: escript: No such file or directory的解决办法
382 0
|
JavaScript
process.env 是什么?
process对象是一个全局变量,提供了有关当前 Node.js 进程的信息并对其进行控制。 作为全局变量,它始终可供 Node.js 应用程序使用,无需使用 require()。 它也可以使用 require() 显式地访问。