Как установить sql plus

How to Install SQLplus Utility on Windows 10

Как установить sql plus. Смотреть фото Как установить sql plus. Смотреть картинку Как установить sql plus. Картинка про Как установить sql plus. Фото Как установить sql plus

SQLplus is a command line utility to manage Oracle Database. It is a powerful tool that all Oracle database administrator must have. In this tutorial, I am going to install the SQLplus Utility 9.5 in Windows 10. The new version of sqlplus 19.5 is available alongside the new Oracle Database 19c. On the previous article, I have shown how to install Oracle Database 19c on CentOS 8.

Как установить sql plus. Смотреть фото Как установить sql plus. Смотреть картинку Как установить sql plus. Картинка про Как установить sql plus. Фото Как установить sql plussqlplus running on Windows 10 command line

Once the connection is made between the client and the server using sqlplus, we can perform many database administration, query, user management and so on.

Steps to Install SQLplus on Windows 10

Step 1. Install Oracle Instant Client

Before we can install and run the sqlplus utility, we need to configure the Oracle Instant Client Utility first. So, I would suggest you to read this article to Install Oracle Instant Client 19.5 on Windows 10.

Step 2. Download SQLplus software package

Once you’ve setup the instant client correctly, now we need to download the sqlplus package from the following link

So this is the sqlplus software package for Windows 10 64 bit edition.

Step 3. Install the Package

From the previous step, you should have a zip file called : instantclient-sqlplus-windows.zip. Now extract the file to your instant client directory you created on the Step 1. Here is the screenshot of my instant client folder looks like:

Как установить sql plus. Смотреть фото Как установить sql plus. Смотреть картинку Как установить sql plus. Картинка про Как установить sql plus. Фото Как установить sql plus

Notice that there is sqlplus application in this instant client folder. Now we are ready to go.

How to Connect to Oracle Database via SQLplus Command

In the following example, I will show you how to connect to remote oracle database via sqlplus command. Before we connect, we need to configure the user in the Oracle database. Skip the user creating step if you already have a database user that can connect to the pluggable database.

Create a new user

In the database server host, we need to connect to the database using sqlplus in order to create a new user for the pluggable database. In this case, my container database called cdb1 and the pluggable database is called pdb1.

Login as oracle user and then execute this command.

Как установить sql plus. Смотреть фото Как установить sql plus. Смотреть картинку Как установить sql plus. Картинка про Как установить sql plus. Фото Как установить sql plus

Now let’s show the current database we connected

As you can see now we are connected to the root database. We need to switch to the pluggable database (pdb1).

Now check again using show command

As you can see, now we are connected to PDB1, the pluggable database. Next, we need to open the database so we can create a new user for it.

Then, we can create a new user

The command will create a new user called “manjaro” and password “thePassword”. After that, we need to grant “CONNECT” privileges to manjaro user so user can connect to the database. You can also add multiple roles to the new users. For example:

Done. Please note that this new user only exist in the pluggable database. So, to connect, we need to specify the username as manjaro@pdb1 in the Connect command.

Connect to the Database

Ok, so now we have a new user setup in the pdb1 database. Let’s try to connect to the database.

From the other computer (in this case Windows 10 where sqlplus is installed using above steps), open command prompt and execute the following command:

You can check your Oracle database services and instances with the following command. Make sure you execute this command on the database host as oracle user.

Thank you for reading this how to install sqlplus 19.5 on Windows 10. I hope you enjoy it and leave us comments for any queries. Cheers.

Источник

D SQL*Plus Instant Client

SQL*Plus Instant Client is a standalone product with all the functionality of SQL*Plus command-line. It connects to existing remote Oracle databases, but does not include its own database. It is easy to install and uses significantly less disk space than the full Oracle Database Client installation required to use SQL*Plus command-line.

SQL*Plus Instant Client is available on platforms that support the OCI Instant Client. See the Oracle Call Interface Programmer’s Guide for more information on the OCI Instant Client.

To install SQL*Plus Instant Client, you need two packages:

SQL*Plus Instant Client package.

Either the Basic OCI Instant Client package, or the lightweight OCI Instant Client package.

Choosing the SQL*Plus Instant Client to Install

SQL*Plus Instant Client can be installed in two ways:

Download the packages from the Oracle Technology Network (OTN).

Copy the same files that are in the packages from an Oracle Database 12 c Client Administrator installation.

Both the SQL*Plus and OCI packages must be from the same Oracle Database version, for example, 12.1.0.0.0.

Basic Instant Client

SQL*Plus Instant Client using the Basic OCI package works with any NLS_LANG setting supported by the Oracle Database. It supports all character sets and language settings available in the Oracle Database.

Lightweight Instant Client

SQL*Plus Instant Client using the lightweight OCI package displays error messages in English only and supports only specific character sets. It is significantly smaller than SQL*Plus Instant Client using the Basic OCI package.

Valid values for NLS_LANG parameters with the lightweight Instant Client are:

language can be any valid language supported by the Oracle Database, however, error messages are only reported in English.

territory can be any valid territory supported by the Oracle Database.

charset is one of the following character sets:

Lightweight SQL*Plus Instant Client Error with Unsupported Character Set

Attempting to start SQL*Plus Instant Client with an unsupported character set will fail with the following error:

Installing SQL*Plus Instant Client by Downloading from OTN

The OTN downloads for Linux are RPM packages. The OTN downloads for UNIX and Windows are zip files.

The SQL*Plus Instant Client package should never be installed on an ORACLE_HOME.

Installing SQL*Plus Instant Client from Linux RPM Packages

Installing SQL*Plus Instant Client from the UNIX or Windows Zip Files

Create a new directory, for example, /home/instantclient12_1 on UNIX or c:\instantclient12_1 on Windows.

Unzip the two packages into the new directory.

List of Files Required for SQL*Plus Instant Client

Tables E-1, E-2 and E-3 list the required files from each of the SQL*Plus and OCI packages. The files from only one of the OCI packages are required. Other files installed that are not listed here can be ignored, or can be removed to save disk space.

Table D-1 Instant Client Files in the SQL*Plus Package

SQL*Plus data shared library

Table D-2 Instant Client Files in the Basic OCI Package

Linux and UNIXWindowsDescription

Client code library

OCI Instant Client data shared Library

OCI Instant Client data shared library

Table D-3 Instant Client Files in the Lightweight OCI Package

Linux and UNIXWindowsDescription

Client code library

OCI Instant Client data shared library (English only)

Installing SQL*Plus Instant Client from the 12 c Client Release Media

Run the installer on the Oracle Database 12 c Client Release media and choose the Administrator option.

Create a new directory, for example, /home/instantclient12_1 on UNIX and Linux, or c:\instantclient12_1 on Windows.

Copy the SQL*Plus Instant Client and the OCI Instant Client files to the new directory. All files must be copied from the same ORACLE_HOME.

Installing SQL*Plus Instant Client on UNIX or Linux

To install SQL*Plus Instant Client using the Basic OCI package on UNIX and Linux, copy the following files:

To install SQL*Plus Instant Client using the lightweight OCI package on UNIX and Linux, copy the following files:

Installing SQL*Plus Instant Client on Windows

To install SQL*Plus Instant Client using the Basic OCI package on Windows, copy the following files:

To install SQL*Plus Instant Client using the lightweight OCI package on Windows, copy the following files:

Configuring SQL*Plus Instant Client

The SQL*Plus Instant Client executable should only be used with the matching version of the OCI Instant Client.

Note that no ORACLE_HOME or ORACLE_SID environment variables need to be set.

Configuring SQL*Plus Instant Client on Linux (from RPMs)

The RPMs downloaded from OTN install into Oracle specific sub-directories in the /usr file system. The sub-directory structure enables multiple versions of Instant Client to be available.

Add the name of the directory containing the Instant Client libraries to LD_LIBRARY_PATH. Remove any other Oracle directories.

For example, to set LD_LIBRARY_PATH on Solaris in the Bourne or Korn shells:

For example, to set PATH in the bash shell:

Set Oracle globalization variables required for your locale. A default locale will be assumed if no variables are set. See the Oracle Database Globalization Support Guide for more information.

Configuring SQL*Plus Instant Client on Linux (from Client Media or Zip File) and UNIX

Add the name of the directory containing the Instant Client files to the appropriate shared library path LD_LIBRARY_PATH, LIBPATH or SHLIB_PATH. Remove any other Oracle directories.

For example on Solaris in the Bourne or Korn shells:

Add the directory containing the Instant Client files to the PATH environment variable. If it is not set, then an absolute or relative path must be used to start SQL*Plus. Remove any other Oracle directories from PATH. For example:

Set Oracle globalization variables required for your locale. A default locale will be assumed if no variables are set. See the Oracle Database Globalization Support Guide for more information.

Configuring SQL*Plus Instant Client on Windows

The environment may be configured using SET commands in a Windows command prompt or made permanent by setting Environment Variables in System Properties.

For example, to set environment variables in Windows 2000 using System Properties, open System from the Control Panel, click the Advanced tab and then click Environment Variables.

Add the directory containing the Instant Client files to the PATH system environment variable. Remove any other Oracle directories from PATH.

For example, add c:\instantclient12_1 to the beginning of PATH.

Set Oracle globalization variables required for your locale. A default locale will be assumed if no variables are set. See the Oracle Database Globalization Support Guide for more information. For example, to set NLS_LANG for a Japanese environment, create a user environment variable NLS_LANG set to JAPANESE_JAPAN.JA16EUC.

If you have installed the lightweight Instant Client, see Lightweight Instant Client for information about supported NLS_LANG settings.

Connecting to a Database with SQL*Plus Instant Client

SQL*Plus Instant Client is always ‘remote’ from any database server. To connect to a database you must specify the database using an Oracle Net connection identifier.

An example using an Easy Connection identifier to connect to the HR schema in the MYDB database running on mymachine is:

Alternatively you can use a Net Service Name:

If you want to use Net Service Names configured in a local Oracle Net tnsnames.ora file, then set the environment variable TNS_ADMIN to the directory containing the tnsnames.ora file. For example, on UNIX, if your tnsnames.ora file is in /home/user1 and it defines the Net Service Name MYDB2:

The TWO_TASK (on UNIX) or LOCAL (on Windows) environment variable can be set to a connection identifier. This removes the need to explicitly enter the connection identifier whenever a connection is made in SQL*Plus or SQL*Plus Instant Client. This UNIX example connects to the database known as MYDB4:

On Windows, TNS_ADMIN and LOCAL may be set in the System Properties. See Configuring SQL*Plus Instant Client on Windows.

AS SYSDBA or AS SYSOPER Connections with SQL*Plus Instant Client

To connect AS SYSDBA or AS SYSOPER to perform DBA tasks, you need to set up an Oracle password file on the database server using the database’s orapwd utility. Once this is configured, your SQL*Plus Instant Client connection string might look something like:

See the Oracle Database Administrator’s Guide for information on Oracle password files.

Uninstalling Instant Client

The SQL*Plus Instant Client package can be removed separately from the OCI Instant Client. After uninstalling the SQL*Plus Instant Client package, the remaining OCI Instant Client libraries enable custom written OCI programs or third party database utilities to connect to a database.

Uninstalling SQL*Plus Instant Client

For installations on UNIX and Windows, and installations on Linux from the Client Release media, manually remove the following SQL*Plus specific files:

Table D-4 Instant Client Files in the SQL*Plus Package

Источник

Как установить sql plus

SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database installation. It has a command-line user interface.

There is also the SQL*Plus Instant Client which is a standalone command-line interface available on platforms that support the OCI Instant Client. SQL*Plus Instant Client connects to any available Oracle database, but does not require its own Oracle database installation. See the Oracle Call Interface Programmer’s Guide for more information on the OCI Instant Client.

SQL*Plus has its own commands and environment, and it provides access to the Oracle Database. It enables you to enter and execute SQL, PL/SQL, SQL*Plus and operating system commands to perform the following:

Format, perform calculations on, store, and print from query results

Examine table and object definitions

Develop and run batch scripts

Perform database administration

You can use SQL*Plus to generate reports interactively, to generate reports as batch processes, and to output the results to text file, to screen, or to HTML file for browsing on the Internet. You can generate reports dynamically using the HTML output facility of SQL*Plus.

Who Can Use SQL*Plus

The SQL*Plus, SQL, and PL/SQL command languages are powerful enough to serve the needs of users with some database experience, yet straightforward enough for new users who are just learning to work with the Oracle Database.

The SQL*Plus language is easy to use. For example, to rename a column labeled LAST_NAME with the heading «Family Name», enter the command:

Similarly, to list column definitions for the EMPLOYEES table, enter the command:

How Can I Learn SQL*Plus

There are several sources available to assist you to learn SQL*Plus:

Part II of this Guide, Using SQL*Plus

Help for SQL*Plus, Command-line help

Oracle Database 12 c : SQL Fundamentals

An instructor-led course run by Oracle. This is a comprehensive hands-on course taking the student through all aspects of using SQL*Plus to access Oracle Database.

More Oracle Database 12 c Training

How to Use the SQL*Plus Guide

SQL*Plus Command-line Architecture

SQL*Plus command-line uses a two-tier model comprising:

Client (command-line user interface).

Database (Oracle Database).

The two tiers may be on the same computer.

SQL*Plus Client

The command-line user interface is the character-based terminal implementation.

Oracle Database

Oracle Database Net components provide communication between the SQL*Plus Client and Oracle Database.

SQL*Plus Prerequisites

SQL*Plus is a component of Oracle Database. SQL*Plus is installed by default when you install the Oracle Database.

Some aspects of Oracle Database and SQL*Plus differ from one computer and operating system to another. These topics are discussed in the Oracle Database Installation Guide for each operating system that SQL*Plus supports.

What is necessary before you can run SQL*Plus?

Obtain an Oracle Database login username and password during installation or from your Database Administrator. See Login Username and Password.

Ensure a sample database is installed and that you have a login username and password for it during Oracle Database installation. See About Sample Schemas and SQL*Plus.

Create a default database during installation or obtain the connection identifier for the Oracle Database you want to connect to from your Database Administrator. See About Connecting to a Database.

Ensure the database you want to connect to is started. See the STARTUP command.

SQL*Plus Date Format

The default date format in SQL*Plus is determined by the database NLS_DATE_FORMAT parameter and may use a date format displaying two digit years. You can use the SQL TO_CHAR function, or the SQL*Plus COLUMN FORMAT command in your SELECT statements to control the way dates are displayed in your report.

Starting SQL*Plus Command-line

In the following examples, you are prompted to enter the database account password.

An example using an Easy Connection identifier to connect to the HR schema in the MYDB database running on mymachine is:

An example using a Net Service Name is:

Net Service Names can be stored in several places, including Oracle Names. See the Net Services Reference Guide for more information.

If you want to use Net Service Names configured in a local Oracle Net tnsnames.ora file, then set the environment variable TNS_ADMIN to the directory containing the tnsnames.ora file. For example, on UNIX, if your tnsnames.ora file is in /home/user1 and it defines the Net Service Name MYDB2:

The TWO_TASK (on UNIX) or LOCAL (on Windows) environment variable can be set to a connection identifier. This removes the need to explicitly enter the connection identifier whenever a connection is made in SQL*Plus or SQL*Plus Instant Client. This UNIX example connects to the database known as MYDB4:

To start SQL*Plus and connect to the default database

You are prompted to enter your password.

Now you can start entering and executing SQL, PL/SQL and SQL*Plus statements and commands at the SQL> prompt.

Open a UNIX or a Windows terminal and enter the SQL*Plus command:

You are prompted to enter your password.

About Starting SQL*Plus Instant Client

SQL*Plus Instant Client is the SQL*Plus command-line without the need to install Oracle Database. For information about using it, see Starting SQL*Plus Command-line.

Because SQL*Plus Instant Client does not include a database, it is always ‘remote’ from any database server. To connect to a database you must specify the database using an Oracle Net connection identifier.

If TNS_ADMIN is not set, then an operating system dependent set of directories is examined to find tnsnames.ora. This search path includes looking in the directory specified by the ORACLE_HOME environment variable for network/admin/tnsnames.ora. This is the only reason to set the ORACLE_HOME environment variable for SQL*Plus Instant Client. If ORACLE_HOME is set when running Instant Client applications, it must be set to a directory that exists.

About Connecting to a Different Database

From an existing command-line session, enter a CONNECT command in the form:

You are prompted to enter your password.

About Sample Schemas and SQL*Plus

Sample schemas are included with the Oracle Database. Examples in this guide use the EMP_DETAILS_VIEW view of the Human Resources (HR) sample schema. This schema contains personnel records for a fictitious company. To view column details for the view, EMP_DETAILS_VIEW, enter

For more information about the sample schemas, see the Oracle Database Sample Schemas guide.

Unlocking the Sample Tables

The Human Resources (HR) Sample Schema is installed as part of the default Oracle Database installation. The HR account is locked by default.

You must unlock the HR account before you can use the HR sample schema. To unlock the HR account, log in as the SYSTEM user and enter the following command, where your_password is the password you want to define for the user HR:

For further information about unlocking the HR account, see the Oracle Database Sample Schemas guide. The HR user is primarily to enable you to access the HR sample schema and is necessary to enable you to run the examples in this guide.

And on the following directory on Windows:

To create the HR tables from command-line SQL*Plus, do the following:

On Windows, enter the following command at the SQL*Plus prompt:

To remove the sample tables, perform the same steps but substitute HR_DROP.SQL for HR_MAIN.SQL.

Running your first Query

To describe a database object, for example, column details for EMP_DETAILS_VIEW, enter a DESCRIBE command like:

which produces the following output:

To rename the column headings, and to select data from the HR sample schema view, EMP_DETAILS_VIEW, enter

Источник

Как установить sql plus

SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database installation. It has a command-line user interface.

There is also the SQL*Plus Instant Client which is a standalone command-line interface available on platforms that support the OCI Instant Client. SQL*Plus Instant Client connects to any available Oracle database, but does not require its own Oracle database installation. See the Oracle Call Interface Programmer’s Guide for more information on the OCI Instant Client.

SQL*Plus has its own commands and environment, and it provides access to the Oracle Database. It enables you to enter and execute SQL, PL/SQL, SQL*Plus and operating system commands to perform the following:

Format, perform calculations on, store, and print from query results

Examine table and object definitions

Develop and run batch scripts

Perform database administration

You can use SQL*Plus to generate reports interactively, to generate reports as batch processes, and to output the results to text file, to screen, or to HTML file for browsing on the Internet. You can generate reports dynamically using the HTML output facility of SQL*Plus.

Who Can Use SQL*Plus

The SQL*Plus, SQL, and PL/SQL command languages are powerful enough to serve the needs of users with some database experience, yet straightforward enough for new users who are just learning to work with the Oracle Database.

The SQL*Plus language is easy to use. For example, to rename a column labeled LAST_NAME with the heading «Family Name», enter the command:

Similarly, to list column definitions for the EMPLOYEES table, enter the command:

How Can I Learn SQL*Plus

There are several sources available to assist you to learn SQL*Plus:

Part II of this Guide, Using SQL*Plus

Help for SQL*Plus, Command-line help

Oracle Database 12c: SQL Fundamentals

An instructor-led course run by Oracle. This is a comprehensive hands-on course taking the student through all aspects of using SQL*Plus to access Oracle Database.

More Oracle Database 12c Training

How to Use the SQL*Plus Guide

SQL*Plus Command-line Architecture

SQL*Plus command-line uses a two-tier model comprising:

Client (command-line user interface).

Database (Oracle Database).

The two tiers may be on the same computer.

SQL*Plus Client

The command-line user interface is the character-based terminal implementation.

Oracle Database

Oracle Database Net components provide communication between the SQL*Plus Client and Oracle Database.

SQL*Plus Prerequisites

SQL*Plus is a component of Oracle Database. SQL*Plus is installed by default when you install the Oracle Database.

Some aspects of Oracle Database and SQL*Plus differ from one computer and operating system to another. These topics are discussed in the Oracle Database Installation Guide for each operating system that SQL*Plus supports.

What is necessary before you can run SQL*Plus?

Obtain an Oracle Database login username and password during installation or from your Database Administrator. See Login Username and Password.

Ensure a sample database is installed and that you have a login username and password for it. See About Sample Schemas and SQL*Plus.

Create a default database during installation or obtain the connection identifier for the Oracle Database you want to connect to from your Database Administrator. See About Connecting to a Database.

Ensure the database you want to connect to is started. See the STARTUP command.

SQL*Plus Date Format

The default date format in SQL*Plus is determined by the database NLS_DATE_FORMAT parameter and may use a date format displaying two digit years. You can use the SQL TO_CHAR function, or the SQL*Plus COLUMN FORMAT command in your SELECT statements to control the way dates are displayed in your report.

Starting SQL*Plus Command-line

In the following examples, you are prompted to enter the database account password.

An example using an Easy Connection identifier to connect to the HR schema in the MYDB database running on mymachine is:

An example using a Net Service Name is:

Net Service Names can be stored in several places, including Oracle Names. See the Net Services Reference Guide for more information.

If you want to use Net Service Names configured in a local Oracle Net tnsnames.ora file, then set the environment variable TNS_ADMIN to the directory containing the tnsnames.ora file. For example, on UNIX, if your tnsnames.ora file is in /home/user1 and it defines the Net Service Name MYDB2:

The TWO_TASK (on UNIX) or LOCAL (on Windows) environment variable can be set to a connection identifier. This removes the need to explicitly enter the connection identifier whenever a connection is made in SQL*Plus or SQL*Plus Instant Client. This UNIX example connects to the database known as MYDB4:

To start SQL*Plus and connect to the default database

You are prompted to enter your password.

Now you can start entering and executing SQL, PL/SQL and SQL*Plus statements and commands at the SQL> prompt.

Open a UNIX or a Windows terminal and enter the SQL*Plus command:

You are prompted to enter your password.

About Starting SQL*Plus Instant Client

SQL*Plus Instant Client is the SQL*Plus command-line without the need to install Oracle Database. For information about using it, see Starting SQL*Plus Command-line.

Because SQL*Plus Instant Client does not include a database, it is always ‘remote’ from any database server. To connect to a database you must specify the database using an Oracle Net connection identifier.

If TNS_ADMIN is not set, then an operating system dependent set of directories is examined to find tnsnames.ora. This search path includes looking in the directory specified by the ORACLE_HOME environment variable for network/admin/tnsnames.ora. This is the only reason to set the ORACLE_HOME environment variable for SQL*Plus Instant Client. If ORACLE_HOME is set when running Instant Client applications, it must be set to a directory that exists.

About Connecting to a Different Database

From an existing command-line session, enter a CONNECT command in the form:

You are prompted to enter your password.

About Sample Schemas and SQL*Plus

Sample schemas are no longer included with the Oracle Database. Starting from Oracle Database 21c, you need to download sample schemas from the GitHub repository. Examples in this guide use the EMP_DETAILS_VIEW view of the Human Resources (HR) sample schema. This schema contains personnel records for a fictitious company. To view column details for the view, EMP_DETAILS_VIEW, enter

For more information about the sample schemas, see the Oracle Database Sample Schemas guide.

Unlocking the Sample Tables

The Human Resources (HR) Sample Schema is not installed as part of the default Oracle Database installation. Starting from Oracle Database 21c, you need to download the sample schemas from the GitHub repository. The HR account is locked by default.

You must unlock the HR account before you can use the HR sample schema. To unlock the HR account, log in as the SYSTEM user and enter the following command, where your_password is the password you want to define for the user HR:

For further information about unlocking the HR account, see the Oracle Database Sample Schemas guide. The HR user is primarily to enable you to access the HR sample schema and is necessary to enable you to run the examples in this guide.

And on the following directory on Windows:

To create the HR tables from command-line SQL*Plus, do the following:

On Windows, enter the following command at the SQL*Plus prompt:

To remove the sample tables, perform the same steps but substitute HR_DROP.SQL for HR_MAIN.SQL.

Running your first Query

To describe a database object, for example, column details for EMP_DETAILS_VIEW, enter a DESCRIBE command like:

which produces the following output:

To rename the column headings, and to select data from the HR sample schema view, EMP_DETAILS_VIEW, enter

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Linux and UNIXWindowsDescription