When weRemote ServerOnOracle DatabaseDuring the operation, you should first establish a connection before calling RPC and other operations on the database on the remote server. The last thing to do is to disconnect and delete the link. This is a complete procedure for operating the Oracle database on the remote server. This article mainly introduces the implementation code of this process. Let's take a look at it.
Create a linked server linked to ORACLE:
- EXEC sp_addlinkedserver
-
- @server = 'QZYDJK_Link',
-
- @srvproduct = 'Oracle',
-
- @provider = 'MSDAORA',
-
- @datasrc = 'CSC25'
Remotely link to the linked server:
- EXEC sp_addlinkedsrvlogin
-
- @rmtsrvname = 'QZYDJK_Link',
-
- @useself = 'false',
-
- @locallogin = NULL,
-
- @rmtuser = 'xxxx',
-
- @rmtpassword = '1234'
Enable the remote call process RPC on the remote connection Server:
- EXEC sp_serveroption
-
- @server = 'QZYDJK_Link',
-
- @optname = 'rpc out',
-
- @optvalue = true
Query data on a remote connection Server:
- EXEC
-
- ('SELECT * FROM table'
-
- )
-
- AT QZYDJK_Link
Disconnect the remote connection Server:
- EXEC sp_droplinkedsrvlogin 'QZYDJK_Link',NULL;
Delete remote connection server link:
- EXEC sp_dropserver [QZYDJK_Link]
This article describes how to establish a remote connection to the Oracle database and operate data on the remote server. We hope you can get some help from this introduction. Thank you for your reference!