Для соединения с БД необходимо использовать класс Connection пакета java.sql. После установления соединения можно выполнять различные SQL-запросы и получать результаты их обработки сервером. Приложение может открыть одно или несколько соединений с одной или несколькими различными СУБД.
Открытие соединения, getConnection
При использовании первого варианта, все параметры подключения указываются в url.
В следующей таблице представлен JDBC driver и синтаксис строки URL для подключения к СУБД.
Подключение к базе данных остается активным до тех пор, пока проект не будет закрыт. При повторном открытии проекта необходимо выполнить повторное подключение, если требуется активное соединение с базой данных.
Метаданные базы данных Oracle не обновляются автоматически. Вместо этого, если необходимо обновить метаданные в обозревателе метаданных Oracle, необходимо вручную обновить их. Дополнительные сведения см. в подразделе «обновление метаданных Oracle» далее в этом разделе.
Необходимые разрешения Oracle
Как минимум, учетная запись, используемая для подключения к базе данных Oracle, должна иметь следующие разрешения:
CONNECT Требуется для подключения (создания сеанса) к базе данных.
SELECT ANY DICTIONARY Требуется для запроса таблиц системных словарей (например, SYS.MLOG$ ), чтобы обнаружить все объекты.
Это позволит SSMA загрузить все объекты схемы, владельцами которых является подключающийся пользователь. В большинстве реальных сценариев существуют ссылки между схемами между хранимыми процедурами, и SSMA должен иметь возможность обнаружить все объекты, на которые имеются ссылки, для успешного преобразования. Чтобы получить метаданные для объектов, определенных в других схемах, учетная запись должна иметь следующие дополнительные разрешения:
SELECT ANY TABLE Требуется для обнаружения таблиц, представлений, материализованных представлений и синонимов в других схемах.
SELECT ANY SEQUENCE Требуется для обнаружения последовательностей в других схемах.
CREATE ANY PROCEDURE требуется для обнаружения PL/SQL для процедур, функций и пакетов в других схемах.
CREATE ANY TRIGGER Требуется для обнаружения определений триггеров в других схемах.
CREATE ANY TYPE Требуется для обнаружения типов, определенных в других схемах.
EXECUTE ANY PROCEDURE Требуется для выполнения процедур и функций, которые необходимо протестировать во всех схемах.
CREATE ANY TABLE и ALTER ANY TABLE Требуется для создания и изменения временных таблиц для отслеживания изменений и резервного копирования.
INSERT ANY TABLE и UPDATE ANY TABLE Требуется для вставки данных отслеживания изменений и резервного копирования во временные таблицы.
DROP ANY TABLE Требуется для удаления временных таблиц, используемых для отслеживания изменений и резервного копирования.
CREATE ANY INDEX и ALTER ANY INDEX Требуется для создания и изменения индексов во временных таблицах, используемых для отслеживания изменений и резервного копирования.
DROP ANY INDEX Требуется для удаления индексов во временных таблицах, используемых для отслеживания изменений и резервного копирования.
CREATE ANY TRIGGER и ALTER ANY TRIGGER Требуется для создания и изменения временных триггеров, используемых для отслеживания изменений.
DROP ANY TRIGGER Требуется для удаления временных триггеров, используемых для отслеживания изменений.
Установление соединения с Oracle
Перед попыткой подключения убедитесь, что сервер базы данных работает и может принимать подключения.
Подключение к Oracle
в меню файл выберите Подключение для Oracle. Если ранее вы подключились к Oracle, имя команды будет повторно подключено к Oracle.
В поле поставщик выберите поставщик клиента Oracle или поставщик OLE DB, в зависимости от того, какой поставщик установлен. Значение по умолчанию — клиент Oracle.
В поле режим выберите стандартный режим, режим тнснаме или режим строки подключения. Используйте стандартный режим для указания имени и порта сервера. Используйте режим имени службы, чтобы вручную указать имя службы Oracle. Используйте режим строки подключения для предоставления полной строки подключения.
Если выбран стандартный режим, укажите следующие значения:
Если выбран режим тнснаме, укажите следующие значения:
В следующем примере показана строка подключения клиента Oracle, использующая встроенную безопасность:
Data Source=MyOracleDB;Integrated Security=yes;
Повторное подключение к Oracle
Подключение к серверу базы данных остается активным до тех пор, пока проект не будет закрыт. При повторном открытии проекта необходимо выполнить повторное подключение, если требуется активное соединение с базой данных. Вы можете работать в автономном режиме, пока не захотите обновить метаданные, загрузить объекты базы данных в SQL Server и перенести данные.
Обновление метаданных Oracle
Метаданные базы данных Oracle не обновляются автоматически. Метаданные в обозревателе метаданных Oracle — это моментальный снимок метаданных при первом подключении или при последнем обновлении вручную метаданных. Метаданные можно обновлять вручную для всех схем, одной схемы или отдельных объектов базы данных.
Обновление метаданных
Убедитесь, что вы подключены к базе данных.
В обозревателе метаданных Oracle установите флажок рядом с каждой схемой или объектом базы данных, которые необходимо обновить.
В диалоговом окне Обновление из базы данных укажите объекты для обновления.
Нажмите кнопку ОК.
Дальнейшие действия
следующим шагом процесса миграции является Подключение экземпляра SQL Server.
During installation, Oracle Universal Installer assigns port numbers to components from a set of default port numbers. This appendix lists the default port numbers and describes how to change the assigned port after installation. It includes information about the following topics:
E.1 About Managing Ports
During installation, Oracle Universal Installer assigns port numbers to components from a set of default port numbers. Many Oracle Database components and services use ports. As an administrator, it is important to know the port numbers used by these services, and to make sure that the same port number is not used by two services on your host.
Most port numbers are assigned during installation. Every component and service has an allotted port range, which is the set of port numbers Oracle Database attempts to use when assigning a port. Oracle Database starts with the lowest number in the range and performs the following checks:
Is the port used by another Oracle Database installation on the host?
The installation may be up or down at the time; Oracle Database can still detect if the port is used.
Is the port used by a process that is currently running?
This could be any process on the host, even a non-Oracle Database process.
Is the port listed in the /etc/services files?
If the answer to any of the preceding questions is yes, Oracle Database moves to the next highest port in the allotted port range and continues checking until it finds a free port.
E.2 Viewing Port Numbers and Access URLs
If you change a port number, it is not updated in the portlist.ini file, so you can only rely on this file immediately after installation. To find or change a port number, use the methods described in this appendix.
E.3 Port Numbers and Protocols of Oracle Components
The following table lists the port numbers and protocols used by components that are configured during the installation. By default, the first port in the range is assigned to the component, if it is available.
Table E-1 Ports Used in Oracle Components
Component and Description
Default Port Number
Port Range
Protocol
Oracle SQL*Net Listener
Allows Oracle client connections to the database over Oracle’s SQL*Net protocol. You can configure it during installation. To reconfigure this port, use Net Configuration Assistant.
Shares the SQL*Net port and is configured during installation. To reconfigure this port, use Net Configuration Assistant to reconfigure the Oracle SQL*Net listener.
1521 (same value as the listener)
Listening port for Oracle client connections to Oracle Connection Manager. It is not configured during installation, but can be configured using Net Configuration Assistant.
Oracle Management Agent
HTTP port for Enterprise Management Agent. It is configured during installation.
Oracle Enterprise Manager Database Console
HTTP port for Enterprise Manager Database Control. It is configured during installation. «Changing the Oracle Enterprise Manager Database Console Ports» explains how to modify its port number.
Oracle Enterprise Manager Database Console
RMI port for Enterprise Manager Database Control. It is configured during installation.»Changing the Oracle Enterprise Manager Database Console Ports» explains how to modify its port number.
Enterprise Manager Database Console
JMS port for Enterprise Manager Database Control. It is configured during installation. «Changing the Oracle Enterprise Manager Database Console Ports» explains how to modify its port number.
HTTP port for i SQL*Plus. The port number is automatically assigned during installation. «Changing the i SQL*Plus Ports» explains how to change its port number.
RMI port for i SQL*Plus. The port number is automatically assigned during installation.»Changing the i SQL*Plus Ports» explains how to change its port number.
JMS port for i SQL*Plus. The port number is automatically assigned during installation. «Changing the i SQL*Plus Ports» explains how to change its port number.
Oracle Ultra Search
HTTP port for Oracle Ultra Search. Its port number is assigned automatically when you install Oracle Ultra Search, by using the Custom installation type. «Changing the Oracle Ultra Search Ports» explains how to change its port number.
Oracle Ultra Search
RMI port for Oracle Ultra Search. Its port number is assigned automatically when you install Oracle Ultra Search, by using the Custom installation type. «Changing the Oracle Ultra Search Ports» explains how to change its port number.
Oracle Ultra Search
JMS port for Oracle Ultra Search. Its port number is assigned automatically when you install Oracle Ultra Search, by using the Custom installation type. «Changing the Oracle Ultra Search Ports» explains how to change its port number.
The Oracle XML DB HTTP port is used if Web-based applications need to access an Oracle database from an HTTP listener. It is configured during installation, but you cannot view it afterward. «Changing the Oracle XML DB Ports» explains how to change its port number.
The Oracle XML DB FTP is used when applications need to access an Oracle database from an FTP listener. It is configured during installation, but you cannot view it afterward. «Changing the Oracle XML DB Ports» explains how to change its port number.
Oracle Real Application Clusters (Local Host: Windows only)
Oracle Real Application Clusters (Cluster Interconnect: Windows only)
Oracle Real Application Clusters (UNIX)
The port number is assigned automatically during installation. You cannot view or modify it afterward.
CRS daemon (Oracle Cluster Ready Services Daemon) internode connection. The port number is assigned automatically during installation. You cannot view or modify it afterward.
Cluster Synchronization Service (CSS)
CSS daemon internode connection for the GM layer. The port number is assigned automatically during installation. You cannot view or modify it afterward.
Oracle Cluster Registry
The port number is assigned automatically during installation. You cannot view or modify it afterward.
Oracle Event Manager
The port number is assigned automatically during installation. You cannot view or modify it afterward.
The port number is assigned automatically during installation. You cannot view or modify it afterward.
E.4 Changing the Oracle Enterprise Management Agent Port
E.5 Changing the Oracle Enterprise Manager Database Console Ports
To find the current HTTP, RMI, and JMS port settings, search in the following files:
where option can be:
DBCONTROL_HTTP_PORT : Sets the HTTP port, for example:
RMI_PORT : Sets the RMI port, for example:
JMS_PORT : Sets the JMS port, for example:
E.6 Changing the i SQL*Plus Ports
The following sections describe how to change the i SQL*Plus ports.
Changing the HTTP Port
To change the HTTP port, edit the following files:
Modify the following port parameters (for example, 5560 ) in the file:
Modify the port attribute of the web-site element:
Changing the RMI Port
Changing the JMS Port
E.7 Changing the Oracle Ultra Search Ports
The following sections describe how to change the Oracle Ultra Search ports.
Changing the HTTP Port
Changing the RMI Port
Changing the JMS Port
E.8 Changing the Oracle XML DB Ports
To change the Oracle XML DB ports:
Log into SQL*Plus or i SQL*Plus as SYS or XDB using the SYSDBA role.
For example, to log in to SQL*Plus as SYS using the password welcome :
Run the catxdbdbca.sql script.
For example, to use 2200 for the FTP port and 8200 for the HTTP port, and assuming your Oracle home is in the following location, enter the following command:
Через какой порт осуществляется подключение к бд oracle
Product Default Port Number How do I change the port number? Listener 1521 Modify the LISTENER.ORA and TNSNAMES.ORA files, using Net8 Assistant. These files are located in the ORACLE_BASE\ORACLE_HOME\NETWORK\ADMIN directory, or in the directory specified by the TNS_ADMIN environment variable or registry value. Oracle Names 1575 Modify the NAMES.ORA file, using Net8 Assistant. NAMES.ORA is located in the ORACLE_BASE\ORACLE_HOME\NETWORK\ADMIN directory. Oracle Connection Manager, using TCP/IP 1630
1830 Modify the CMAN.ORA configuration file, using Net8 Assistant. CMAN.ORA is located in the ORACLE_BASE\ORACLE_HOME\NETWORK\ADMIN directory, or in the directory specified by the TNS_ADMIN environment variable or registry value
Recommended Port Numbers Oracle Corporations recommends the following port numbers:
Port Description 1521 Default listening port for client connections to the listener. In future releases, this port number may change to the officially registered port number of 2483 for TCP/IP and 2484 for TCP/IP with SSL.
2481 Recommended and officially registered listening port for client connections to the Oracle8i JServer option using TCP/IP
2482 Recommended and officially registered listening port for client connections to the Oracle8i JServer using TCP/IP with SSL
2484 Recommended and officially registered listening port for client connections to the listener using TCP/IP with SSL
1575 Default and officially registered listening port for client connections to an Oracle Names server using TCP/IP or TCP/IP with SSL
1630 Default and officially registered listening port for client connections to Oracle Connection Manager
1830 Default and officially registered listening port for administrative commands to Oracle Connection Manager
During installation, Oracle Universal Installer assigns port numbers to components from a set of default port numbers. This appendix lists the default port numbers and describes how to change the assigned port after installation. It includes information about the following topics:
E.1 About Managing Ports
During installation, Oracle Universal Installer assigns port numbers to components from a set of default port numbers. Many Oracle Database components and services use ports. As an administrator, it is important to know the port numbers used by these services, and to make sure that the same port number is not used by two services on your host.
Most port numbers are assigned during installation. Every component and service has an allotted port range, which is the set of port numbers Oracle Database attempts to use when assigning a port. Oracle Database starts with the lowest number in the range and performs the following checks:
Is the port used by another Oracle Database installation on the host?
The installation may be up or down at the time; Oracle Database can still detect if the port is used.
Is the port used by a process that is currently running?
This could be any process on the host, even a non-Oracle Database process.
Is the port listed in the /etc/services files?
If the answer to any of the preceding questions is yes, Oracle Database moves to the next highest port in the allotted port range and continues checking until it finds a free port.
E.2 Viewing Port Numbers and Access URLs
If you change a port number, it is not updated in the portlist.ini file, so you can only rely on this file immediately after installation. To find or change a port number, use the methods described in this appendix.
E.3 Port Numbers and Protocols of Oracle Components
The following table lists the port numbers and protocols used by components that are configured during the installation. By default, the first port in the range is assigned to the component, if it is available.
Table E-1 Ports Used in Oracle Components
Component and Description
Default Port Number
Port Range
Protocol
Oracle SQL*Net Listener
Allows Oracle client connections to the database over Oracle’s SQL*Net protocol. You can configure it during installation. To reconfigure this port, use Net Configuration Assistant.
Shares the SQL*Net port and is configured during installation. To reconfigure this port, use Net Configuration Assistant to reconfigure the Oracle SQL*Net listener.
1521 (same value as the listener)
Listening port for Oracle client connections to Oracle Connection Manager. It is not configured during installation, but can be configured using Net Configuration Assistant.
Oracle Management Agent
HTTP port for Enterprise Management Agent. It is configured during installation.
Oracle Enterprise Manager Database Console
HTTP port for Enterprise Manager Database Control. It is configured during installation. «Changing the Oracle Enterprise Manager Database Console Ports» explains how to modify its port number.
Oracle Enterprise Manager Database Console
RMI port for Enterprise Manager Database Control. It is configured during installation.»Changing the Oracle Enterprise Manager Database Console Ports» explains how to modify its port number.
Enterprise Manager Database Console
JMS port for Enterprise Manager Database Control. It is configured during installation. «Changing the Oracle Enterprise Manager Database Console Ports» explains how to modify its port number.
HTTP port for i SQL*Plus. The port number is automatically assigned during installation. «Changing the i SQL*Plus Ports» explains how to change its port number.
RMI port for i SQL*Plus. The port number is automatically assigned during installation.»Changing the i SQL*Plus Ports» explains how to change its port number.
JMS port for i SQL*Plus. The port number is automatically assigned during installation. «Changing the i SQL*Plus Ports» explains how to change its port number.
Oracle Ultra Search
HTTP port for Oracle Ultra Search. Its port number is assigned automatically when you install Oracle Ultra Search, by using the Custom installation type. «Changing the Oracle Ultra Search Ports» explains how to change its port number.
Oracle Ultra Search
RMI port for Oracle Ultra Search. Its port number is assigned automatically when you install Oracle Ultra Search, by using the Custom installation type. «Changing the Oracle Ultra Search Ports» explains how to change its port number.
Oracle Ultra Search
JMS port for Oracle Ultra Search. Its port number is assigned automatically when you install Oracle Ultra Search, by using the Custom installation type. «Changing the Oracle Ultra Search Ports» explains how to change its port number.
The Oracle XML DB HTTP port is used if Web-based applications need to access an Oracle database from an HTTP listener. It is configured during installation, but you cannot view it afterward. «Changing the Oracle XML DB Ports» explains how to change its port number.
The Oracle XML DB FTP is used when applications need to access an Oracle database from an FTP listener. It is configured during installation, but you cannot view it afterward. «Changing the Oracle XML DB Ports» explains how to change its port number.
Oracle Real Application Clusters (Local Host: Windows only)
Oracle Real Application Clusters (Cluster Interconnect: Windows only)
Oracle Real Application Clusters (UNIX)
The port number is assigned automatically during installation. You cannot view or modify it afterward.
CRS daemon (Oracle Cluster Ready Services Daemon) internode connection. The port number is assigned automatically during installation. You cannot view or modify it afterward.
Cluster Synchronization Service (CSS)
CSS daemon internode connection for the GM layer. The port number is assigned automatically during installation. You cannot view or modify it afterward.
Oracle Cluster Registry
The port number is assigned automatically during installation. You cannot view or modify it afterward.
Oracle Event Manager
The port number is assigned automatically during installation. You cannot view or modify it afterward.
The port number is assigned automatically during installation. You cannot view or modify it afterward.
E.4 Changing the Oracle Enterprise Management Agent Port
E.5 Changing the Oracle Enterprise Manager Database Console Ports
To find the current HTTP, RMI, and JMS port settings, search in the following files:
where option can be:
DBCONTROL_HTTP_PORT : Sets the HTTP port, for example:
RMI_PORT : Sets the RMI port, for example:
JMS_PORT : Sets the JMS port, for example:
E.6 Changing the i SQL*Plus Ports
The following sections describe how to change the i SQL*Plus ports.
Changing the HTTP Port
To change the HTTP port, edit the following files:
Modify the following port parameters (for example, 5560 ) in the file:
Modify the port attribute of the web-site element:
Changing the RMI Port
Changing the JMS Port
E.7 Changing the Oracle Ultra Search Ports
The following sections describe how to change the Oracle Ultra Search ports.
Changing the HTTP Port
Changing the RMI Port
Changing the JMS Port
E.8 Changing the Oracle XML DB Ports
To change the Oracle XML DB ports:
Log into SQL*Plus or i SQL*Plus as SYS or XDB using the SYSDBA role.
For example, to log in to SQL*Plus as SYS using the password welcome :
Run the catxdbdbca.sql script.
For example, to use 2200 for the FTP port and 8200 for the HTTP port, and assuming your Oracle home is in the following location, enter the following command: