Showing posts with label Net Services. Show all posts
Showing posts with label Net Services. Show all posts

Saturday, January 9, 2010

What is Tnsnames.ora and sample Tnsnames.ora in Oracle

What is TNSNAMES.ORA
The TNSNAMES.ORA is a configuration file and the entry inside this file is used to connect to a oracle database server. This file exist in oracle client pc and from the client computer this file entry is used to resolve oracle service to establish connection to oracle server. It is nothing but contains net service names mapped to connect descriptors for the local naming method, or net service names mapped to listener protocol addresses. Note that we can easily connect to oracle database server without the help of tnsnames.ora. We can connection to oracle database server using easy naming service which is discuss in the topic Easy Naming Service.

Inside the TNSNAMES.ORA an entry is called name service name or simply TNS entry. It is an alias mapped to a database network address contained in a connect descriptor. A connect descriptor contains the location of the listener through a protocol address and the service name of the database to which to connect.

Find out the location of TNSNAMES.ORA
Based on the operating system default path of tnsnames.ora file is mentioned below.

i)Windows 3.x client
ORAWIN\NETWORK\ADMIN directory

ii)Windows 95/98 client
SQL*Net 2.x - ORAWIN95\NETWORK\ADMIN
Net8 - ORAWIN95\NET80\admin
Net8i - ORACLE\ORA81\NETWORK\ADMIN

iii)Windows NT client
SQL*Net 2.x - ORANT\NETWORK\ADMIN
Net8 - ORANT\NET80\ADMIN
Net8i - ORACLE\ORA81\NETWORK\ADMIN

iv)UNIX Client
$ORACLE_HOME/NETWORK/ADMIN
or /etc
or /var/opt/oracle

But if we set the TNS_ADMIN environment variable or registry value then that location override the default location.

Sample TNSNAMES.ORA
<alias>= [ (DESCRIPTION_LIST =  # Optional depending on whether u have 
# one or more descriptions
# If there is just one description, unnecessary ]
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=) ]
(PROTOCOL=tcp)
(HOST=)
(PORT=)
)
[ (ADDRESS=
(PROTOCOL=ipc)
(KEY=)
)
]
[ (ADDRESS=
[ (COMMUNITY=) ]
(PROTOCOL=decnet)
(NODE=)
(OBJECT=)
)
]
... # More addresses
[ ) ] # Optional depending on whether ADDRESS_LIST is used or not
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]
[ (SOURCE_ROUTE=yes) ]
)
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= ] # Optional depending on whether u have more
# than one address or not
# If there is just one address, unnecessary
(ADDRESS
[ (COMMUNITY=) ]
(PROTOCOL=tcp)
(HOST=)
(PORT=)
)
[ (ADDRESS=
(PROTOCOL=ipc)
(KEY=)
)
]
... # More addresses
[ ) ] # Optional depending on whether ADDRESS_LIST
# is being used
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]
[ (SOURCE_ROUTE=yes) ]
)
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]

where ... # More descriptions
[ ) ] # Optional depending on whether DESCRIPTION_LIST is used or not

From the above sample TNSNAMES.ORA syntax you can easily made your own TNSNAMES.ORA alias.

Following is an example of TNSNAMES.ORA from my machine.

LISTENER_LOCAL =
  (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = ARJU)(PORT = 1521))
       (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.1)(PORT = 1522))
  )

ORCL =
   (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ARJU)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.1)(PORT = 1522))
      (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
      )
   )

First one is for resolving listener name and second one is the tns alias resolving net service name. Based on your server setting you can simply use one ADDRESS from the two shown above and for your client computer you only need to use ORCL like tns alias. To make it easy understandable I have made the color red which need to be changed for your environment setting.

For example if your
database machine IP Address is 10.1.1.2 and
database service name is PROD8
database running on listener port 1521
then in your client computer the TNS entry inside the TNSNAMES.ORA file will look like below,
TNS_ALIAS=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =10.1.1.2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD8)
)
)

Then you can use TNS_ALIAS name to connect to database server from a client machine.


The following example shows a tnsnames.ora file configured for client load balancing:
sales_server=
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521)))
(CONNECT_DATA=
(SERVICE_NAME=sales.com)))
The following example shows a tnsnames.ora file configured for connect-time failover:
sales_server=
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=off)
(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=sales.com)))

Related Documents
http://arjudba.blogspot.com/2010/01/service-names-using-ldap-fails-with-tns.html
http://arjudba.blogspot.com/2010/01/troubleshoot-ora-12154-tns-12154-tns.html
http://arjudba.blogspot.com/2009/11/list-of-oracle-networking-components.html
http://arjudba.blogspot.com/2009/11/network-connection-in-oracle-using.html
http://arjudba.blogspot.com/2008/10/ora-28547-connection-to-server-failed.html
http://arjudba.blogspot.com/2008/08/ora-12560-tnsprotocol-adapter-error-on.html
http://arjudba.blogspot.com/2008/06/ora-12154-tnscould-not-resolve-connect.html
http://arjudba.blogspot.com/2008/06/ora-12641-authentication-service-failed.html

Thursday, January 7, 2010

Service Names Using LDAP Fails With TNS-03505 and ORA-12154

Problem Description
It is used LDAP, sqlnet.ora entry is NAMES.DIRECTORY_PATH = (LDAP) and Tnsping fails with TNS-03505: Failed to resolve name or TNS-12154 / ORA-12154: TNS:could not resolve service name.

Problem Symptom
- Service name is registered in Internet Directory tree.
- Internet Directory tree is configured for service name resolution.
- If we look at sqlnet.ora trace file we will see the text 'Directory server type is 4096'.

Cause of the Problem
In LDAP, the problem occurs if oracle cannot locate the ldap.ora file. Directory server type 4096 stands for "unknown", which indicates that the client is not able to pickup the ldap.ora file.

Solution of the Problem
If you use TNSNAMES.ORA then for the solution of this problem look at http://arjudba.blogspot.com/2010/01/troubleshoot-ora-12154-tns-12154-tns.html.

In case of LDAP configuration,
On windows, ensure that there is a correctly configured ldap.ora file on the client in the ORACLE_HOME\network\admin directory.

On Unix, ensure that ldap.ora file on the client exist on $ORACLE_HOME/network/admin
directory.
In some types of installations on unix, there may be an ldap.ora file in ORACLE_HOME\ldap\admin directory.

On Oracle9i the ldap.ora file can also be placed in the directory defined by the TNS_ADMIN environment variable.

Following is an example of ldap.ora:
DEFAULT_ADMIN_CONTEXT = "dc=no,dc=oracle,dc=com"
DIRECTORY_SERVERS= (hostname:389:636)
DIRECTORY_SERVER_TYPE = OID
Related Documents 
ORA-12560: TNS:protocol adapter error on windows machine while starting oracle 
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor 
Startup fails with oracle error ORA-00119, ORA-00132
http://arjudba.blogspot.com/2010/01/troubleshoot-ora-12154-tns-12154-tns.html

Troubleshoot ORA-12154 TNS-12154 TNS-03505: Failed to resolve name

In this document I will discuss step by step solutions for ORA-12154, TNS-12154 and TNS-03505. About ORA-12154 it is already discussed in Troubleshoot ORA-12154. This post will be applicable to troubleshoot for both ORA-12154, TNS-12154 and TNS-03505.

What Oracle Says about the Problem
If you open http://arjudba.blogspot.com/2008/06/how-to-get-oracle-error-message-from.html you will see about the description of TNS-12154 or ORA-12154 they are telling same like below.
Oracle Error : TNS-12154
TNS: could not resolve the connect identifier specified

Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.

Action:
- If you are using local naming (TNSNAMES.ORA file):

- Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)

- Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.

- Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.

- Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.

- If you are using directory naming:

- Verify that "LDAP" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

- Verify that the LDAP directory server is up and that it is accessible.

- Verify that the net service name or database name used as the connect identifier is configured in the directory.

- Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier

- If you are using easy connect naming:

- Verify that "EZCONNECT" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

- Make sure the host, port and service name specified are correct.

- Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.

For case TNS-03505: it says
TNS-03505: Failed to resolve name
Cause: The service name you provided could not be found in TNSNAMES.ORA, an Oracle Names server, or a native naming service.
Action: Verify that you entered the service name correctly. You may need to ensure that the name was entered correctly into the network configuration.

which indicates for both ORA-12154, TNS-12154 and TNS-03505 we will have a generic solution.


Step 01: Overview of the Problem
Both ORA-12154, TNS-12154 and TNS-03505 indicates that SQL*Net could not find the alias specified for a connection in the TNSNAMES.ORA file or other naming adapter.

As the problem is regarding TNSNAMES.ORA and SQLNET.ORA so in order to dig into solution it is important to print out or a view of both the TNSNAMES.ORA and the SQLNET.ORA files. Looking at these files at the same time is helpful since references will be made to both.

Step 02: Identify the location of TNSNAMES.ORA and SQLNET.ORA
It is necessary to locate the location of TNSNAMES.ORA and SQLNET.ORA. If you simply use tnsping dummy it will say the location of SQLNET.ORA and there TNSNAMES.ORA should be in the same location.
E:\Documents and Settings\Arju>tnsping dummy

TNS Ping Utility for 32-bit Windows: Version 11.1.0.6.0 - Production on 08-JAN-2010 11:00:46

Copyright (c) 1997, 2007, Oracle. All rights reserved.

Used parameter files:
D:\app\Arju\product\11.1.0\db_1\network\admin\sqlnet.ora
TNS-03505: Failed to resolve name
From the above output we see both of these files are located in the path D:\app\Arju\product\11.1.0\db_1\network\admin\.

Through above ways we can determine current path of these two files. However it is important to know the default path of these files. Based on the operating system default path are mentioned below.

i)Windows 3.x client
ORAWIN\NETWORK\ADMIN directory

ii)Windows 95/98 client
SQL*Net 2.x - ORAWIN95\NETWORK\ADMIN
Net8 - ORAWIN95\NET80\admin
Net8i - ORACLE\ORA81\NETWORK\ADMIN

iii)Windows NT client
SQL*Net 2.x - ORANT\NETWORK\ADMIN
Net8 - ORANT\NET80\ADMIN
Net8i - ORACLE\ORA81\NETWORK\ADMIN

iv)UNIX Client
$ORACLE_HOME/NETWORK/ADMIN
or /etc
or /var/opt/oracle

Step 03: Print out or View both TNSNAMES.ORA and SQLNET.ORA.
Following is the correct TNSNAMES.ORA from my system
# tnsnames.ora Network Configuration File: D:\app\Arju\product\11.1.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

A =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ARJU)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = a)
)
)
Following is the correct SQLNET.ORA from my system.
# sqlnet.ora Network Configuration File: D:\app\Arju\product\11.1.0\db_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)


Step 04: Check several factors one by one.
To Troubleshoot problem let's start with some complex TNSNAMES.ORA and SQLNET.ORA.
TNSNAMES.ORA Experimental Sample
DEV.WORLD = 
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 10.1.1.1)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
SQLNET.ORA Experimental Sample
TRACE_LEVEL_CLIENT = OFF 
SQLNET.AUTHENTICATION_SERVICES = (NONE)
NAMES.DIRECTORY_PATH = (TNSNAMES)
AUTOMATIC_IPC = OFF
i) Determine which tns entry you used to connect. For example if you used dummy then issue a tnsping dummy and ensure that the entry DUMMY must exist in the TNSNAMES.ORA.

For example, my "tnsping a" worked because in my TNSNAMES.ORA I have an entry regarding alias A which I have pasted my TNSNAMES.ORA above.
E:\Documents and Settings\Arju>tnsping a

TNS Ping Utility for 32-bit Windows: Version 11.1.0.6.0 - Production on 08-JAN-2010 11:00:34

Copyright (c) 1997, 2007, Oracle. All rights reserved.

Used parameter files:
D:\app\Arju\product\11.1.0\db_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ARJU)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = a)))
OK (330 msec)

tnsping dummy will fail because there is no entry in my TNSNAMES.ORA with name dummy and also connection with dummy will fail too.
Make sure by using IP Address entry instead of hostname inside TNSNAMES.ORA. So use HOST=192.168.1.1 something like that instead of HOST=ARJU.

ii) Check both file again and ensure that there is no CTRL-A (^A) or CTRL-C (^C) characters inserted at the ends of any lines.

iii) If both are fine check the TNSNAMES.ORA alias. Here in our experimental sample it is DEV.WORLD which means .WORLD is our domain and it should be specified it our SQLNET.ORA. So add the parameter NAMES.DEFAULT_DOMAIN = world anywhere in the SQLNET.ORA file. Save the file, and try the connection again.

iv) If within the TNSNAMES.ORA there is no default domain in the alias*(for example it is simply DEV but not DEV.WORLD) then remove NAMES.DEFAULT_DOMAIN = world from the SQLNET.ORA file if there existed. After removing the parameter, save the SQLNET.ORA file, and try connecting again.

v) If the parameter NAMES.DIRECTORY_PATH exists in the SQLNET.ORA file, make sure the value in parenthesis lists TNSNAMES. For example following two examples are valid entry.
NAMES.DIRECTORY_PATH=(TNSNAMES) 
NAMES.DIRECTORY_PATH=(TNSNAMES, HOSTNAME)
Though NAMES.DIRECTORY_PATH parameter is not needed, but if it exists then it should look ok. After removing it you can try connecting again.

vi) At this phase the configuration files are most likely technically accurate.
Now you have to ensure that your TNSNAMES.ORA is in the correct location and you have used correct TNS entry while connecting. The TNS location can be set by TNS_ASMIN environmental variable.

On your Unix environment,
% echo $TNS_ADMIN

If nothing is returned, try setting the TNS_ADMIN environment variable to explicitly point to the location of the TNSNAMES.ORA file.

In C Shell, the syntax is:
% setenv TNS_ADMIN full_path_to_tnsnames.ora_file

In K Shell, the syntax is:
% TNS_ADMIN=full_path_to_tnsnames.ora_file; export TNS_ADMIN

After setting try the connection/tnsping again.

In case of Windows 3.x,
- TNS_ADMIN is set in the ORACLE.INI.

- Look in the C:\WINDOWS directory for the ORACLE.INI file. Look for the parameter TNS_ADMIN. TNS_ADMIN is a parameter that can be set to have SQL*Net point to an alternate location for the configuration files.
- Search for duplicate TNSNAMES.ORA and SQLNET.ORA files.
- Make sure none exist.
- Once you are sure try the connection/tnsping again.

In case of Windows 95/98,
- Open the file ORACLE_HOME\bin\oracle.key.
- Search for Registry under the location specified by the .key file, such as HKEY_LOCAL_MACHINE\Software\Oracle\Home1 for a parameter called TNS_ADMIN.
- TNS_ADMIN is a parameter that can be set to have SQL*Net point to an alternate location for the configuration files.
- Search for duplicate TNSNAMES.ORA and SQLNET.ORA files.
- Make sure none exist.
- Once you are sure try the connection/tnsping again.

In case of Windows XP,
- Make sure TNS_ADMIN environemental points to correct location. Ensure that there must not exist both user variable or system variable environmental variable. If nothing exist you can add one user variable. To set user/system variable,
-- Right click on My computer
-- Click Properties.
-- Click Advanced Tab.
-- Click Environemental Variables.
-- You can have both User and System Variables there.
You can add, edit or delete variables. You can simply add TNS_ADMIN and its location in the user variable section. Note that Variable Name would be "TNS_ADMIN" and variable would be "The location of the TNSNAMES.ORA in your client environement."

- After you set try connection again.

Your problem would be resolved.
Related Documents
ORA-12560: TNS:protocol adapter error on windows machine while starting oracle
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Startup fails with oracle error ORA-00119, ORA-00132

Sunday, November 15, 2009

List of Oracle Networking Components

Oracle provide following networking components which help to build up network services between application client and oracle database server.

1) Oracle Net
2) Oracle Net Listener
3) Oracle Connection Manager
4) Networking Tools
5) Oracle Advanced Security

1) Oracle Net:
Oracle Net is software layer that resides on the client and the Oracle database server.
It is responsible for establishing and maintaining the connection between the client
application and oracle server, as well as exchanging messages between them.
Oracle Net has two software components.
a)Oracle Net Foundation Layer.
b)Oracle Protocol Support.

How Connection is established
- On the client side, client application communicates with Oracle Net Foundation Layer to establish and maintain connections.

- Oracle Foundation Layer then uses Oracle Protocol Support which in turn communicate with Oracle Database Server.

- Oracle Protocol Support uses any Network protocol (for example TCP/IP) in order to transfer request from client to Server.

- On the server side request from Network protocol is transferred to Oracle Protocol Support Layer which then passes request to Oracle Net Foundation Layer.

- Oracle Net foundation layer then communicates with the Oracle database server to
process the client request.

Here is the list of Network protocol that is supported by Oracle Protocol Support.
- TCP/IP
- TCP/IP with SSL
- Named Pipes
- SDP

2) Oracle Net Listener:
Oracle Net Listener also called simply listener only resides in oracle server. It acts as brokers of a client request, handing off the request to the server. The listener is configured with a protocol address. Clients configured with the same
protocol address can send connection requests to the listener. Once a connection is
established, the client and Oracle database server communicate directly with one another.

3) Oracle Connection Manager:
Oracle Connection Manager is a software component that resides neither in client computer nor in an Oracle database server. It proxies and screens requests for the database server. Also, it multiplexes database sessions.

It funnels multiple sessions through a single transport protocol connection to a particular destination. This reduces the demand on resources needed to maintain multiple sessions between two processes by enabling the Oracle database server to use fewer connection end points for incoming requests.

4) Networking Tools:
Oracle Net Configuration Assistant(netca) is a tool that enables you to configure
listeners and naming methods. You can access Net Configuration Assistant by simply typing netca in the command prompt.

5) Oracle Advanced Security:
Oracle Advanced Security is a separately licensable product that provides a comprehensive suite of security features for the Oracle environment.
Related Documents
http://arjudba.blogspot.com/2008/08/configure-network-for-oracle-rac.html

Thursday, November 12, 2009

Network connection in oracle using Oracle Net

Oracle Net is a component of oracle network services. Oracle net enables a network session from a client to an oracle database server. After the network session is established Oracle Net acts a data courier between client and server. Oracle Net is responsible for,

- Establishing connection between client application and oracle database server.
- Maintaining connection between client application and oracle database server.
- Exchanging messages between them.

Connection to oracle database server from client application can be categorized into three topics.

1. Client/Server Application Connections.
2. Web Client Application Connections.
3. Web Client Connections Without an Application Web Server.

1. Client/Server Application Connections:
Oracle Net software component resides on both client and database server.

Client Application like Java client applications access an Oracle database through a Java Database Connectivity (JDBC) Driver, a standard Java interface for connecting from Java to a relational database.

Oracle offers the following drivers,
- JDBC OCI Driver for client side use with an Oracle client installation
- JDBC Thin Driver for client side use without an Oracle installation, particularly
with applets.

Both of JDBC OCI Driver and JDBC Thin driver use Oracle Net to enable connectivity between a client application and an Oracle database.

2. Web Client Application Connections:
This is similar to Client/Server Application connections except that here browser and web server comes into play.

- The browser on the client communicates with the HTTP protocol to a Web server to make a connection request.
- The Web server sends the request to an application where it is processed.
- The application then uses Oracle Net to communicate with an Oracle database server which is also configured with Oracle Net.

3. Web Client Connections Without an Application Web Server:
Without any web server web client can directly communicate with an oracle database. For example java applet. Also oracle database can be configured to accept HTTP protocol, FTP protocol, or WebDAV protocol connections. These protocols are used for connections to Oracle XML DB in the Oracle database instance.

Related Documents
http://arjudba.blogspot.com/2008/08/configure-network-for-oracle-rac.html

Monday, October 13, 2008

ORA-28547 connection to server failed, probable Net8 admin error

Error Description
This problem occurs on windows machine. Whenever you login as a user of windows domain group then in the database all connections both local and remote, including SYSDBA, fail with an ORA-28547.

ORA-28547 connection to server failed, probable Net8 admin error

Cause of the Problem
Oracle Native Authentication Services is failing.

Solution of the Problem
Way 1:
Disable Oracle Native Authentication Services. In the server machine inside sqlnet.ora change the parameter value of SQLNET.AUTHENTICATION_SERVICES from (NTS) to (NONE).

Way 2:
Change the database service to run as a user who is a member of the Domain Admin group. Because in order to connect using native authentication service oracle Log on user must be a privileged user to allow it to correctly authenticate the client user for Native Authentication.

To do so,
1.Go to Services. Right click on My computer>Select Manage>Select Services and Application> Select Services> On the right side From a list Scroll to your OracleService$ORACLE_SID
You will search for your database name instead of $ORACLE_SID of OracleService$ORACLE_SID.

2. Right click on the service and click the properties of the database service, select the LogOn tab.

3. Select "This Account" and add you domain admin account details and Ok

4. Shutdown the database

5. Stop and restart the service

Friday, August 15, 2008

ORA-12560: TNS:protocol adapter error on windows machine while starting oracle

Error Description
On my windows server machine whenever I try to logon to database as a sysdba user it fails with the message ORA-12560.
C:\Documents and Settings\Oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 16 11:01:58 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ERROR:
ORA-12560: TNS:protocol adapter error

Cause of The Error
Oracle classify this as a 'generic protocol adapter error'. In my experience while practice the happening of this error oracle indicates that Oracle client does not know what instance to connect to or what TNS alias to use.

Solution of The Problem
1)If you have server running then while connecting to database as a sysdba user ensure that you have set properly your ORACLE_SID variable. Try explicitly set your envionmental variable on windows machine by,
>set ORACLE_SID=db_name

2)Ensure that you have right services running on your database. You can check whether oracle is running or not by right click on taskbar then select task manager and see whether oracle.exe is running or not.

If it is not running then it is likely to get ORA-12560: TNS:protocol adapter error on your windows machine. To avoid this error you have to run the service. You can do it from right click on my computer> select manage> Click on services and Applications> Double click on services> find the service name OracleSERVICE$ORACLE_SID. If your database name is ARJU then find the service name OracleSERVICEARJU and start it.

You can start the service also by command prompt,
C:>sc start OracleSERVICE$ORACLE_SID

Using oradim by,
C:>oradim -startup -sid $ORACLE_SID

After starting try to connect to database as sysdba and likely you will be able to connect to your database.

C:\Documents and Settings\Oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 16 11:03:16 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

3)If you are connecting to a remote database then try easy naming method. Don't try to connect by tnsnames alias. Easy naming method is described in http://arjudba.blogspot.com/2008/06/ora-12514-tnslistener-does-not.html

4)Ensure that you are using correct tnsnames.ora and you have correct settings in your tnsnames alias. Whether you have correct tnsnames entry or not you can check that by >tnsping hostname

On unix machine, if you see tnsnames.ora is most likely accurate then at the Unix prompt, echo the TNS_ADMIN environment variable.

% echo $TNS_ADMIN

•If nothing is returned, try to set the TNS_ADMIN environment variable to explicitly point to the location of the TNSNAMES.ORA file.

In C Shell, the syntax is:
% setenv TNS_ADMIN full_path_of_tnsnames.ora_file

In K Shell or bash, the syntax is:
% export TNS_ADMIN=full_path_of_tnsnames.ora_file

On windows machine try setting the environment variable 'LOCAL' to the required connection alias instead. In windows machine environmental variable is set by set keyword.

Now try to connect to database.

5)If you use DHCP to assign IP of the server then try by putting a static IP to the database server.

Related Documents
http://arjudba.blogspot.com/2008/06/ora-12154-tnscould-not-resolve-connect.html
http://arjudba.blogspot.com/2008/06/ora-12514-tnslistener-does-not.html

Tuesday, June 24, 2008

ORA-12154: TNS:could not resolve the connect identifier specified

Problem Description:
--------------------------------------------

Whenever you try to connect your database it returns error ORA-12154.
SQL> conn prod/prod@jupi
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Cause of The Problem:
------------------------------------

The cause of the problem is depends on the which naming method you are using. Suppose if you use tnsnames.ora for naming method then there might be problem in it. I look for oerr command on my unix machine and got,

-bash-3.00$ oerr ora 12154
12154, 00000, "TNS:could not resolve the connect identifier specified"
// *Cause: A connection to a database or other service was requested using
// a connect identifier, and the connect identifier specified could not
// be resolved into a connect descriptor using one of the naming methods
// configured. For example, if the type of connect identifier used was a
// net service name then the net service name could not be found in a
// naming method repository, or the repository could not be
// located or reached.
// *Action:
// - If you are using local naming (TNSNAMES.ORA file):
// - Make sure that "TNSNAMES" is listed as one of the values of the
// NAMES.DIRECTORY_PATH parameter in the Oracle Net profile
// (SQLNET.ORA)
// - Verify that a TNSNAMES.ORA file exists and is in the proper
// directory and is accessible.
// - Check that the net service name used as the connect identifier
// exists in the TNSNAMES.ORA file.
// - Make sure there are no syntax errors anywhere in the TNSNAMES.ORA
// file. Look for unmatched parentheses or stray characters. Errors
// in a TNSNAMES.ORA file may make it unusable.
// - If you are using directory naming:
// - Verify that "LDAP" is listed as one of the values of the
// NAMES.DIRETORY_PATH parameter in the Oracle Net profile
// (SQLNET.ORA).
// - Verify that the LDAP directory server is up and that it is
// accessible.
// - Verify that the net service name or database name used as the
// connect identifier is configured in the directory.
// - Verify that the default context being used is correct by
// specifying a fully qualified net service name or a full LDAP DN
// as the connect identifier
// - If you are using easy connect naming:
// - Verify that "EZCONNECT" is listed as one of the values of the
// NAMES.DIRETORY_PATH parameter in the Oracle Net profile
// (SQLNET.ORA).
// - Make sure the host, port and service name specified
// are correct.
// - Try enclosing the connect identifier in quote marks.
//
// See the Oracle Net Services Administrators Guide or the Oracle
// operating system specific guide for more information on naming.

Solution of The Problem:
-----------------------------------------------

Actually above solution already depicted what to do if you get the problem. My suggest after getting ORA-12154 immediately go as the steps mentioned below.

Step 1: Look for tnsnames.ora and sqlnet.ora.
-----------------------------------------------------------------------

Look for your tnsnames.ora and sqlnet.ora file that you are using. On unix the default location is $ORACLE_HOME/network/admin. You better avoid to use tnsnames.ora. By using easy naming service you can easily avoid this error. Easy naming service is discussed on See the solution part of this post

Step 2: Check both file
---------------------------------------------------------------------------

•After locating both file open it with any viewer like on windows with notepad and on unix with less or more or cat.

•Check within the files whether any illegal character or any unnecessary space exists. If have then remove that.

•Check whether the exact entry exist on the tnsnames.ora that you used in connection identifer. Like if you use conn a/a@jupi then within tnsnames.ora search for only jupi alias.

•You can check your whether there is error or not in the tnsnames alias inside tnsnames.ora by using tnsping. In order to check alias jupi we issue,

bash-3.00$ tnsping jupi

TNS Ping Utility for Solaris: Version 10.2.0.1.0 - Production on 12-OCT-2008 03:25:58

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:
/oracle/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = ((ADDRESS = (PROTOCOL = TCP)(HOST = neptune)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ARJU)))
TNS-12533: TNS:illegal ADDRESS parameters
So there is illegal ADDRESS parameter which we see an extra ( before ADDRESS parameter.

If our tnsalias was good, then it would result below with how many miliseconds.
bash-3.00$ tnsping jupi

TNS Ping Utility for Solaris: Version 10.2.0.1.0 - Production on 12-OCT-2008 03:28:26

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:
/oracle/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = neptune)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ARJU)))
OK (10 msec)

•Note that with name alias checking tnsnames also tell us which location parameter files it used. Here the location is /oracle/app/oracle/product/10.2.0/db_1/network/admin. So /oracle/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora location is used in order to resolve name. However if your tnsnames.ora is in other location then you have to set TNS_ADMIN variable.

•If you see tnsnames.ora is most likely accurate, echo the TNS_ADMIN environment variable.

% echo $TNS_ADMIN

•If nothing is returned, try to set the TNS_ADMIN environment variable to explicitly point to the location of the TNSNAMES.ORA file.

In C Shell, the syntax is:
% setenv TNS_ADMIN full_path_of_tnsnames.ora_file

In K Shell or bash, the syntax is:
% export TNS_ADMIN=full_path_of_tnsnames.ora_file

In windows the syntax is:
set TNS_ADMIN=full_path_of_tnsnames.ora_file

•Now try and see whether error remains. If still you get error then in the SQLNET.ORA file, add the parameter AUTOMATIC_IPC = OFF. If AUTOMATIC_IPC is already set to ON, then change the value to OFF. And try to connect. If still you get error then check the permission of tnsnames.ora and sqlnet.ora. For workaround you can set chmod 777 of these files and try to connect. At this point it is expected you have solved your problem.

Related Documents
ORA-12560: TNS:protocol adapter error on windows machine while starting oracle
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Startup fails with oracle error ORA-00119, ORA-00132

ORA-12641: Authentication service failed to initialize

Error Description:
---------------------------------------

Whenever I tried to logon to my database it failed me with error ORA-12641.
-bash-3.00$ sqlplus arju/arju@jupiter/ARJU.ARJU.BANGLADESH.NET

SQL*Plus: Release 10.2.0.2.0 - Production on Tue Jun 24 05:55:52 2008

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.

ERROR:
ORA-12641: Authentication service failed to initialize

Cause of The problem:
---------------------------------------------------

In the $ORACLE_HOME/network/admin/sqlnet.ora file SQLNET.AUTHENTICATION_SERVICES is set to ALL and Secure Network Services has not been used.

Whenever Secure Network Services is not being used, that is you try to logon to database using SQL*Net from database host computer using above command, then it explicitly disallow applications from initiating SQL*Net connect requests with authentication services. So to allow connection through SQL*Net it is needed to disable authentication services while still allowing normal SQL*Net connections.

Soltion of The Problem:
---------------------------------

Issuing the above command from another computer rather than host will not produce the error because in that case secure network services will be used.

To disable SQL*Net authentication services while still allowing normal SQL*Net connections you can set in $ORACLE_HOME/network/admin/sqlnet.ora the following line,

SQLNET.AUTHENTICATION_SERVICES =(NONE)


Now try to connect and it will be ok.
-bash-3.00$ sqlplus arju/arju@jupiter/ARJU.ARJU.BANGLADESH.NET
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 24 06:10:32 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

Monday, April 21, 2008

How to Import data without Dumpfile-Network Mode Import

It is possible to import data in a database without the dump file. From network the data will be retrieved from one database and then import that data back to the target database. There are no dump files involved.

How to do the Network Mode Import:
-------------------------------------

1)Create a database link (with the source database) in the database where you will perform the import operation.

SQL> create database link ARJU.REGRESS.RDBMS.DEV.US.ORACLE.COM connect to arju identified by a using 'NEPTUNE';
Database link created.


In your tnsnames.ora you have entry with NEPTUNE and it works correctly.

I have to used this long name because the database global name settings.

2)Check the database link works:

If destination table name is select perfectly then your database link is ok.
SQL> select table_name from user_tables@ARJU.REGRESS.RDBMS.DEV.US.ORACLE.COM;
TABLE_NAME
------------------------------
FIRST_TABLE
TEST
NAME
In source database you can check by,
SQL> select table_name from user_tables;
no rows selected

3)Connect to the source database and note down the SCN of the database. This SCN is needed in order to ensure consistency in the dumpfile. You can do it while you are sitting on destination database by helping database links.
SQL>SELECT CURRENT_SCN FROM V$DATABASE@ARJU.REGRESS.RDBMS.DEV.US.ORACLE.COM;
118740640

Also you can logon to that database and see SCN.

4)Perform the network mode import operation.Specify database link parameter with NETWORK_LINK. Also specify FLASHBACK_SCN that you find in step 3.

SQL> host impdp arju/arju directory=dnet FLASHBACK_SCN=118740640 NETWORK_LINK=ARJU.REGRESS.RDBMS.DEV.US.ORACLE.COM


Note that no dumpfile parameter here. I created dnet directory into which log file will be written.

Restrictions of Network Mode Import:
-------------------------------------------


1.If the source database is read-only, then the user on the source database must have a locally-managed tablespace assigned as a default temporary tablespace. Otherwise, the job will fail.

2.If the USERID that is executing the import job has the IMP_FULL_DATABASE role on the target database, then that user must also have the EXP_FULL_DATABASE role on the source database.

3.The only types of database links supported by Data Pump Import are: public, fixed-user, and connected-user.

4.When the NETWORK_LINK parameter is used in conjunction with the TABLES parameter, only whole tables can be imported (not partitions of tables).

5.Network imports do not support the use of evolved types.

Related Documents:
Extract DDL from Dump

Import Oracle Data from Anywhere.

Suppose, I have server machine named "NEPTUNE". In the server machine under /oradata2 directory there is a dump file named net.dmp. However to run import operation we need not connect to server "NEPTUNE" and then perform import operation. From any machine which have data pump import client can do the operation.

In this case we need to specify with username/password field a net service name. We can easily use easy name service method here.

Note that, The dump file, the directory are all in server. Only impdp client is on another machine from which I will invoke impdp utility.


In server machine "NEPTUNE" I invoked lsnrctl status and saw the listener port is 1522 and service name is ARJU. The dump file is /oradata2/net.dmp and a directory is there named as dimp.


From Another machine just invoke,

impdp arju/a@neptune:1522/ARJU directory=dimp dumpfile=net.dmp

Related Documents:
-------------------

Extract DDL from Dump