手机版
你好,游客 登录 注册
背景:
阅读新闻

Oracle access MySql via unixODBC by DBLINK

[日期:2013-03-26] 来源:Linux社区  作者:gtlions [字体:大 中 小]

然后启动监听和数据,创建链接并测试:
 ODBCINI=/etc/odbc.ini; export ODBCINI
 ODBCSYSINI=/etc; export ODBCSYSINI
 [Oracle@gtserdev admin]$ lsnrctl stop
 
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 26-MAR-2013 17:12:09
 
Copyright (c) 1991, 2010, Oracle.  All rights reserved.
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gtserdev)(PORT=1521)))
 The command completed successfully
 [oracle@gtserdev admin]$ lsnrctl start
 
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 26-MAR-2013 17:12:19
 
Copyright (c) 1991, 2010, Oracle.  All rights reserved.
 
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
 
TNSLSNR for Linux: Version 10.2.0.5.0 - Production
 System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
 Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
 Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gtserdev)(PORT=1521)))
 Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gtserdev)(PORT=1521)))
 STATUS of the LISTENER
 ------------------------
 Alias                    LISTENER
 Version                  TNSLSNR for Linux: Version 10.2.0.5.0 - Production
 Start Date                26-MAR-2013 17:12:19
 Uptime                    0 days 0 hr. 0 min. 0 sec
 Trace Level              off
 Security                  ON: Local OS Authentication
 SNMP                      OFF
 Listener Parameter File  /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
 Listener Log File        /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
 Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gtserdev)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
 Services Summary...
 Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
 Service "test" has 1 instance(s).
  Instance "test", status UNKNOWN, has 1 handler(s) for this service...
 The command completed successfully
 [oracle@gtserdev admin]$ tnsping test
 
TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 26-MAR-2013 17:20:03
 
Copyright (c) 1997,  2010, Oracle.  All rights reserved.
 
Used parameter files:
 

Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521))) (CONNECT_DATA = (SID= test)) (HS=OK))
 OK (0 msec)
 [oracle@gtserdev admin]$ sqlplus "/as sysdba"
 
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Mar 26 16:17:37 2013
 
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
 
Connected to an idle instance.
 
SQL> startup
 ORACLE instance started.
 
Total System Global Area  167772160 bytes
 Fixed Size                  1272600 bytes
 Variable Size              62915816 bytes
 Database Buffers          100663296 bytes
 Redo Buffers                2920448 bytes
 Database mounted.
 Database opened.
 
SQL> drop database link mysql;
 
Database link dropped.
 
SQL> CREATE PUBLIC DATABASE LINK mysql CONNECT TO "gtlions" IDENTIFIED BY "000000" USING 'TEST';
 
Database link created.
 
SQL> select * from "access_by_oracle"@mysql;
 
        id name
 ---------- --------------------
          1 gtlions
          2 laidye
 -EOF-       

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux
相关资讯       DBLINK 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款