In this post I will be demonstrating how to install Oracle Client 10g, along with SQL * Plus. I recently made a post about installing Oracle Database 11g, and we are currently in version 12c (some 2 years ago), but the latest version of SQL * Plus as an application was 10g. From the 11g version, the software binary was compiled without the GUI version, which lost some features and functionality (I didn't like it).
If you want to know how to install Oracle Database instead of Oracle Client, visit this link.
Oracle Client 10g Installation
- Run the file setup.exe to start the installation.
- In step 2, you must select the type of Oracle Client 10g installation. I always choose the Administrator option for DBA machines. If the Oracle Client is only needed to access the database, you can use the InstantClient option.
- In step 3, you can set the Oracle Client installation path (or use the default).
- Step 4 is where Oracle Universal Installer will validate the minimum requirements to proceed with the installation.
- A summary of the chosen settings will be displayed on the screen.
- Installation in progress.
- After installation, Oracle Net configuration must be performed. As we are going to edit our tnsnames.ora and sqlnet.ora file manually, we can check the option “Run the typical configuration” and proceed.
- End of Client Installation
Configuring Client to Database Connection
After performing the Oracle Client installation, we need to configure it so that it works correctly with the database:
- Before we get started, we need to clarify 2 key concepts:
- sqlnet.ora: Configuration file that allows you to set Oracle Client connection options, such as authentication form (SQLNET.AUTHENTICATION_SERVICES = (NTS)), instance name resolution form (NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)), default domain, etc. .
- tnsnames.ora: Settings file that allows you to define the connection string of each instance you will access.
Standard format: CustomizedName.Domain = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = machine_name.domain) (PORT = 1521))) (CONNECT_DATA = (SID = Oracle_ID_name)))
Standard format with active loadbalance: Custom_Name.domain = (description = (address_list = (load_balance = yes) (address = (protocol = tcp) (host = machine_name.domain) (port = 1521))) (connect_data = (SID = Oracle_ID_name) (failover_mode = (failover_mode = ( type = select) (method = basic))))
- Set the default directory to store client settings (tnsnames.ora and sqlnet.ora). For this we will create an environment variable in Windows. This will allow you to manually set the location where your tnsnames.ora file will be located, even if you have more than one version of Oracle Client installed on your machine, preventing each version of Oracle Client from using different settings. If you do not want to use this option, the default directory where the sqlnet.ora file is located and where you should create your tnsnames.ora is C: \ oracle \ product \ 10.2.0 \ client_1 \ NETWORK \ ADMIN \
-
- Another way to configure this is to enter the Start Menu> My Computer> Right Button> Properties.
After that, click on the option "Advanced system settings"> button "Environment Variables" and add the record on this screen - Create the file tnsnames.ora in the directory pointing to your server and database
SQL * Plus Configuration
After installing Oracle Client and setting environment variables, we can configure SQL * Plus correctly.
- Create a shortcut to the SQL * Plus GUI, adding the / nolog parameter to the command line so that it does not ask for login and password when opening and in the “Start at” field, change the default address to the location where your scripts will be located .
- Open the glogin.sql file, located in the C: \ oracle \ product \ 10.2.0 \ client_1 \ sqlplus \ admin \ directory, and add the following command at the end of the file so that SQL * Plus shows the username and the instance you connected:
set sqlprompt "_user'@'_connect_identifier> "
- Create your connect.sql script as the example below:
123456789101112131415161718192021set echo off---col HOST_NAME format a30col ROLE format a20col OBJECT_NAME format a35col CODIGO_FONTE format a50000col current_scn format 9999999999999999999999SET SERVEROUTPUT ON SIZE 1000000SET linesize 32765SET long 1000000SET pagesize 50000SET verify onSET time onSET trims onALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY HH24:MI:SS';SELECT * FROM GV$INSTANCE order by instance_name; - Let's see how this makes life easier for Oracle DBA:
- See some examples of scripts applied in practice in an SQL * Plus session and see how this powerful tool makes DBA life much easier> run_log.
To the next!