flyonok

统计

留言簿(8)

ACE

book

boost

bsd

c study

c++

code download

codeblock

computer clound

Eclipse

embed system

erlang

ET++

gtk

ic card

java

KDE

libevent

linux

linux--MM

mysql

network education

one card

oracle

pcap relation

php

powerbuilder

python

QT

software config

software test

SQL server

UML

wireless

wxwidgets

陈宾

阅读排行榜

评论排行榜

oralce tips1 redhat--iptables

运行环境:rehl as 4.0,oracle.2.0.4

问题:在服务器上,运行oemapp console可以连接数据库,但在客户机上使用oem却不行,报错:ORA-12560: TNS: 协议适配器错误,各种配置均正常。

分析:经检查,服务器配置均正常,客户端参数也没问题

解决:经过数次痛苦折腾,艰难探究,终于顿悟,是防火墙!rehl 4.0启动了防火墙,挡住了1521端口,放开后(1521:tcp),一切正常了。
具体操作:以root用户登陆服务器,执行命令:

                   system-config-securitylevel

                   增加开放端口:1521:tcp

                  配置文件的位置:/etc/sysconfig/system-config-securitylevel


 


痛定思痛,总结一下,并从网上搜来相关的参考资料如下:

相关资料:


红帽企业 Linux 4:防火墙配置 (本站联结,点击进入)



Q:今天遭遇ORA-12560: TNS: 协议适配器错误的问题,经过一番努力问题已经解决,与大家共享。
A:造成ORA-12560: TNS: 协议适配器错误的问题的原因有三个:
 1.监听服务没有起起来。windows平台个一如下操作:开始---程序---管理工具---服务,打开服务面板,
启动oraclehome92TNSlistener服务。
 2.database instance没有起起来。windows平台如下操作:开始---程序---管理工具---服务,打开服务面板,启动oracleserviceXXXX,XXXX就是你的database SID.
 3.注册表问题。regedit,然后进入HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0将该环境变量ORACLE_SI

D设置为XXXX,XXXX就是你的database SID.或者右几我的电脑,属性--高级--环境变量---系统变量--新建

,变量名=oracle_sid,变量值=XXXX,XXXX就是你的database SID.或者进入sqlplus前,在command line下

输set oracle_sid=XXXX,XXXX就是你的database SID.
经过以上步骤,就可以解决问题。



ORA-12560: TNS:protocol adapter error


Symptom:
When starting server manager the following error is generated:

ORA-12560: TNS:protocol adapter error occurred

Cause:
Oracle classify this as a ‘generic protocol adapter error’. In my experience it indicates that Oracle client does not know what instance to connect to or what TNS alias to use.

Possible Remedies:
If running on the server (or workstation) that is running the database (i.e. if the database is local to the machine) then try explicitly setting ‘ORACLE_SID’. e.g.
set ORACLE_SID=<sid>

and then try again. If this works then consider whether to make the change permanent by specifying it as a system variable.

(Possibly 8.1.5 and later:) If running on the server (or workstation) that is running the database then check that the service name ‘OracleService<SID>’ ties up with the actual database SID. If the database SID is changed without recreating the service then this can lead to this error. To recreate the service:

oradimxx -delete -sid <old-sid>

oradimxx -new -sid <SID> -intpwd <internal-password> AUTO -pfile <full-init-ora-filename>

Try setting the environment variable ‘LOCAL’ to the required connection alias (typically the database SID) and then try again. (I am informed that for UNIX systems the environment variable TWO_TASK should instead be used.) Do be sure that the application that is being used picks up the new environment variable setting. Setting this to an invalid connection alias will typically produce ORA-12154: TNS:could not resolve service name.

Ignore the error and try connecting by specifying explicitly which connection alias to use.

Check that the network connection between the client computer and the server has not failed. From the client try pinging the server. (For general guidance on troubleshooting general network connectivity problems click here.)

Brian Brooks (Encorus Technologies, USA) has highlighted a problem with DHCP. If the database server has its IP address dynamically allocated by DHCP then its IP address may change. This is not likely to be a problem on a local network where DNS will take care of name resolution issues, but where the database server is on a remote network and its IP address needs to be explicitly specified in the client's lmhosts file then this can be a problem because it requires periodic updates to the client's lmhosts file. If faced with this scenario then push to get the database server allocated a permanent IP address.

--------------------------------------------------------------------------------

Liew Shiang Chen (from Singapore) has contributed the following additional material on this error:

I encountered this problem a few times recently while setting up a test environment. I finally solved it when I stopped using terminal services to connect to the server during installation. An installation initiated at the physical console went without any problems for me. Also, I had to make sure the IIS server was stopped because a default installation would try to start up the Apache HTTP server for Oracle.

Using: Win2000 server, Oracle 8.1.7, not joined to the company domain.

Hope this would help others in the same spot.



有关ORA-12560: TNS:协议适配器错误 的问题

以前安装Oracle一般没有遇到类似问题, 只是在XP上面安装偶尔遇到, 这次在win2003和win2000 server上面分别安装, 都遇到同样问题, 进入数据库创建阶段, 图形界面停止, CPU占用100%, 利用任务管理器停止, 发现例程在服务当中已经注册, 利用oradim -delete -sid ... 删除以后, 重新启动机器, 利用数据库创建助手存盘BAT文件, 然后分析发现, 建立例程以后, 启动svrmgrl显示错误: ora-12560: tns: 协议适配器错误. 

在网络上面反复查询只有一个地方提示: 可能是因为Terminal Service的问题, 并且pcAnywhere等远程控制软件则没有问题, Oracle也不准备就此给出解决, 为此我禁止并且卸载了终端服务以后, 问题依旧存在, 此时监听器服务和先前创建的例程已经成功启动, 由于无法启动svrmgrl, 造成无法继续创建数据库, 各位能否给我一些建议和帮助. 
 
另外利用netstat -a 发现1521端口已经正在监听, 应该不会存在端口占用问题吧, 谁可以告诉我srmgrl启动分别经过哪些步骤, 哪一步造成12560错误???

回复: 有关ORA-12560: TNS:协议适配器错误 的问题

①.检查Terminal Service, 远程桌面是不是起因
②.环境变量set oracle_sid=需要的服务名
③.listener.ora, tnsnames.ora等内机器名或者IP地址是否正确
④.netstat –a检查端口是否被占用
⑤.检查注册表HKEY_LOCAL_MACHINE\Software\Oracle\Home0新增字符串USE_SHARED_SOCKET=TRUE, 重新启动服务



Oracle客户端穿过防火墙连接服务器 


Oracle客户端连接服务器,首先去找1521监听端口,服务器的1521监听端口再向server process进程发出请求,并返回一个随机端口,返回给客户端,客户端再来连接这个端口。

这样就给服务器上的防火墙设置带来了麻烦,这个端口是随机的,如何开放? 

windows 平台上的这个问题成了一大难题,很多论坛都有人问,但很少有人能解决。 unix平台不用担心,系统自动会解决这个问题.

Matalink上提供了三种解决办法,实际上USE_SHARED_SOCKET 是最有效最方便的。

但经过无数次实现,仍然没有成功,最后终于发现是Oracle 8.1.7的bug

需要打补丁,升级到Oracle 8.1.7.1.2


问题解决, 看起来还是要靠自己, 还有E文资源找到的, 简体的是不指望了.

我的问题终于解决,原来原因是:
我的服务器开了防火墙导致端口不能连接,关掉防火墙后就好了,否则提示TNS-12560: TNS: 协议适配器错误



Oracle客户端穿过防火墙连接服务器

原文网址:http://www.cnblogs.com/liangqihui/archive/2005/09/07/231685.html

Oracle客户端穿过防火墙连接服务器 

Oracle客户端连接服务器,首先去找1521监听端口,服务器的1521监听端口再向server process进程发出请求,并返回一个随机端口,返回给客户端,客户端再来连接这个端口。

这样就给服务器上的防火墙设置带来了麻烦,这个端口是随机的,如何开放? 

windows 平台上的这个问题成了一大难题,很多论坛都有人问,但很少有人能解决。 unix平台不用担心,系统自动会解决这个问题.

Matalink上提供了三种解决办法,实际上USE_SHARED_SOCKET 是最有效最方便的。

但经过无数次实现,仍然没有成功,最后终于发现是Oracle 8.1.7的bug

需要打补丁,升级到Oracle 8.1.7.1.2


需要在MTS模式下(共享模式)

Oracle默认是专用模式。

经试验发现,如果不在init文件中设参数的话,Oracle仍然会要求一个随机端口和1521端口来共同通讯,只是这个随机端口,并不随客户端会话和登录的变化而变化,在没有重启服务器时,是固定的。

(试验发现,在专用模式下,每次连接,oracle服务器会按+1方式,提供一个非1521的端口。)

所以,还需要在init.ora文件的最后加上一条参数:

mts_dispatchers="(address=(protocol=tcp)(host=myoradb)(port=1521))(dispatchers=1)"

这样才真正实现只用一个端口,穿过防火墙。


Oracle uses dynamic ports under windows NT because of a bug in windows, so oracle can't use shared sockets. This bug got fixed with service pack 3 I think. By default, oracle uses the dynamic ports without caring which service pack is installed. There is a registry setting to force oracle to use shared sockets. The parameter is (what a surprise!) USE_SHARED_SOCKET in LOCAL_MACHINE\Software\Oracle\HomeX where X is your desired homedir. This parameter should be set to TRUE. There's a whitepaper from oracle for this too, somewhere on their site. Anyway, this parameter doesnt work for 8.1.7 Some users reported that it worked with 8.1.6.3, but 8.1.7 termiates every conection immediately...


Contributed by Arne Brutschy ( abrutschy@xylon.de ) on July 5, 2001.


Actually, I want to establish a replication system in my local machine.. for replicating objects(tables) from remote database to a local database... what data security option i must take in to account. I request you to give me the detail description like which protocal must be used and what parameter must be set in init.ora file,sqlnet.ora and listener.ora file and what other steps to be taken... I would be very thankful to you ... if you kindly describe the things...actually i want to maintain the data privacy which happens between remote and local database while replication take place.. any one can trap the net and extract the data ... so i need to stop that.  

I would be very thankful to you ... this is a request.. please mail me on the address p_v_raju73@rediffmail.com .  

regards p.v.raju

Contributed by pvraju ( p_v_raju73@rediffmail.com ) on October 8, 2001.

Modify Windows registry.
 

USE_SHARED_SOCKET = TRUE  

- Oracle 8.1.6 for NT/2k \\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME<#> (# is your desired homedir)

- Oracle 8.1.7.0.0 for NT/2k Doesn't work in Oracle 8.1.7.0.0 for NT/2k

- Oracle 8.1.7.1.2 for NT/2k \\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE  

- FAQ Site

http://www.orafaq.net/archive/comp.databases.oracl e.server/2002/04/13/143024.htm http://www.orafaq.net/archive/comp.databases.oracl e.server/2002/04/13/143024.htm http://www.pauck.de/marco/misc/oracle_and_firewall s.html



关于ORACLE网络

[Q]如何限定特定IP访问数据库
[A]可以利用登录触发器或者是修改sqlnet.ora(9i以上):
增加如下内容:
tcp.validnode_checking=yes
#允许访问的ip
tcp.inited_nodes=(ip1,ip2,……)
#不允许访问的ip
tcp.excluded_nodes=(ip1,ip2,……)

[Q]如何穿过防火墙连接数据库
[A]这个问题只会在WIN平台出现,UNIX平台会自动解决。
解决方法:
在服务器端的SQLNET.ORA应类似
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
TRACE_LEVEL_CLIENT = 16
注册表的HOME0加[HKEY_LOCAL_MACHINE]
USE_SHARED_SOCKET=TRUE

[Q]如何利用hostname方式连接数据库
host name方式只支持tcp/ip协议的小局域网
修改listener.ora中的如下信息
(SID_DESC =
(GLOBAL_DBNAME = ur_hostname) --你的机器名
(ORACLE_HOME = E:\oracle\ora92) --oracle home
(SID_NAME = orcl) --sid name
)
然后在客户端
的sqlnet.ora中,确保有
NAMES.DIRECTORY_PATH= (HOSTNAME)
你就可以利用数据库服务器的名称访问数据库了


OS相关


[Q]怎么样生成日期格式的文件
[A]在LINUX/UNIX上,使用`date +%y%m%d` (`这个是键盘上~所在的那个键) 或$(date +%y%m%d),如:
touch exp_table_name_`date +%y%m%d`.dmp
DATE=$(date +%y%m%d)
或者
DATE=$(date +%Y%m%d --date '1 days ago') #获取昨天或多天前的日期
Windows上,使用%date:~4,10%,其中4是开始字符,10是提取长度,表示从date生成的日期中,提取从4开始长度是10的串。你可以改成其它你需要的数字,如:
Echo %date:~4,10%
如果想得到更精确的时间,win上面还可以使用time


[Q]测试磁盘与阵列性能
[A]用类似如下的方法测试写能力
time dd if=/dev/zero of=/oradata/biddb/testind/testfile.dbf bs=1024000 count=1000
期间系统IO 使用可以用(unix):
iostat -xnp 2 显示Busy程度

[Q]怎么配置SSH密匙
[A]可以防止"中间人"的进攻方式
1、ssh-keygen 或ssh-keygen -d(ssh 2.x)生成钥匙
2、然后拷贝公匙到你想登录的服务器,改名为authorized_keys,如果是3.0以下版本,需要改为authorized_keys2
3、还可以利用config文件进一步简化操作

Host *bj
HostName 机器名或IP
User 用户名
有了这个配置文件,你就可以利用ssh bj来访问指定的机器了,也就可以利用scp与sftp来传送文件了。


[Q]sqlplus怎么与shell结合
[A]可以用如下的写法
sqlplus /nolog << EOF
connect user/pass
spool test
select * from tab;
spool off
exit
EOF
当然,RMAN也支持这样的写法。


[Q]FTP怎么在脚本中自动上传/下载
[A]可以把FTP写到shell脚本中,如
ftp -n -i 主机IP <<EOF
user username pass
cd 目标目录
put file
get file
#查询文件
ls
#退出
bye
EOF

posted on 2008-01-09 15:10 flyonok 阅读(528) 评论(0)  编辑 收藏 引用 所属分类: oralce


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理