Chinaunix首页 | 论坛 | 博客
  • 博客访问: 230333
  • 博文数量: 59
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 592
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-01 12:51
个人简介

你们都是我的客户,所以,我对你们是透明的

文章分类

全部博文(59)

文章存档

2016年(29)

2015年(30)

分类: Oracle

2016-03-08 14:54:14

客户端配置tnsnames
[oracle@ha admin]$ more tnsnames.ora
tt=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.111)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
[oracle@ha admin]$ tnsping tt
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 08-MAR-2016 14:45:02
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
Used parameter files:
/oracle/app/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.111)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (0 msec)
[oracle@ha admin]$


测试连接
oracle@ha admin]$ sqlplus system/oracle@tt
SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 8 14:37:13 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> show parameter name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      orcl
lock_name_space                      string
log_file_name_convert                string
processor_group_name                 string
service_names                        string      orcl 

创建一个名为ll的dblink
SQL> create public database link ll connect to sa identified by oracle using 'tt';
Database link created.

SQL> select * from dba_db_links;
OWNER       DB_LINK     USERNAME          HOST       CREATED
----------- --------------- ------------------- ------------------ ---------
PUBLIC             LL               SA                    tt          08-MAR-16


测试
oracle@ha admin]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 8 14:50:56 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from sa.gg;
select * from sa.gg
                 *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> select * from sa.gg@ll;
        ID
----------
         1
SQL>
阅读(1392) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~