Create a data connection in Oracle

Source: Internet
Author: User

1. To establish a Database connection, you must have the PCREATE Database link system permission. to connect to a remote account, you must also have the CREATE session common permission;
2. Ensure that connected users have the permission to access the tables or views of the connected database.
3. Add the connection characters to the connected database in the [TNSNAMES. ORA] file.
LIMS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.126.6.14) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = LIMS)
)
)
Or use the second method to create a connection.
3. Create Database Connection syntax
CREATE [public] database link database connection name
Connect to username identified by password
USING 'database connection string ';

Create database link "Oracle_13"
Connect to "TOTALPLANT"
Identified "********"
USING 'oracle _ Server'
Or:
-- Create database link
Create database link TOCCIC
Connect to ZTRY identified by ZTRY
Using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = fengwenwei) (PORT = 1521 ))
)
(CONNECT_DATA = (SID = ZTRY ))
)';

4. Generally, PUBLIC is created by the database administrator. Individual users can access a private database without public;
5. In the configuration file init. in ora, when the database parameter global_name = true, the database connection name must be the same as the remote database name; when the database parameter global_name = false, the database connection name can be different from the remote database name; restart the database to take effect. Alternatively, you do not need to restart the database by modifying alter system set global_names = false;
6. In the configuration file init. ora, the number of database connections is limited. The default number of concurrent connections is 4, which is limited by OP_LINKS;
====================================
You can use the following command to check the global name of the database:
SELECT * FROM GLOBAL_NAME;

Query tables in a remote database
SELECT ...... FROM table name @ database connection name;

Query database connections
Select * from user_db_links;
Delete database connection
DELETE USER_DB_LINKS;
DROP (PUBLIC) database link DBaseLinkToCompany

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.