Connect to remote Oracle database via plsql

Method 1: Connect to Oracle through plsql tool and oracle client (not instant client)

1. Install the oracle client, (this tutorial has been downloaded and unzipped)
Connect to remote Oracle database via plsql
2. Select the administrator to install, as shown in the figure:
Connect to remote Oracle database via plsql
3. The rest is OK all the way to the next step, after the installation is complete, execute in the doc window, sqlplus if the following input user The name indicates successful installation.
Connect to remote Oracle database via plsql
4. Install plsql (in this tutorial, Oracle is 11gr2, so plsql also installs version 11, and the other versions are the same), and install the language pack. The installation instructions are omitted.

Fifth, after the installation is complete, now start to configure the connection. After installing the Oracle client, the installation directory has been automatically added to the environment variables, as shown in the figure:
Connect to remote Oracle database via plsql
Six. Configure plsql below, click the software to log in first and then pop up the global interface and then find the tool-Preferences- As shown in the figure:
Connect to remote Oracle database via plsql
7. After configuring plsql, now configure the information to connect to the Oracle database, enter the oracle dlient installation directory to find the tnsnames.ora file under admin under network, as shown in the figure:
Connect to remote Oracle database via plsql
open this file and add the following content:
Connect to remote Oracle database via plsql
eight, local configuration Completed, next check the relevant files on the server, first check the tnsnames.ora file and listener.ora file in the Oracle server installation directory, as follows:
Connect to remote Oracle database via plsql
If the value behind host in the configuration file is different from the local name, then start monitoring It will report an error or fail to connect, the window is also the same as the name of the machine, if it is a Linux system, if you modify the name of the machine, you must ensure that there is an additional record under / etc / hosts, as shown in the figure, (the machine IP is 192.168. 240.139)
Connect to remote Oracle database via plsql
Nine, the rest of the modification here is to check whether port 1521 is open Open, windows can open ports in the firewall, linux can also be opened by the command firewall-cmd –zone = public –add-port = 1521 / tcp –permanent, and restart the firewall, then you can view the 1521 port information, use the command netstat – n –a
Connect to remote Oracle database via plsql
Ten, if it is 127.0.0.1 in the front, it can only be connected locally, and cannot be connected to the port remotely. The remote connection can only be used when the front is all 0. You can use telnet to test whether the 1521 port is open. The window is also the same. Open plsql and
enter the user name and password to connect, as shown in the figure:
Connect to remote Oracle database via plsql
Connect to remote Oracle database via plsql
Method 2: Connect to the oracle database through plsql and oracle instant client (instantclient) to download the instant client (basic version only) is
Connect to remote Oracle database via plsql
free of installation, decompression can be used, but needs to be configured Environment variables

1. After decompression, create a network directory under the directory, create an admin directory under the network directory, then create the tnsnames.ora file, and add the content (there is an example above), then configure plsql, the configuration method and method one are the same. Next, you need to configure the environment Variables, the environment variables of the installed version have been configured, but this free installation version needs to configure the environment variables, add this directory to the environment variable path, as shown in the figure:
Connect to remote Oracle database via plsql
2. Add the location of tnsname.ora to the environment variables As follows:
Connect to remote Oracle database via plsql
3. If garbled characters appear, you can add the following to the environment variables:
Connect to remote Oracle database via plsql
4. The local plsql and environment variables and tnsname.ora are all configured. Next, check the information of the server where the oracle is located, including the steps of method one, including Whether the port is open, whether the monitoring is open, whether the oracle instance is started, and whether the configuration files listener.ora and tnsname.ora are configured correctly (host and local name must be the same) After all checks are correct, you can use plsql to link, the method is the same as above Note: To check whether the monitoring is started, you must first enter oracle Next, su-oracle and then execute the command lsnrctl status to view, if it is started, execute the command lsnrctl start to start monitoring, and then execute sqlplus / as sysdba login (login with dba authority) and then execute startup to start the database instance, if you close the database instance You can execute shutdown immediate (you also need dba permissions to do the rest), the windows method is the same, windows can also go to the service to start listening.

Original link: Connect remote Oracle via plsql

Guess you like

Origin blog.51cto.com/13490073/2486690