建立dblink(databaselink)
database linke是建立一个数据库到另一个数据库的路径的对象,通过database link可以允许查询远程表,我理解可以算作一种分布式数据库的用法。 database link是单向连接,既然它是一种对象,那自然可以在xxx_objects表中查询到相关的信息。建立database link
database linke是建立一个数据库到另一个数据库的路径的对象,通过database link可以允许查询远程表,我理解可以算作一种分布式数据库的用法。
database link是单向连接,既然它是一种对象,那自然可以在xxx_objects表中查询到相关的信息。建立database link前需要明确几个事情:
1、确认从建立方的server可以访问远程数据库。
2、需要在建立方的tnsnames中配置远程数据库连接串。
3、只有在服务端配置的连接才能在dblink中使用,如果仅是在客户端配置的连接是不能在dblink中使用,我这里就犯了这个错误,执行时就报错:
select * from t@dblinktest
*
ERROR at line 1:
ORA-12154: TNS:could not resolve service name
很明显,相当于服务端未配置tnsname,因此找不到远程数据库的service name配置。
建立过程:
1、建立方的服务端配置远程数据库的tnsname配置。
2、tnsping 远程数据库tnsnames配置名称,可以通。
3、sqlplus登录后执行:
SQL> create database link dblinktest connect to user identified by passwd using 'ceshi';
其中:dblinktest是database link的名称。
user是远程数据库的用户名。
passwd是远程数据库的密码。
ceshi是数据库服务端配置的tnsnames中名称。
4、执行:
SQL> select owner,object_name from dba_objects where object_type='DATABASE LINK';
OWNER OBJECT_NAME
--------------- -------------------------
OPEN DBLINKTEST
可以看到已经建立了这个database link。
5、执行:
SQL> select * from t@dblinktest;
ID
----------
0
2
3
4
5
当然也可以执行insert语句:
SQL> insert into t@dblinktest values(1);
1 row created.
另外database link分为public和private的,默认是private,只有当前用户可用,如果是create public database link ...,则所有用户都可以使用这个名称的database link。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Title: In-depth discussion of the importance and examples of establishing link files in Linux. In the Linux operating system, link files are a very useful concept. It can help users better organize and manage data in the file system and improve file accessibility. Accessibility and flexibility. Understanding how to create link files in Linux is crucial for system administrators and developers. This article will delve into the importance of establishing link files in Linux and demonstrate its usage and role through specific code examples. 1.What is

MDF file is a common database file format and it is one of the main files of Microsoft SQL Server database. In database management systems, MDF files are used to save the main data of the database, including tables, indexes, stored procedures, etc. Creating an MDF file is one of the key steps in creating a database. Some common methods will be introduced below. Using SQLServerManagementStudio(SSMS)SQLServerManag

Select the plus button on the homepage, then select Start a group chat, check the contacts you want to create a group, and then complete. Tutorial Applicable Model: iPhone13 System: IOS15.3 Version: WeChat 8.0.20 Analysis 1 First open WeChat and click the plus button in the upper right corner of the homepage. 2 Next, click the option to initiate a group chat in the pop-up window. 3Finally, check the contacts you want to create a group on the page and click Finish. Supplement: What is WeChat group chat? 1 WeChat chat group is a multi-person chat and communication network platform developed by Tencent. We can use the Internet to quickly transmit voice messages, short videos, high-definition pictures and text content. You can also use WeChat to communicate with friends in more colorful forms such as short messages, mobile MMS, etc.

How to establish LAN sharing in win10 system? Win10 can provide fast and convenient data transmission services by establishing a local area network. Many friends are very yearning for this. However, the establishment of a local area network not only has strict regional restrictions, but also has certain operational difficulties. Therefore, some friends have made various errors when establishing a local area network. The editor will introduce win10 to you below. Tutorial on setting up LAN sharing, friends in need can take a look together. Tutorial on setting up LAN sharing in win10 1. Right-click the folder or printer that needs to be shared, and select "Specific User" in "Sharing" in the pop-up menu; 2. Add users. If it is open to all users in the LAN, add Eve

How to use MySQL to build a user table for a grocery shopping system. The user table is an important part of any grocery shopping system. It is used to store users' basic information and login credentials. In this article, we will introduce how to use a MySQL database to build a simple but practical user table and provide specific code examples. Creating the database and user table First, we need to create a database to store the user table. In MySQL, you can use the following statement to create a database named "grocery_system"

The best practice for building a MySQL shopping cart table requires specific code examples. The shopping cart is a very important functional module when developing e-commerce websites or other applications that require shopping functions. The shopping cart can not only help users manage selected products, but also add, delete, and modify quantities of products. In this article, we will discuss the best practices for setting up a MySQL shopping cart table and provide specific code examples. The design of the shopping cart table is part of the database model. It needs to record the user ID, product ID, purchase

How to Build Your Personal Brand in PHP Development With the rapid development of the Internet, PHP has become one of the most popular server-side scripting languages in the world. Whether it is website development, network applications, or data processing, PHP has a wide range of application scenarios. In this highly competitive industry, building a personal brand is critical. This article will guide you on how to establish your own personal brand in the field of PHP development. 1. Proficient in the core knowledge of PHP. As a server-side scripting language, PHP’s core knowledge is to build a personal brand.

Building a personalized website is what many people dream of, and Dreamweaver CMS, as a powerful and easy-to-operate website building tool, provides a good platform to achieve this goal. This article will introduce in detail how to use Dreamweaver CMS to build a personalized website, and provide specific code examples, hoping to help readers better use this tool. Step 1: Install Dreamweaver CMS First, you need to install Dreamweaver CMS on the server. You can download the installation package from the official website and install it step by step according to the installation guide. After the installation is complete, you can
