Link server to Oracle

Source: Internet
Author: User

Access Oracle 10 through SQL Server 2005 Express

EXEC master. dbo. sp_addmediaserver

@ Server = n'testlink ',

@ Srvproduct = n' Oracle ',

@ Provider = n'msdaora ',

@ Datasrc = n' Test'

GO

Create a database link under SQLServer.

Connection name: TESTLINK

Oracle data source is TEST

An Oracle client must be installed on the SQL Server machine.

The Oracle data source, the configuration file is in

E: oracleproduct10.2.0client _ 1 NETWORKADMIN

Directory.

Content:

# Tnsnames. ora Network Configuration File: E: oracleproduct10.2.0client _ 1networkadmintnsnames. ora

# Generated by Oracle configuration tools.

TEST =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.210) (PORT = 1521 ))

)

(CONNECT_DATA =

(SERVICE_NAME = ORCL)

)

)

  Note:Only the SQL SERVER EXPRESS and Oracle 10 clients are installed on the local machine.

The Oralce 10 server is installed on another machine.

EXEC

Master. dbo. sp_add1_srvlogin

@ Rmtsrvname = n' test ',

@ Locallogin = NULL,

@ Useself = n'false ',

@ Rmtuser = n'test ',

@ Rmtpassword = n' test123'

GO

This statement sets the default username/password used to access the Oracle database.

In the preceding example, the user name is test and the password is test123.

  After the database link is created, you can try to query it:

TESTLINK .. TEST. TEST_MAIN.

The first TESTLINK is the database link name.

The second TEST is the solution name of the Test user in Oracle.

TEST_MAIN is a table under the Test user.

1> select * from TESTLINK .. TEST. TEST_MAIN;

2> go

ID VALUE

--------------------------------------------------

1 ONE

2 TWO

3 TWO

(3 rows affected)

  Note:If MSDAORA cannot find the Oracle client when the query is executed after the link is created. If Oracle 9/10 is installed on the local machine. This may be caused by permission issues. You need to set it in the operating system.

  Take the local machine as an example:

Select the directory E: oracleproduct10.2.0client _ 1.

Right-click and select "properties" from the shortcut menu ".

Then, add an EveryOne user to the "Security" option. And set full control.

Then restart the computer.

After the restart, it should be normal.

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.