0% found this document useful (0 votes)
120 views

Common Problems and Oracle Connectivity Issues

This document provides guidance on troubleshooting common Oracle connectivity issues. It describes how to resolve issues with installing or reinstalling the Oracle client software. It also provides instructions on testing connectivity to the Oracle database using tools like tnsping and sqlplus. Finally, it lists some common Oracle error messages and their causes and resolutions.

Uploaded by

sravan.appsdba
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

Common Problems and Oracle Connectivity Issues

This document provides guidance on troubleshooting common Oracle connectivity issues. It describes how to resolve issues with installing or reinstalling the Oracle client software. It also provides instructions on testing connectivity to the Oracle database using tools like tnsping and sqlplus. Finally, it lists some common Oracle error messages and their causes and resolutions.

Uploaded by

sravan.appsdba
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Oracle: Common Problems and Oracle

Connectivity issues
Submitted by inforadar on Thu, 06/03/2010 - 22:33

Tags:

         Databases

Trouble in Installing/Re-Installing Oracle Client Software?

1. What to do if you face any of these problems:

 My Oracle client installation hangs at xx% and nothing happens.


 Oracle client installation shows successful but I get an error while trying to run SQL*Plus
that some DLLs are missing.

2. I am not able to successfully reinstall the oracle client software.

Possible Solution:

1. Identify the oracle client versions installed in your computer. The installation paths are
usually in c:\oracle or D:\Oracle with sub-directory name as Oracle client version.
2. Go to Start –>Settings –>Control Panel–>Administrative Tools –> Services and look for
the service names starting with Oracle and stop these services (Right Click on service
name and you get a menu item to stop the service).
3. Go Start –>Program Files–>{Identify the Program Name starting with Oracle}–>Oracle
Installation Products –> Universal Installer–> Select ‘Deinstall Products’ and select the
Oracle Home to start deinstall process.
4. Delete all the sub-directories under c:\oracle or d:\oracle whichever is appropriate in your
case.
5. Delete the directory called “Inventory” under c:\Program Files\Oracle\.
6. Start a fresh Oracle Client Installation. Set up TNS_ADMIN environment variable and
test the installation.
7. After Installation is done, please test the connectivity as mentioned in the “How to test
Connectivity to Oracle Database?” section.

How to Test Connectivity to the Oracle Database?

1. On your windows computer, click on Start –> Run, type cmd and click OK to start the
command Prompt.
2. On the command Prompt, enter tnsping <DB Name>
 If you get an error “TNS COULD NOT RESOLVE SERVICE NAME” or similar error
message, then verify that you have tnsnames.ora and sqlnet.ora in
<ORACLE_HOME>/NETWORK/ADMIN
 If you get error while running sqlplus or tnsping command from command prompt as
“Command Not recognized” or similar, please refer to “Steps to modify the PATH
variable”

Example:

C:\Documents and Settings\milind>sqlplus

’sqlplus’ is not recognized as an internal or external command, operable program or batch file.

Troubleshooting Oracle ODBC Connectivity

If you have problem with the Oracle ODBC connectivity, you need to ensure that you have
the following things verified:

1. Follow the instructions under “How to Test Connectivity to the Oracle Database” to test
the simple sqlplus connectivity to the database.
2. When you created the System or User DSN, select the Oracle ODBC driver “Oracle in
xxxxxxxx” instead of “Microsoft ODBC for Oracle”.
3. On the next screen, enter your username and password and the TNS Service Name in the
Database name. ex. DSSC or DSST , hit “Test” button to test the connectivity. If you
receive any error, note the error message as it would help the Oracle DBA to resolve the
issue faster.

Steps to Modify Path Variable (For Advanced Users only)

Some times if the Oracle Client directory is not included in your PATH variable, you may
get errors such as “Sqlplus/tnsping”  is not recognized as an internal or external command. In
this Case, we can make sure that the Path to Oracle client binaries in included in the path
variable. The typical bin directory path can be : c or d :\orcle\<oracle client version>\bin

Example: c:\oracle\920\bin or C:\oracle\product\10.2.0\BIN

To view/modify the PATH variable follow these instructions: (Assumption: We have the 9i
client and path is c:\oracle\920\bin)

 Right-Click on My Computer and click on properties.


 Go to “Advanced”  tab and click on “Environment Variables” which would open a new
window. Then scroll down to “PATH” and then click on edit.
 Make sure that the Oracle Client bin directory is included in the PATH. If not you can
include it as shown. The entries in PATH variable as separated by “;”

Related Oracle Error Messages


ORA-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: You might be using a local tnsnames.ora which is not updated automatically with any
configuration changes. You can replace this file with the latest tnsnames.ora file from shared
drive (Z:\CARES\Databases\tnsnames) or point your TNS_ADMIN variable to the shared drive
and try connecting to the database again. If the problem persists, contact Oracle DBA.

ORA-12541:TNS:no listener

ORA-12224: TNS: no listener

Cause: The connection request could not be completed because the listener is not running.

Action: Check with your DBAs if they are working on the server. If its is not down due to some
maintenance activity, page/call DBA to investigate further on this issue.

ORA-12545: Connect failed because target host or object does not exist

ORA-12203: TNS: unable to connect to destination

ORA-12154: TNS:could not resolve service name

ORA-12505: TNS: listener could not resolve SID given in connection description.

Cause: Oracle suggest that this error indicates that the address specified (in the alias definition)
is not valid.

Action: You might be using a local tnsnames.ora which is not updated automatically with any
configuration changes. You can replace this file with the latest tnsnames.ora file from shared
drive (Z:\CARES\Databases\tnsnames) or point your TNS_ADMIN variable to the shared drive
and try connecting to the database again. If the problem persists, contact Oracle Primary.

ORA-04031: unable to allocate … shared memory

Cause: More shared memory is needed than was allocated. SGA private memory has been
exhausted. Fragmentation of shared pool memory is a common problem and ORA-04031 is
commonly a result of such fragmentation. Application programmers usually get this error while
attempting to load a big package or while executing a very large procedure and there is not
sufficient contiguous free memory available in the shared pool. This may be due to
fragmentation of the shared pool memory or insufficient memory in the shared pool.
Action: Notify the Oracle DBA as soon as possible. Work with application Development team to
re-estimate the SGA parameters.

ORA-01034: ORACLE not available

Possible Causes:

Oracle indicates the following possible causes:

The SGA requires more space than was allocated for it.

The operating system variable pointing to the instance is improperly defined.

Action:

You might be using a local tnsnames.ora which is not updated automatically with any
configuration changes. You can replace this file with the latest tnsnames.ora file from shared
drive (Z:\CARES\Databases\tnsnames) or point your TNS_ADMIN variable to the shared drive
and try connecting to the database again. If the problem persists, contact Oracle DBA.

ORA-01017: Invalid username/password

Cause: You are entering incorrect username and password for that database.

Action: Contact Oracle DBA and ask them to reset your password or unlock your account.

Oracle: Common Problems and Oracle


Connectivity issues
Submitted by inforadar on Thu, 06/03/2010 - 22:33

Tags:

         Databases

Trouble in Installing/Re-Installing Oracle Client Software?

1. What to do if you face any of these problems:

 My Oracle client installation hangs at xx% and nothing happens.


 Oracle client installation shows successful but I get an error while trying to run SQL*Plus
that some DLLs are missing.

2. I am not able to successfully reinstall the oracle client software.


Possible Solution:

1. Identify the oracle client versions installed in your computer. The installation paths are
usually in c:\oracle or D:\Oracle with sub-directory name as Oracle client version.
2. Go to Start –>Settings –>Control Panel–>Administrative Tools –> Services and look for
the service names starting with Oracle and stop these services (Right Click on service
name and you get a menu item to stop the service).
3. Go Start –>Program Files–>{Identify the Program Name starting with Oracle}–>Oracle
Installation Products –> Universal Installer–> Select ‘Deinstall Products’ and select the
Oracle Home to start deinstall process.
4. Delete all the sub-directories under c:\oracle or d:\oracle whichever is appropriate in your
case.
5. Delete the directory called “Inventory” under c:\Program Files\Oracle\.
6. Start a fresh Oracle Client Installation. Set up TNS_ADMIN environment variable and
test the installation.
7. After Installation is done, please test the connectivity as mentioned in the “How to test
Connectivity to Oracle Database?” section.

How to Test Connectivity to the Oracle Database?

1. On your windows computer, click on Start –> Run, type cmd and click OK to start the
command Prompt.
2. On the command Prompt, enter tnsping <DB Name>

 If you get an error “TNS COULD NOT RESOLVE SERVICE NAME” or similar error
message, then verify that you have tnsnames.ora and sqlnet.ora in
<ORACLE_HOME>/NETWORK/ADMIN
 If you get error while running sqlplus or tnsping command from command prompt as
“Command Not recognized” or similar, please refer to “Steps to modify the PATH
variable”

Example:

C:\Documents and Settings\milind>sqlplus

’sqlplus’ is not recognized as an internal or external command, operable program or batch file.

Troubleshooting Oracle ODBC Connectivity

If you have problem with the Oracle ODBC connectivity, you need to ensure that you have
the following things verified:

1. Follow the instructions under “How to Test Connectivity to the Oracle Database” to test
the simple sqlplus connectivity to the database.
2. When you created the System or User DSN, select the Oracle ODBC driver “Oracle in
xxxxxxxx” instead of “Microsoft ODBC for Oracle”.
3. On the next screen, enter your username and password and the TNS Service Name in the
Database name. ex. DSSC or DSST , hit “Test” button to test the connectivity. If you
receive any error, note the error message as it would help the Oracle DBA to resolve the
issue faster.

Steps to Modify Path Variable (For Advanced Users only)

Some times if the Oracle Client directory is not included in your PATH variable, you may
get errors such as “Sqlplus/tnsping”  is not recognized as an internal or external command. In
this Case, we can make sure that the Path to Oracle client binaries in included in the path
variable. The typical bin directory path can be : c or d :\orcle\<oracle client version>\bin

Example: c:\oracle\920\bin or C:\oracle\product\10.2.0\BIN

To view/modify the PATH variable follow these instructions: (Assumption: We have the 9i
client and path is c:\oracle\920\bin)

 Right-Click on My Computer and click on properties.


 Go to “Advanced”  tab and click on “Environment Variables” which would open a new
window. Then scroll down to “PATH” and then click on edit.
 Make sure that the Oracle Client bin directory is included in the PATH. If not you can
include it as shown. The entries in PATH variable as separated by “;”

Related Oracle Error Messages

ORA-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: You might be using a local tnsnames.ora which is not updated automatically with any
configuration changes. You can replace this file with the latest tnsnames.ora file from shared
drive (Z:\CARES\Databases\tnsnames) or point your TNS_ADMIN variable to the shared drive
and try connecting to the database again. If the problem persists, contact Oracle DBA.

ORA-12541:TNS:no listener

ORA-12224: TNS: no listener

Cause: The connection request could not be completed because the listener is not running.

Action: Check with your DBAs if they are working on the server. If its is not down due to some
maintenance activity, page/call DBA to investigate further on this issue.
ORA-12545: Connect failed because target host or object does not exist

ORA-12203: TNS: unable to connect to destination

ORA-12154: TNS:could not resolve service name

ORA-12505: TNS: listener could not resolve SID given in connection description.

Cause: Oracle suggest that this error indicates that the address specified (in the alias definition)
is not valid.

Action: You might be using a local tnsnames.ora which is not updated automatically with any
configuration changes. You can replace this file with the latest tnsnames.ora file from shared
drive (Z:\CARES\Databases\tnsnames) or point your TNS_ADMIN variable to the shared drive
and try connecting to the database again. If the problem persists, contact Oracle Primary.

ORA-04031: unable to allocate … shared memory

Cause: More shared memory is needed than was allocated. SGA private memory has been
exhausted. Fragmentation of shared pool memory is a common problem and ORA-04031 is
commonly a result of such fragmentation. Application programmers usually get this error while
attempting to load a big package or while executing a very large procedure and there is not
sufficient contiguous free memory available in the shared pool. This may be due to
fragmentation of the shared pool memory or insufficient memory in the shared pool.

Action: Notify the Oracle DBA as soon as possible. Work with application Development team to
re-estimate the SGA parameters.

ORA-01034: ORACLE not available

Possible Causes:

Oracle indicates the following possible causes:

The SGA requires more space than was allocated for it.

The operating system variable pointing to the instance is improperly defined.

Action:

You might be using a local tnsnames.ora which is not updated automatically with any
configuration changes. You can replace this file with the latest tnsnames.ora file from shared
drive (Z:\CARES\Databases\tnsnames) or point your TNS_ADMIN variable to the shared drive
and try connecting to the database again. If the problem persists, contact Oracle DBA.

ORA-01017: Invalid username/password


Cause: You are entering incorrect username and password for that database.

Action: Contact Oracle DBA and ask them to reset your password or unlock your account.

**************** CAUTION - Disclaimer *****************


This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not
to copy, disclose, or distribute this e-mail or its contents to any other
person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has
taken
every reasonable precaution to minimize this risk, but is not liable for any
damage
you may sustain as a result of any virus in this e-mail. You should carry out
your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this
e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Reply Reply to all Forward


 
Reply
 
|

Oracle:Dynamically generate a script to


shrink tablespace(s) to 70% occupied or to
the highest watermark.
Submitted by inforadar on Thu, 06/03/2010 - 22:23

Tags:

         Databases

Contributed by : Nanie Asedillio


undef tbsnm
PROMPT
ACCEPT tbsnm PROMPT ‘Enter Value Tablespace (Return For all) : ‘

declare
cursor c1 is select tablespace_name
from dba_tablespaces
where tablespace_name not in
(’SYSTEM’,'SYSAUX’,'UNDOTBS’,'UNDO’,'TOOLS’,'USERS’)
and contents=’PERMANENT’
and tablespace_name=nvl(upper(’&tbsnm’),tablespace_name)
union
select tablespace_name
from dba_segments
where tablespace_name not in
(’SYSTEM’,'SYSAUX’,'UNDOTBS’,'UNDO’,'TOOLS’,'USERS’)
and tablespace_name=nvl(upper(’&&tbsnm’),tablespace_name);

/* cursor to check HWM for each datafile */


cursor c2 (tbsname2 varchar2) is
select F.file_name,
L.max_level,
TS.total_size
from dba_data_files F,
(select E.file_id,
(E.block_id + E.blocks - 1) as max_level
from dba_extents E,
(select file_id, Max(block_id) as max_block_id
from dba_extents
group by file_id) MB
where E.file_id = MB.file_id
and E.block_id = MB.max_block_id) L,
(select file_id,
Round(Sum(bytes)/1024/1024,0) as total_size
from dba_data_files
group by file_id) TS,
(select file_id,
Round((Sum(bytes)/1024/1024),0) as free_size
from dba_free_space
group by file_id) FS
where F.file_id = L.file_id
and F.file_id = TS.file_id
and F.file_id = FS.file_id
and F.tablespace_name = tbsname2
and TS.total_size <> L.max_level;
/* cursor to check if tbspace is 70% used or not */
cursor c3 (tbsname3 varchar2) is
select kbytes_alloc allocsize,
kbytes_alloc-nvl(kbytes_free,0) usedmb,
((kbytes_alloc-nvl(kbytes_free,0))/kbytes_alloc)*100 pcused
from ( select sum(bytes)/1024/1024 Kbytes_free,
max(bytes)/1024/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) fs,
( select sum(bytes)/1024/1024 Kbytes_alloc,
tablespace_name,
count(*) data_files
from sys.dba_data_files
group by tablespace_name )df
where fs.tablespace_name (+) = df.tablespace_name
and df.tablespace_name = tbsname3;

/* cursor to pick up datafiles that are not used yet */


cursor c4 (tbsname4 varchar2) is
select file_id,
file_name,
sum(bytes)/1024/1024 kbytes_alloc
from dba_data_files
where tablespace_name = tbsname4
and file_id not in (select file_id
from dba_extents
where tablespace_name=tbsname4)
group by file_id,file_name;

c3rec c3%rowtype;
tbspctfree number(5,2) := 0;
dbblksize number(7,7) := 0;
totspred number(15,2) := 0;
targetsize number(15,2) := 0;
newtarget number(15,2) := 0;
lasttotspred number(15,2) := 0;
spacereduz number(15,2) := 0;

begin
for tbsp in c1 loop

/* open cursor to check if tablespace is 70% used */


open c3(tbsp.tablespace_name);
fetch c3 into c3rec;
targetsize := ceil(c3rec.allocsize-(c3rec.usedmb/0.7));
dbms_output.enable(1000000);
dbms_output.put_line(’ Tablespace ‘||tbsp.tablespace_name||’ is ‘||round(c3rec.pcused,2)||’%
used’);

if targetsize > 0 then


dbms_output.put_line(’Reduce it by ‘||targetsize||’ to obtain >=70% usage requirement’||chr(10));
else
dbms_output.put_line(’No need to reduce it’||chr(10));

end if;

if c3rec.pcused < 70 then

/* get db_block_size */
select value/1024/1024 into dbblksize
from v$parameter
where name = ‘db_block_size’;

totspred := 0; /* reset the value to 0 */

for dtfreeup in c4(tbsp.tablespace_name) loop


spacereduz := ceil(dtfreeup.kbytes_alloc-dtfreeup.kbytes_alloc+1);
totspred := totspred+(dtfreeup.kbytes_alloc-1);

/* dbms_output.put_line(’spacereduz b4 if is: ‘||spacereduz||’ totspred is ‘||totspred); */

if totspred >= targetsize then


/* dbms_output.put_line(’totspred >= targetsize’); */
newtarget := ceil(dtfreeup.kbytes_alloc-(targetsize-lasttotspred));
dbms_output.put_line(’alter database datafile ”’||dtfreeup.file_name||”’ resize ‘||newtarget||’M; —
allocated is ‘||dtfreeup.kbytes_alloc);
totspred := lasttotspred+(dtfreeup.kbytes_alloc-newtarget);
/* dbms_output.put_line(’lastotspred+newtarget is ‘||totspred); */

else
dbms_output.put_line(’alter database datafile ”’||dtfreeup.file_name||”’ resize ‘||spacereduz||’M;
—allocated is ‘||dtfreeup.kbytes_alloc);
lasttotspred := totspred;
end if;
/* dbms_output.put_line(’spacereduz b4 if is: ‘||spacereduz||’totspred is ‘||totspred); */
exit when (totspred >= targetsize);

end loop; /* end loop for c4 cursor */

if totspred < targetsize then /* if targetsize hasn’t been reached, then try to reduce space on
datafiles with contents */
for dtreduce in c2(tbsp.tablespace_name) loop

totspred := totspred+((dtreduce.total_size-ceil(dbblksize*dtreduce.max_level))); /* calculate how


much space is removed from the target */
/* dbms_output.put_line(’totspred b4 if: ‘||totspred); */

if totspred >= targetsize then

newtarget := dtreduce.total_size-(targetsize-lasttotspred);
/* dbms_output.put_line(’new target size is ‘||newtarget); */
totspred := lasttotspred+(dtreduce.total_size-newtarget);
/* dbms_output.put_line(’totspred + newtarget: ‘||totspred); */
dbms_output.put_line(’alter database datafile ”’||dtreduce.file_name||”’ resize ‘||
ceil(newtarget)||’M; —allocated is ‘||dtreduce.total_size);

else

dbms_output.put_line(’alter database datafile ”’||dtreduce.file_name||”’ resize ‘||


ceil(dbblksize*dtreduce.max_level)||’M; —allocated is ‘||dtreduce.total_size);
/* store last totspred value for reference later */
lasttotspred := totspred;

end if;

/* dbms_output.put_line(’totspred after if: ‘||totspred); */


exit when (totspred >= targetsize);

end loop; /* c2 loop */


end if;

dbms_output.put_line(chr(10)||’Total reduced space is ‘||totspred||’M out of the target size w/c is


‘||targetsize||’M');
dbms_output.put_line(’IF total reduced space is lower than the target usage then it is due to the
High-Water mark value’);
dbms_output.put_line(’Tablespace reorganization for ‘||tbsp.tablespace_name||’ might be
required’||chr(10));

end if;

close c3;

end loop; /* tbsp loop */

end;
/

You might also like