Wednesday, January 27, 2010

How to rename a file with junk characters

In our case file name /u42/oradata/ilproddata/a_txn_ind364.dbf; is having the junk character.


Step 1: Find the name of the junk character file.


a) On database


Select name from v$datafile where name like '%/u42/oradata/ilproddata/a_txn_ind364%';

/u42/oradata/ilproddata/a_txn_ind364.dbf;


b) On the mount point


cd /u42/oradata/ilproddata

ls -ltr a_txn_ind364*

a_txn_ind364.dbf;


Step 2:


Now shutdown the database


Step 3:


Now copy the file to the new name. It's better to use copy, always avoid move command in such case.


cd /u42/oradata/ilproddata

cp a_txn_ind364.dbf* a_txn_ind364.dbf


Step 4: Open the database in mount mode and run the rename command

As the file have junk characters. So find the exact name of the file with junk characters.


a) Take the trace of control file using “alter database backup controlfile to trace;”


b) Now open the file trace file in VI mode and search the name "a_txn_ind364.dbf;"


c) Remove all the lines except this and make the changes as mentioned below.


[ilerpdb01: oraprod] /u11/app/ilproddb/9.2.0/admin/ILPROD_ilerpdb01/udump> more ilprod_ora_987810.trc


alter database rename file '/u42/oradata/ilproddata/a_txn_ind364.dbf;^[[1~^[[1' to '/u42/oradata/ilproddata/a_txn_ind364.dbf' ;


d) Now run the scripts "ilprod_ora_987810.trc" on the sql prompt.


e) Now open the database.



Saturday, January 23, 2010

Hi ,

Once we got a tedious job to disable the responsibilities for 500 users. So we decided to use the API. This can be done using the API mentioned below.




Begin
fnd_user_pkg.delresp(
'&User_Name',
'&Responsibility_application_short_name',
'&Responsibility_Key',
'&Security_Group');
commit;
End;

Ex :

exec fnd_user_pkg.DELRESP('A00073','MFG','LGEIL_NOIDA_MFG_RK','STANDARD')

But above mentioned API has a bug also (Bug 4600645 ) i.e. it sets both start_date and end_date to sysdate . This might cause problem during auditing.

So , in this case API mentioned below can also be used . In this you are allowed to give start_date also .


exec fnd_user_resp_groups_api.update_assignment(user_id => 7391,responsibility_id => 20707,responsibility_application_id => 201,start_date => '02-JAN-2008',end_date => sysdate,description => null);


Note : fnd_user_resp_groups_direct can be used to find the end_date . API fnd_user_pkg can also be to disable the users etc

Sunday, January 17, 2010

Abnormal listener behaviour

Problem :


a ) Error message while stopping the listener

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.154.175.13)(PORT=1521)))

TNS-12547: TNS:lost contact

TNS-12560: TNS:protocol adapter error

TNS-00517: Lost contact

IBM/AIX RISC System/6000 Error: 73: Connection reset by peer


b ) Listener is running


c ) From the outside , when you're doing "tnsping " .you're getting .


TNS:lost contact OR TNS : Connection closed


d ) sqlnet.ora is also OK . No extra parameter except " NAMES.DIRECTORY_PATH=(TNSNAMES, ONAMES, HOSTNAME) "


Solution :


I searched a lot over net . But didn't found any solution . So I did the following ..


Step 1 : kill the listener

[csnetroiap:oraspx] /orahome/oracle/network/admin # ps -ef |grep lsn

oraspx 692234 762032 0 09:51:43 pts/3 0:00 grep lsn

oraspx 508176 1 0 Jan 07 - 218:56 /orahome/oracle/bin/tnslsnr LISTENER -inherit

[csnetroiap:oraspx] /orahome/oracle/network/admin # kill -9 508176


Step 2 : Restarted the listener

[csnetroiap:oraspx] /orahome/oracle/network/admin # lsnrctl start LISTENER

LSNRCTL for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production on 16-JAN-2010 09:52:01

Copyright (c) 1991, 2006, Oracle Corporation. All rights reserved.

Starting /orahome/oracle/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production

System parameter file is /orahome/oracle/network/admin/listener.ora

Log messages written to /orahome/oracle/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=202.154.175.13)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.154.175.13)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production

Start Date 16-JAN-2010 09:52:01

Uptime 0 days 0 hr. 1 min. 15 sec

Trace Level off

Security OFF

SNMP OFF

Listener Parameter File /orahome/oracle/network/admin/listener.ora

Listener Log File /orahome/oracle/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=202.154.175.13)(PORT=1521)))

Services Summary...

Service "lgeil" has 1 instance(s).

Instance "lgeil", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully


And it worked for me .