1.创建dblink第一种方法,是在本地数据库tnsnames.ora文件中配置了要远程访问的数据库。

1.设置监听:
①[root@host02 ~]# vi /etc/hosts
添加:【IP和名字】
192.168.206.2 host02
②vi listener.ora:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
) ADR_BASE_LISTENER = /u01/app/oracle ③vi tnsnames.ora:
ENMO=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ENMO)
)
)
④查看监听状态:
[oracle@host02 ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 01-DEC-2016 20:37:30 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host02)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 01-DEC-2016 20:18:58
Uptime 0 days 0 hr. 18 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/host02/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host02)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ENMO" has 1 instance(s).
Instance "ENMO", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
Instance "ENMO", status READY, has 1 handler(s) for this service...
The command completed successfully ⑤连接到sys赋权限:
SQL> conn / as sysdba
Connected.
SQL> grant create public database link,create database link to scott; Grant succeeded.
⑥创建dblink:
SQL> create database link emp connect to scott identified by tiger using host02; Database link created.

2.创建dblink第二种方法,是在本地数据库tnsnames.ora文件中没配置要远程访问的数据库。

1.设置监听:
①[root@host02 ~]# vi /etc/hosts
添加:【IP和名字】
192.168.206.2 host02
②vi listener.ora:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
) ADR_BASE_LISTENER = /u01/app/oracle ③vi tnsnames.ora:
ENMO=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ENMO)
)
)
④查看监听状态:
[oracle@host02 ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 01-DEC-2016 20:37:30 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host02)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 01-DEC-2016 20:18:58
Uptime 0 days 0 hr. 18 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/host02/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host02)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ENMO" has 1 instance(s).
Instance "ENMO", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
Instance "ENMO", status READY, has 1 handler(s) for this service...
The command completed successfully ⑤连接到sys赋权限:
SQL> conn / as sysdba
Connected.
SQL> grant create public database link,create database link to scott; Grant succeeded.
⑥创建dblink:
SQL> create database link emp connect to scott identified by tiger using
2 '(DESCRIPTION =
3 (ADDRESS = (PROTOCOL = TCP)(HOST = host02)(PORT = 1521))
4 (CONNECT_DATA =
5 (SERVER = DEDICATED)
6 (SERVICE_NAME = ORCL)
7 )
8 )
9 '; Database link created.

3.创建公共的dblink
语法:create public database link emp using 。。。

【练习】创建私有的dblink的更多相关文章

  1. 创建链接服务器(dblink)

    --创建链接服务器(dblink) exec sp_addlinkedserver 'srv_lnk','','SQLOLEDB','远程服务器名或ip地址' exec sp_addlinkedsrv ...

  2. Oracle创建database link(dblink)和同义词(synonym)

    同一个数据库不同用户之间建立dblink和synonym 1.建立dblink 实现在A用户下通过dblink访问B用户下的数据库表,需要在A用户下创建访问B库的dblink连接 --创建远程连接db ...

  3. CentOS7 完整安装后创建私有的yum仓库

    1. 安装 CentOS7 安装的包比较全,应用可以直接用. 2. 第一步创建 yum 包的存放路径 mkdir -p /var/www/html/ 3. 创建私有仓库 createrepo -v / ...

  4. 创建私有的cocoapod库

    我是通过cocoachina 的一篇文章 跟着学习的 http://www.cocoachina.com/ios/20150228/11206.html 这里我简单描述下  主要还是给我自己记忆的   ...

  5. Oracle 11g数据库详解(2)

    FAILED_LOGIN_ATTEMPTS 用于指定连续登陆失败的最大次数 达到最大次数后,用户会被锁定,登陆时提示ORA-28000 UNLIMITED为不限制 精确无误差 是 实时 PASSWOR ...

  6. Oracle 11g数据库详解

    常见异常: ORA-14025:不能为实体化视图或实体化视图日志指定PARTITION ORA-14026:PARTITION和CLUSTER子句互相排斥 ORA-14027:仅可以指定一个PARTI ...

  7. 实验测试之------创建DBlink,查询远端的yang用户下的abcdedfa表,创建同义词

    --测试环境,20远端,30本地: --准备1,20远端建立表的同义词,用户信息: 1.11 ---------------------------------------------------准备 ...

  8. Oracle创建dblink报错:ORA-01017、ORA-02063解决

    Oracle环境:oracle 10.2.0.1 创建的 public dblink 连接oracle 11.2.0.3 ORA-01017: invalid username/password; l ...

  9. Windows环境下,本地Oracle创建dblink连接远程mysql

    前言 我的情况是,本地安装了oracle(安装完成后带有SQL Developer,不需要再安装instantclient),创建dblink去连接远程的mysql.有些朋友可能是 本地使用PL\SQ ...

随机推荐

  1. insmod module_param 模块参数

    模块参数 引导模块时,可以向它传递参数.要使用模块参数加载模块,这样写: insmod module.ko [param1=value param2=value ...] 为了使用这些参数的值,要在模 ...

  2. cgic 写CGI程序

    CGIC是C语言CGI库函数,用于编写CGI程序 CGIC 主要完成以下功能: * 对数据进行语法分析 * 接收以 GET 和 PSOT 两种方式发送的数据 * 把 FORM 中的不同域连接成连续的串 ...

  3. 109. Convert Sorted List to Binary Search Tree

    Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...

  4. jetty-run运行报错的原因

  5. spring2.5

    1:IOC:控制反转,不再把依赖对象交给应用本身创建和维护,而是交给外部容器创建和维护.这样控制权由应用转移到外部容器.2:DI:依赖注入,在运行期,由外部容器动态的将依赖对象注入到组件中,可以通过构 ...

  6. 正则表达式中的\b

    转自百度知道:https://zhidao.baidu.com/question/58688915.html\b表示的应该是ASCII码中的BS字符(退格字符),匹配字与字中间那个看不见的东西(即一个 ...

  7. Hadoop系统架构

    一.Hadoop系统架构图 Hadoop1.0与hadoop2.0架构对比图 YARN架构: ResourceManager –处理客户端请求 –启动/监控ApplicationMaster –监控N ...

  8. 【初识】KMP算法入门(转)

    感觉写的很好,尤其是底下的公式,易懂,链接:http://www.cnblogs.com/mypride/p/4950245.html 举个例子 模式串S:a s d a s d a s d f a  ...

  9. Eclipse内置Tomcat的配置

    1.首先肯定是得下载J2EE版本的eclipse了,再去Apache Tomcat的官网去下一个Tomcat.都解压到自己想放的目录 2.Eclipse -> Preferences -> ...

  10. Python2.7.5 安装(转载)

    From:http://www.cnblogs.com/balaamwe/p/3480430.html From:http://www.chgon.com/?p=1340 安装python2.7.5纠 ...