How to add Oracle linked server to SQL Server database
1. Adding components to access Oracle
1.1 Download Oracle’s component Oracle Provider for OLE DB
Official download address: https://www.oracle.com/technetwork/topics/dotnet/downloads/odacdeploy-4242173.html
1.2 Register the component
1.2.1 Decompression location of downloaded compressed package
For example, I put it directly in the root directory of drive D
1.2.2 Then run Cmd as an administrator. You must run it as an administrator here, otherwise an error will be reported.
Open the terminal as an administrator and run the following command:
cd D:\test\ODAC-21.10-Xcopy-64-bit
.\install.bat oledb d:\test\oracle odac
2. Configure environment variables
In the system environment variables, add "C:\test\oracle;C:\test\oracle\bin;" to the front of Path.
3. Restart the SQL Server instance. If you do not restart, an error will be reported when testing the link.
4. Set OraOLEDB.Oracle access interface properties
Right-click the access interface → General → check "Run in process"
5. Start creating a new linked server
Right-click "Linked Server" → select "New Linked Server" → You can choose the name of the linked server for identification and subsequent calls → The data source is the IP + port/database name of the target database → Log in with your account and password on the "Security" option page