Как настроить oracle sql developer

Установка Oracle SQL Developer на Windows 10 и настройка подключения к базе данных

Приветствую Вас на сайте Info-Comp.ru! Сегодня я расскажу о том, как установить Oracle SQL Developer на операционную систему Windows 10 и настроить подключение к базе данных Oracle Database 18c Express Edition (XE).

Ранее, в материале «Установка Oracle Database 18c Express Edition (XE) на Windows 10», мы подробно рассмотрели процесс установки системы управления базами данных Oracle Database в бесплатной редакции, сегодня, как было уже отмечено, мы рассмотрим процесс установки бесплатного инструмента с графическим интерфейсом, с помощью которого мы можем подключаться к базе данных Oracle, писать и выполнять различные SQL запросы и инструкции, речь идет о стандартном инструменте – Oracle SQL Developer.

Oracle SQL Developer — это бесплатная графическая среда для работы с базами данных Oracle Database, разработанная компанией Oracle. SQL Developer предназначен для разработки баз данных, бизнес-логики в базах данных, а также для написания и выполнения инструкций на языках SQL и PL/SQL.

Установка Oracle SQL Developer на Windows 10

Весь процесс установки Oracle SQL Developer заключается в том, что необходимо скачать дистрибутив программы, извлечь файлы из скаченного ZIP-архива и запустить само приложение, иными словами, SQL Developer — это некая переносимая программа, которая не требует как таковой классической установки.

Сейчас мы рассмотрим те шаги, которые необходимо выполнить, чтобы начать использовать Oracle SQL Developer на Windows 10.

Шаг 1 – Скачивание программы

Oracle SQL Developer доступен на официальном сайте Oracle, и его можно скачать абсолютно бесплатно, единственное, как и в случае с самой СУБД, необходимо авторизоваться или зарегистрироваться на сайте, при этом если Вы скачивали и устанавливали Oracle Database XE, то у Вас уже есть учетная запись Oracle и Вам достаточно авторизоваться на сайте.

Итак, переходим на страницу загрузки Oracle SQL Developer, вот она

Далее, нажимаем на ссылку «Download» в разделе Windows 64-bit with JDK 8 included.

После этого соглашаемся с условиями, отметив соответствующую галочку, и нажимаем на кнопку «Download sqldeveloper-20.2.0.175.1842-x64.zip». Если Вы еще не авторизованы на сайте, Вас перенаправит на страницу авторизации (где можно и зарегистрироваться), а если Вы уже авторизованы, то сразу начнется процесс загрузки.

В результате у Вас должен загрузиться ZIP-архив «sqldeveloper-20.2.0.175.1842-x64.zip» (на момент написания статьи это актуальная версия) размером около 500 мегабайт, в данном архиве находятся все необходимые для SQL Developer файлы.

Шаг 2 – Распаковка архива и запуск программы

После того как архив загрузится, его необходимо распаковать и запустить файл «sqldeveloper.exe».

При первом запуске у Вас могут спросить, есть ли у Вас сохраненные настройки, которые Вам хотелось бы импортировать, у нас таких нет, отвечаем «No».

Примечание. Для запуска программы в Windows требуется MSVCR100.dll. На большинстве компьютеров этот файл уже есть в Windows. Однако, если первая копия файла является 32-битной копией DLL, SQL Developer не запустится. Это можно исправить, если скопировать 64-битную версию DLL в системный каталог «C:\Windows\System32».

В результате запустится программа и сначала появится окно, в котором Вас спросят, хотите ли Вы автоматически отправлять отчеты по работе программы в компанию Oracle, если не хотите, то снимите галочку и нажмите «OK».

Интерфейс Oracle SQL Developer выглядит следующим образом.

Настройка подключения к базе данных Oracle Database 18c Express Edition (XE)

Переходим к настройке подключения к базе данных Oracle Database 18c Express Edition (XE), для этого щелкаем на плюсик и выбираем «New Connection».

После чего у Вас откроется окно настройки подключения, необходимо ввести следующие данные:

  • Name – имя подключения (придумываете сами);
  • Username – имя пользователя, в данном случае подключаемся от имени системного пользователя SYS;
  • Password – пароль пользователя SYS, это тот пароль, который Вы задали во время установки Oracle Database XE;
  • Role – SYSDBA (пользовательSYS является администратором сервера, поэтому выбираем соответствующую роль);
  • Hostname – адрес сервера, если Oracle Database установлен на этом же компьютере, то в поле оставляем Localhost;
  • Port – порт подключения, по умолчанию 1521;
  • Servicename – имя подключаемой базы данных Oracle Database. По умолчанию в Oracle Database 18c Express Edition (XE) создается база данных с именем XEPDB1, поэтому чтобы сразу подключиться к этой базе, вводим в это поле ее название, т.е. XEPDB
Читайте также:  Как настроить китайский айфон 12 промакс

Чтобы проверить корректность всех введенных настроек, можно нажать на кнопку Test, и если Вы получили ответ в строке состояния «Успех», т.е. «Status: Success», то это означает, что все хорошо, сервер доступен и мы можем к нему подключиться с указанными настройками подключения.

Для сохранения подключения нажимаем «Save».

В результате Вы подключитесь к серверу и у Вас отобразится обозреватель объектов и окно для написания SQL запросов.

В Oracle Database 18c Express Edition (XE) есть схема «HR», которую можно использовать, например, для изучения языка SQL.

Заметка! Если Вас интересует язык SQL, то рекомендую почитать книгу «SQL код» – это самоучитель по языку SQL для начинающих программистов. В ней язык SQL рассматривается как стандарт, чтобы после прочтения данной книги можно было работать с языком SQL в любой системе управления базами данных.

Давайте напишем простой запрос SELECT к таблице employees.

Как видим, все работает.

На сегодня это все, надеюсь, материал был Вам полезен и интересен, пока!

Источник

Как провести установку Oracle SQL Developer- инструкция

Oracle SQL Developer это бесплатная графическая среда для того,

чтобы пользователь мог работать с базами данных Oracle Database, которая разработана компанией oracle.

Sql Developer нужен для разработки баз данных, бизнес-логики в базах, и выполнение инструкций на языках SQL и plSQL.

Установка Oracle SQL Developer на Windows 10

Об Oracle SQL Developer

Установка Oracle SQL Developer сводится к тому, что нужно скачать дистрибутив программы, извлечь файлы из архива, запустить приложение. То есть SQL Developer это переносимая программа.

Скачать SQL Developer можно на официальном сайте Oracle, это бесплатно. Нужно будет авторизоваться и зарегистрироваться на сайте, если у вас нет учетной записи oracle.com после этого заходите на страницу загрузки Oracle SQL Developer и нажимаете на ссылку download.

После согласия с условиями, пользователь нажимает на кнопку download и начнется процесс загрузки. Скачается zip-арх ив, который весит примерно 500 Мб. В этом архиве для пользователя будут все необходимые файлы.

Вторым шагом является распаковка архива, и запуск файла по установке программы.

После запуска программы появится окно, где вы ставите галочку об автоматическом отправлении отчетов по работе программы в компанию.

Как настроить подключение к базе данных Oracle Database

Далее начинается настройка подключения к базе данных Oracle Database,

нужно нажать на плюс и выбрать New connections. После того, как откроется окно настройки подключения, пользователю нужно ввести определенные параметры, это имя подключения, имя пользователя, пароль, обозначить роль, адрес сервера, порт подключения, имя подключаемой базы данных.

Для проверки правильности ведения настроек, есть кнопка тест, нажав которую вы получите ответ, успех или нет.

Доля сохраняем внесенную информацию, и можно подключиться к серверу.

При подключении к серверу отображается обозревателя объектов и окно для написания SQL запросов.

Источник

Getting Started with Oracle SQL Developer

Purpose

This tutorial shows introduces Oracle SQL Developer and shows you how to manage your database objects.

Time to Complete

Approximately 50 minutes

Overview

Oracle SQL Developer is a free graphical tool that enhances productivity and simplifies database development tasks. Using SQL Developer, users can browse database objects, run SQL statements, edit and debug PL/SQL statements and run reports, whether provided or created.

Developed in Java, SQL Developer runs on Windows, Linux and the Mac OS X. This is a great advantage to the increasing numbers of developers using alternative platforms. Multiple platform support also means that users can install SQL Developer on the Database Server and connect remotely from their desktops, thus avoiding client server network traffic.

Default connectivity to the database is through the JDBC Thin driver, so no Oracle Home is required. To install SQL Developer simply unzip the downloaded file. With SQL Developer users can connect to any supported Oracle Database, for all Oracle database editions including Express Edition.

Prerequisites

Before starting this tutorial, you should:

  • Install Oracle SQL Developer 2.1 early adopter from OTN here. Follow the readme instructions here.
  • Install the Oracle Database 10g and later.
  • Unlock the HR user. Login to SQL*Plus as the SYS user and execute the following command:
    alter user hr identified by hr account unlock;
  • Download and unzip the sqldev_mngdb.zip file that contains all the files you need to perform this tutorial.
Читайте также:  Вы можете настроить прокси или зайти позже 1xbet

Creating a Database Connection

The first step to managing database objects using Oracle SQL Developer is to create a database connection. Perform the following steps:

Open Oracle SQL Developer.

In the Connections navigator, right-click Connections and select New Connection.

Enter HR_ORCL for the Connection Name (or any other name that identifies your connection), hr for the Username and Password, specify your localhost for the Hostname and enter ORCL for the SID. Click Test.

The status of the connection was tested successfully. The connection was not saved however. Click Save to save the connection, and then click Connect.

The connection was saved and you see the database in the list.

Expand HR_ORCL.

Note: When a connection is opened, a SQL Worksheet is opened automatically. The SQL Worksheet allows you to execute SQL against the connection you just created.

Expand Tables.

Select the Table EMPLOYEES to view the table definition. Then click the Data tab.

The data is shown. In the next topic, you create a new table and populate the table with data.

Adding a New Table Using the Create Table Dialog Box

You create a new table called DEPENDENTS which has a foreign key to the EMPLOYEES table. Perform the following steps:

Right-click Tables and select New TABLE.

Enter DEPENDENTS for the Table Name and click the Advanced check box.

Enter ID for the Name, select NUMBER for the Data type and enter 6 for the Precision. Select the Cannot be NULL check box. Then click the Add Column icon.

Enter FIRST_NAME for the Name, leave type as VARCHAR2 and 20 for the Size. Then click the Add Column icon.

Enter LAST_NAME for the Name, leave type as VARCHAR2 and enter 25 for the Size. Select the Cannot be NULL check box. Then click the Add Column icon.

Enter BIRTHDATE for the Name, select DATE for the Data type. Then click the Add Column icon.

Enter RELATION for the Name, leave type as VARCHAR2 and enter 25 for the Size. Click OK to create the table.

Your new table appears in the list of tables.

Changing a Table Definition

Oracle SQL Developer makes it very easy to make changes to database objects. In this topic, you add a column to the DEPENDENTS table you just created. Perform the following steps:

Select the DEPENDENTS table.

Right-click, select Column then Add.

Enter RELATIVE_ID, select NUMBER from the droplist, set the Precision to 6 and Scale to 0.

Click Apply.

The confirmation verifies that a column has been added.

Click OK.

Expand the DEPENDENTS table to review the updates.

Adding Table Constraints

In this topic, you create the Primary and Foreign Key Constraints for the DEPENDENTS table. Perform the following steps:

Right-click DEPENDENTS table and select Edit.

Click the Primary Key node in the tree.

Select the ID column and click > to shuttle the value to the Selected Columns window.

Select the Foreign Key node in the tree and click Add.

Select EMPLOYEES for the Referenced Table and select RELATIVE_ID for the Local Column and click OK.

Adding Data to a Table

You can add data to the DEPENDENTS table by performing the following steps:

With the DEPENDENTS table still selected, you should have the Data tab already selected. If not, select it.

Then click the Insert Row icon.

Enter the following data and then click the Commit icon to commit the row to the database.

ID: 209
FIRST_NAME: Sue
LAST_NAME: Littlefield
BIRTHDATE: 01-JAN-97
RELATION: Daughter
RELATIVE_ID: 110

The outcome of the commit action displays in the log window.

You can also load multiple rows at one time using a script. Click File Open.

Navigate to the directory where you unzipped the files from the Prerequisites, select the load_dep.sql file and click Open.

Select the HR_ORCL connection in the connection drop list to the right of the SQL Worksheet.

Читайте также:  Как отремонтировать кия для бильярда

The SQL from the script is shown. Click the Run Script icon.

The data was inserted. Click the DEPENDENTS tab.

To view the data, make sure the Data tab is selected and click the Refresh icon to show all the data.

All the data is displayed

You can export the data so it can be used in another tool, for example, Excel. Right-click on one of the values in any column, select Export and then one of the file types, such as csv.

Specify the directory and name of the file and click Apply.

If you review the DEPENDENTS.CSV file, you should see the following:

Accessing Data

One way to access DEPENDENTS data is to generate a SELECT statement on the DEPENDENTS table and add a WHERE clause. Perform the following steps:

Select the HR_ORCL Database Connection, right-click and select Open SQL Worksheet.

Drag and Drop the DEPENDENTS table from the list of database objects to the SQL statement area.

A dialog window appears. You can specify what type of SQL statement to create. Accept the default to create a SELECT statement and click Apply.

Your SELECT statement is displayed. You can modify it in the SQL Worksheet and run it.

Add the WHERE clause where relative_id > 110 to the end of the SELECT statement BEFORE the ‘;’.

Click the Run Statement icon.

The results are shown.

Creating Reports

As the SQL you just ran in the previous topic needs to be executed frequently, you can create a custom report based on the SQL. In addition, you can run a report of your database data dictionary using bind variables. Perform the following steps:

Select the SQL in the HR_ORCL SQL Worksheet that you executed, right-click and select Create Report.

Enter a Name for the report and click Apply.

Select the Reports tab, expand User Defined Reports and select the report you just created.

Select HR_ORCL from the drop list and click OK to connect to your database.

The results of your report are shown.

You can also run a Data Dictionary report. Expand Data Dictionary Reports > Data Dictionary. Then select Dictionary Views..

Deselect the NULL check box, enter col for the Value and click Apply.

All the Data Dictionary views that contain ‘col’ in its name are displayed.

Creating and Executing PL/SQL

Oracle SQL Developer contains extensive PL/SQL editing capabilities. In this topic, you create a Package Spec and Package Body that adjusts an employee’s salary. Perform the following steps:

Select File > Open using the main menu.

Browse to the directory where you unzipped the files from the Prerequisites, select createHRpack.sql Click Open.

Select the HR_ORCL database connection from the the drop list on the right.

Click the Run Script icon.

The package and package body compiled successfully. Click the Connections navigator.

Expand HR_ORCL > Packages > HR_PACK and select HR_PACK to view the package definition.

Double-click HR_PACK BODY to view the package body definition.

Click on any one of the — to collapse the code or press + to expand the code.

If your line numbers do not appear, you can right-click in the line number area and click Toggle Line Numbers to turn them on. This is useful for debugging purposes.

In the Connections Navigator, select Packages > HR_PACK, right-click and select Run.

A parameter window appears. Make sure that the GET_SAL target is selected. You need to set the input parameters here for P_ID and P_INCREMENT .

Set the P_ID to 102 and P_INCREMENT to 1.2 . What this means is that the Employee who has the ID 102, their salary is increased by 20%. The current SALARY for EMPLOYEE_ID 102 is 17000. Click OK.

The value returned is 20400.

To test the Exception Handling, right-click on HR_PACK in the navigator and select Run.

This time, change the P_INCREMENT value to 5 and click OK.

In this case, an exception was raised with «Invalid increment amount» because the P_INCREMENT value was greater than 1.5.

Summary

In this tutorial, you have learned how to:

  • Create a database connection
  • Add a new table using the Table Dialog Box
  • Change a table definition
  • Add data to a table
  • Access data
  • Generate a report
  • Create and execute PL/SQL

Источник

Оцените статью