Kako na jednostavan način ostvariti konekciju sa Oracle bazom  

Quick Start to Oracle Net Connections


 

Kako na jednostavan način ostvariti konekciju sa Oracle bazom.. 1

Quick Start to Oracle Net Connections. 1

Provera mrežne dostupnosti - Confirm Network Availability. 1

Startovati Listener i Oracle DB - Start the Listener and the Database Server 2

Konfiguracija klijenta za konekciju sa bazom - Configure the Client for Connection to a Database. 3

Konekcija sa bazom - Connect to the Database. 3

Koristeći jednostavnu konekciju - Using the Easy Connect Naming Method. 3

Konekcija koristeći ime hosta za razresenje - Establish Host Name Resolution Environment 4

Konekcija koristeći lokalna imena (tnasnames) - Using the Local Naming Method. 4


Provera mrežne dostupnosti - Confirm Network Availability

ping ora10gfs

Pinging ora10gfs [10.128.1.77] with 32 bytes of data:

Reply from 10.128.1.77: bytes=32 time<1ms TTL=128


Startovati Listener i Oracle DB - Start the Listener and the Database Server
 

- Start the listener with the Listener Control utility. From the command line, enter:

lsnrctl
LSNRCTL> START [listener_name]

- Start the database:
SQL> sqlplus /nolog
SQL> CONNECT sys/password as sysdba
SQL> STARTUP database_name pfile=file

- Confirm that database service registration with the listener has completed. From the Listener Control utility

LSNRCTL> SERVICES [listener_name]

Service "glob" has 1 instance(s).
Instance "glob", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "glob_XPT" has 1 instance(s).
Instance "glob", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
 


Konfiguracija klijenta za konekciju sa bazom - Configure the Client for Connection to a Database

%ORACLE_HOME%\network\admin\sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

 

Konekcija sa bazom - Connect to the Database
 

Koristeći jednostavnu konekciju - Using the Easy Connect Naming Method


CONNECT username/password@host[:port][/service_name][/instance_name]

SQL> CONNECT sys/elcaro@server:1521/xe as sysdba
Connected.
SQL> /

HOST_NAME INSTANCE_NAME VERSION DATABASE_STATUS
------------------------------ ---------------- ----------------- -----------------
SERVER xe 10.2.0.1.0 ACTIVE

SQL> CONNECT sys/elcaro@ora10gfs:1521/glob as sysdba
Connected.
SQL> /

HOST_NAME INSTANCE_NAME VERSION DATABASE_STATUS
------------------------------ ---------------- ----------------- -----------------
ORA10GFS glob 10.2.0.1.0 ACTIVE


Konekcija koristeći ime hosta za razresenje - Establish Host Name Resolution Environment
 

Npr. C:\WINDOWS\system32\drivers\etc dodati: IP hostname service_name

10.128.1.139 server xe

SQL> CONNECT sys/elcaro@xe as sysdba
 


Konekcija koristeći lokalna imena (tnasnames) - Using the Local Naming Method
 

The local naming method adds net service names to the tnsnames.ora file.
Each net service name maps to a connect descriptor.

tnsnames.ora

APEX =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora10gfs)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl_xpt)
)
)

SQL> CONNECT sys/elcaro@apex as sysdba
Connected.