【练习】创建私有的dblink
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的更多相关文章
- 创建链接服务器(dblink)
--创建链接服务器(dblink) exec sp_addlinkedserver 'srv_lnk','','SQLOLEDB','远程服务器名或ip地址' exec sp_addlinkedsrv ...
- Oracle创建database link(dblink)和同义词(synonym)
同一个数据库不同用户之间建立dblink和synonym 1.建立dblink 实现在A用户下通过dblink访问B用户下的数据库表,需要在A用户下创建访问B库的dblink连接 --创建远程连接db ...
- CentOS7 完整安装后创建私有的yum仓库
1. 安装 CentOS7 安装的包比较全,应用可以直接用. 2. 第一步创建 yum 包的存放路径 mkdir -p /var/www/html/ 3. 创建私有仓库 createrepo -v / ...
- 创建私有的cocoapod库
我是通过cocoachina 的一篇文章 跟着学习的 http://www.cocoachina.com/ios/20150228/11206.html 这里我简单描述下 主要还是给我自己记忆的 ...
- Oracle 11g数据库详解(2)
FAILED_LOGIN_ATTEMPTS 用于指定连续登陆失败的最大次数 达到最大次数后,用户会被锁定,登陆时提示ORA-28000 UNLIMITED为不限制 精确无误差 是 实时 PASSWOR ...
- Oracle 11g数据库详解
常见异常: ORA-14025:不能为实体化视图或实体化视图日志指定PARTITION ORA-14026:PARTITION和CLUSTER子句互相排斥 ORA-14027:仅可以指定一个PARTI ...
- 实验测试之------创建DBlink,查询远端的yang用户下的abcdedfa表,创建同义词
--测试环境,20远端,30本地: --准备1,20远端建立表的同义词,用户信息: 1.11 ---------------------------------------------------准备 ...
- 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 ...
- Windows环境下,本地Oracle创建dblink连接远程mysql
前言 我的情况是,本地安装了oracle(安装完成后带有SQL Developer,不需要再安装instantclient),创建dblink去连接远程的mysql.有些朋友可能是 本地使用PL\SQ ...
随机推荐
- Oracle与MySQL的几点区别
Oracle数据库与MySQL数据库的区别是本文我们主要介绍的内容,希望能够对您有所帮助. 1.组函数用法规则 mysql中组函数在select语句中可以随意使用,但在oracle中如果查询语句中有组 ...
- freeswitch编译
编译1.6版本的话,debian的包就太老,需要添加新源 echo "deb http://files.freeswitch.org/repo/deb/debian/ jessie main ...
- 一个SQLSERVER触发器的示例
CREATE TRIGGER WoStateChange on T_PD_WorkOrder AFTER UPDATE AS BEGIN declare @WorkOrderID varchar(20 ...
- 黄聪:WordPress 后台发布文章时提示用户选择分类
很多用户在后台发布文章,常常会忘记选择分类,所以很有必要添加一个提醒功能,如果没有选择分类,点击发布时,就显示一个提示信息.要实现这个功能,只要将下面的代码添加到主题的 functions.php 即 ...
- Excel 操作类
转载:http://www.cnblogs.com/fellowcheng/archive/2010/08/21/1805158.html ExcelHelper(Excel2007) Code hi ...
- C#继承的用法
using System; namespace 继承 { public class cat { private string _name = null; private int _age = 0; p ...
- OAF_EO系列6 - Delete详解和实现(案例)
2014-06-14 Created By BaoXinjian
- USACO CHAPTER 1 1.1 Ride 水题
水题,主要是学习文件输入输出. /* ID: ijustwa1 LANG: C++ TASK: ride */ #include<cstdio> #include<cstring&g ...
- SQL语句的Select部分只写必要的列
如果Select部分包含不需要的列,这会强制DB2必须进入数据页来得到所请求的特定列,这就要求更多的I/O操作.另外,如果再对这个不需要的列进行排序,就需要创建和传递一个更大的排序文件,相应地会使排序 ...
- git同步开发更新至项目目录(转载)
From:http://toroid.org/ams/git-website-howto 本地版本库中存放开发的项目代码.以下内容介绍如何将本地版本库修改通过执行“git push web”命令同步到 ...