安装好Oracle数据库和客户端后, 服务器端用lsnrctl start启动监听程序, 在客户端用net config 配置, 连接数据库, 最后生成tnsnames.ora文件, 格式如下(这是管理两个节点的配置). #C:\oracle\ora92\NETWORK\ADMIN\tnsnames.ora servicename = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.120.1.70)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = test) ) ) phperz.com
TEST_2 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.120.1.71)(PORT = 1526)) ) (CONNECT_DATA = (SERVICE_NAME = myora) ) ) phperz.com
可以用tnsping servicename来测试连接 然后sqlplus username/passwd@servicename 连接 php程序员站
常见问题:
www.phperz.com
<>; ORA-12537: TNS: 连接已关闭 phperz~com
A:监听程序没有启动, 运行lsnrctl start命令 www.phperz.com
phperz.com
<>;ORA-12545: 因目标主机或对象不存在,连接失败 www.phperz.com
A: 检查tnsnames.ora文件配置, 主机名和端口是否正确, 监听程序是否启动. php程序员站
<>;ORA-12560: TNS:protocol adapter error phperz.com
A: 检查tnsnames.ora文件配置, 主机名和端口是否正确, 监听程序是否启动. SID是否正确, 可以用tnsping 检测 phperz.com
<>;ORA-03113 :通信通道的文件结束 A:这个原因的问题很多, 一般应检查网络状况, 或者系统参数的配置 phperz.com
具体见: http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=8&topic=393&show=2340 php程序员站
<>; select 查询时,有2000条记录符合条件,如何先取出符合条件前1000条,然后再取出符合条件的后1000条? www.phperz.com
A: select * from table_name where rownum<=1000; select * from table_name where rownum<=2000 minus select * from table_name where rownum<=1000; select * from table_name where rownum<=3000 minus select * from table_name where rownum<=2000; www.phperz.com
<>;怎样能够查到数据库的名字? php程序员站
A: select value from v$parameter where upper(name) like '%DB_NAME%' phperz.com
<>;怎样得到一个表的最后更新时间? phperz.com
A: 1. 打开审计功能, 设置初始化文件: AUDIT_TRAIL = true 2. 重新启动instance. 3. 审计表: AUDIT INSERT,SELECT,DELETE,UPDATE on TableName by ACCESS WHENEVER SUCCESSFUL 4. 得到详细信息: SELECT OBJ_NAME,ACTION_NAME ,to_char(timestamp,'dd/mm/yyyy , HH:MM:SS') from sys.dba_audit_object. www.phperz.com
<>;察看表空间都有哪些表 www.phperz.com
A; select table_name from dba_tables where tablespace_name='xxx'; phperz.com
<>; 一个不常见的错误: $ sqlplus exec(): 0509-036 Cannot load program sqlplus because of the following errors: 0509-130 Symbol resolution failed for sqlplus because: 0509-136 Symbol pw_post (number 272) is not exported from dependent module /unix. 0509-136 Symbol pw_wait (number 273) is not exported from dependent module /unix. 0509-136 Symbol pw_config (number 274) is not exported from dependent module /unix. 0509-136 Symbol aix_ora_pw_version3_required (number 275) is not exported from phperz.com dependent module /unix. 0509-192 Examine .loader section symbols with the 'dump -Tv' command. php程序员之家
A: 重新 /etc/loadext -l /etc/pw-syscall (reload) 可能是 Oracle Kernel Extension for aix 在服务器重启动的时候没 load phperz~com
|