ALTER session nls_date_format not retained

Hello guys,.

Here is the environment:

Oracle 11.2.0.1 on Linux 64-bit RHEL DB

Oracle 11 g 2 on Windows 2008 R2 32-bit client

Our product works service (code generated in c ++) and the service opens 5 sessions of database and alter session set nls_date_format questions to HH24:MI:SS DD/MM/YYYY in each of them.

But searching through the service logs, I see that select statements (to_char (date)) return date in format other than what has been defined via "alter session" i.e. they do not see the part and just JJ-LUN-AA. But the same select instructions out the date in the format of correct/expected (according to alter session statement).

The problem is that we do an insert in a table taking the current system time and running to_date (< time system >). It is a failure with: ORA-01843: not one month valid. I understand that it must specify a format for the input string, the date system, but we do not and was not a problem for someone else.

I'm also no disconnected sessions or reconnects.

Customer Oracle NLS_LANG is: AMERICAN_AMERICA. UTF8.

This problem occurs for one of our customers who use this product. All other clients do not encounter this problem, as this has been a long-standing code. I'm not saying that the code is perfect and looking at some of the SQLs, we rely on implicit conversion of data in Oracle instead of editing the SQL code, but this has never caused a problem to any other customer.

I understand the hierarchy of setting NLS_DATE_FORMAT i.e. the database, register of operating system of the customer, the customer Oracle (alter session) and finally to_date/to_char functions.

It seems that the session format game becomes overloaded as when they restart the service in our product everything is back to normal until a couple of days, when queries in the service connects begin to show the date incorrect without time portion and just JJ-LUN-AA.

Any help would be appreciated as I had read a lot on the internet with no evidence outside this site including our customer:

ttp://StackOverflow.com/questions/15396241/CX-Oracle-ora-01843-not-a-valid-month-with-Unicode-parameter h

Thank you

Bharath

Bharath3 wrote:

...

My question is, why the session loses the settings of NLS_DATE when it doesn't happen to anyone else? I think that the format is getting replaced in the sessions but how do I know that? How to find environmental changes to current public meetings?

Maybe you have a connection pool if every session is used by different... hmm applications or threads. Even if you issue a command of nls alter at the start of the session, some processes could change this setting later. This is why it is best to not depend on any parameter of session happened when the connection was established.

Best solution: just use the correct format inside the to_Char conversion. Or issue a command to alter session immediately before running the selection.

Tags: Database

Similar Questions

  • 'ALTER SESSION SET CURRENT_SCHEMA' does not work

    Hello

    in my JAVA application, I need to change a user's session so that it gets access to the tables that are created by the user 'myUser' (see code below).

    The code below shows how I tried to implement with JAVA:

    ---------------------------------------------------------------------------------------------------------
    Statement stmtSchema = con.createStatement ();
    String sql = "ALTER SESSION SET CURRENT_SCHEMA = myUser;"
    check int = stmtSchema.executeUpdate (sql);
    ---------------------------------------------------------------------------------------------------------

    There is no exception later when running the program, but it seems that the SQL in JAVA command will have no effect because when the program tries a SELECT statement after the session I get an exception:

    Java.Sql.SqlException ora-00942: table or view does not exist

    This means that the current_schema has not yet changed.

    When I tried the same command with sqlplus, it works fine.

    Why it does not work with JDBC?

    We use 8.1.3 of Oracle and Oracle 10g Release 2.

    Hello
    just a validation test. You guarantee that the alter session command and the select statement is belonging to the same connection object?
    If the connection object is the same you can post a simple test cases for further investigation?
    Ciao,.
    Giovanni

  • ALTER SESSION in sql script produces strange results

    Why "alter session set NLS_DATE_FORMAT" would interfere with the operation of a sql script?

    First of all, the script without the ALTER SESSION:
    SQL> !cat doit1.sql
    --alter session set NLS_DATE_FORMAT = "DD-MON-YYYY"
    set pagesize 99
    set trimspool on
    col BIRTH_MONTH for a11
    break on BIRTH_MONTH skip 1
    spo doit.txt
    prompt My Membership
    set feedback off heading off
    select 'As of ' || sysdate from dual;
    set heading on
    --
    select count(*) from dual;
    --
    spool off
    And its execution:
    SQL> @doit1
    My Membership
    
    As of 14-JAN-10
    
      COUNT(*)
    ----------
     1
    Everything is well with the world. Now let's throw in the ALTER SESSION:
    SQL> !cat doit2.sql
    alter session set NLS_DATE_FORMAT = "DD-MON-YYYY"
    set pagesize 99
    set trimspool on
    col BIRTH_MONTH for a11
    break on BIRTH_MONTH skip 1
    spo doit.txt
    prompt My Membership
    set feedback off heading off
    select 'As of ' || sysdate from dual;
    set heading on
    --
    select count(*) from dual;
    --
    spool off
    And its performance
    SQL> @doit2
    set pagesize 99
    *
    ERROR at line 2:
    ORA-00922: missing or invalid option
    
    
    
      COUNT(*)
    ----------
     1
    not spooling currently
    SQL> 
    Don't like the SET commands (I played a bit with many, he does not like one any of them) and does not take account of the order of the opening COIL

    First of all, I've noticed this with a 10.2.0.1 connected to a 10.2.0.4 (windows) client database (HP - UX). Confirmed on my laboratory portable VM, 10.2.0.4 under OEL5, client and db on the same virtual machine.

    You are missing just the leak ';' at the end of the line to alter session. Add to that, it all works.

  • ALTER session set current_schema

    Hello

    We have multiple instances of the database (for example, MR01DEP, MR02DEP,...).

    Each instance is composed of more than stores (called schemas): for example, for MR01DEP, we have STORE1, Bank 2, 3, to MR02DEP we STORE5, STORE6,... and so on.

    Now, using developer PL/SQL, SQL Developer or even SQL Plus, when I connect to these databases, I connect using the user SUP_TMP (who has the privileges necessary for the actions that I have to do), and I have something like this:

    Conn SUP_TMP / < password > @STORE1 (I can connect like this and not with @MR01DEP; However, even @MR01DEP is correct).

    Today, all the tables are on these patterns (STORE1, STORE2,..), and when I connect with the SUP_TMP user, each time, at each meeting, I have to write:

    ALTER session set current_schema = STORE1, or

    ALTER session set current_schema = Bank 1

    At the beginning of every script that I have to run, I want to write a little routine so that I don't need every time to this «alter session set current_schema» statement

    If I connect with SUP_TMP / < password > @STORE1.

    so I see in the instance of v$, as the instance_name is (correct) MR01DEP.

    But I need to somehow get that banks '1', which I use when I connect to it (although, normally, I connect to a database, such as MR01DEP, but I'm specifying STORE1 in the connection string).

    So, in other words, I need that at the beginning of each script, to determine the current connection string I'm specifying after '@', and which is the current_schema.

    If I log in as SUP_TMP / < password > @STORE5, then I'll have something like immediate execution "alter session set current_schema = STORE5'."

    SUP_TMP user should be the I connect each time, but the current pattern of each script in each session, must come from the connection string.

    Is this possible?

    Thank you!

    I know, I specify the store, and it will automatically connect to the correct database (this is the case).

    No - NOT sure that connect you to the right base.

    As said ground that alias 'keep' is on the client and can be mapped to ANY DATABASE at all.

    Also - what you specify with is the DATABASE - this isn't a pattern.

    You're talking about two different things.

    You set the current schema - you connect to a database. TWO DIFFERENT THINGS.

    It may not even be a schema with the same name as the database.

    Do not use the same name for the databases and schemas. Oracle is NOT sql server.

    You can create a trigger AFTER the opening of SESSION to define the schema for you, but you must be able to know which schema must be defined.

  • Several alter session and SQL * Net message from dblink in APEX

    Hello

    I have Apex 4.2.3 and I use Glassfish more listener of the Apex.

    Database is 11.2.0.4 under linux

    Looking for the session active database, I see that apex run several alter session with a lot of expectation as SQL * Net message from dblink the.

    Ex:

    ALTER session set NLS_TERRITORY = "AMERICA."

    call the query of disc elapsed to cpu count current lines

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

    Parse 58 0.00 0.00 0 0 0 0

    Run 58 0.06 3.53 267 58 0 0

    Fetch        0      0.00       0.00          0          0          0           0

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

    Total 116 0.06 3.53 267 58 0 0

    Chess in the library during parsing cache: 0

    The analysis of the user id: 277 (recursive depth: 1).

    Elapsed time are waiting on the following events:

    Event waited on times max wait for the Total WHEREAS

    ----------------------------------------   Waited  ----------  ------------

    SQL * Net message to dblink 174 0.00 0.00

    SQL * Net message from dblink 174 3.47 0.03

    ********************************************************************************


    Why he is doing a lot to change session? Why the wait is SQL * Net message from dblink the?

    We have recently to load a new language, but I'm not sure that this is the main problem.



    I think that you have the link db in the workspace schema and data requested by the Apex of this link. For example, it may be

    report which uses db link. Check dba_db_links or user_db_links for the existing links. Check if this link used by Apex.

  • session is not killed properly

    I use oracle 10g (10.2.0.1) in Redhat Ent Linux 5.0.

    In my production database, one of my session which is connected thorugh 'TOAD' program is hanged.

    I kill this session several times but not removed from the session and it shows the status is 'DEAD '.

    Here is the result:

    SQL > select username sid, serial #, session state $ v where status = 'KILLED ';

    USERNAME SID SERIAL # STATUS

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

    1860 37381 KILLED DBPROD

    SQL > alter system kill session '1860,37381';

    alter system kill session ' 1860,37381'

    *

    ERROR on line 1:

    ORA-00031: session marked for kill

    SQL > alter system kill session '1860,37381' immediate;

    alter system kill session '1860,37381' immediate

    *

    ERROR on line 1:

    ORA-00031: session marked for kill

    Also during the session to kill, there is no show message in the log file of the alerts associated with the kill command.

    Now, please help me how I can fix this without closing the database.

    EDIT the SYSTEM KILL SESSION does not remove the session.  The session dies only when the user actually tries another SQL operation and is thrown a mistake - that is to say when Oracle kills the process.

    The other option is to use an OS command to kill the server process - but you need to know how to do this and identify the right process to kill (assuming not shared server and dedicated server connections).

    Hemant K Collette

  • ALTER session privilege

    Hello
    Is there a reason why a developer may not have the privilege to alter session? My understanding of this privilege is that they will be able to make changes in only their own session, once they are disconnected the changes are cancelled. Is there any changes he could do in their own session that I (dba) will be wary of?

    Thank you.

    user8869798 wrote:
    Hello
    Is there a reason why a developer may not have the privilege to alter session? My understanding of this privilege is that they will be able to make changes in only their own session, once they are disconnected the changes are cancelled. Is there any changes he could do in their own session that I (dba) will be wary of?

    Thank you.

    Yes, your interpretation is correct that they are looged off the coast of changes back its session. But there are a number of reasons when ppl do not like to give developers alter session privilege.
    There are powerfully parameter during their session, developers can change like:

    
    sort_area_size
    optimizer_mode
    statistics_level
    optimizer_dynamic_sampling
    optimizer_use_pending_statistics
    optimizer_capture_sql_plan_baselines
    optimizer_use_sql_plan_baselines
    parallel_min_time_threshold
    parallel_degree_limit
    parallel_force_local
    optimizer_use_invisible_indexes
    parallel_min_percent
    cursor_sharing
    result_cache_mode
    parallel_instance_group
    hash_area_size
    result_cache_remote_expiration
    object_cache_optimal_size
    object_cache_max_size_percent 
    

    So if these parameter is changed into something weird that they can impact any database, specifically they can lower down the performance of the database and features.

    Best practice always review the requirements of developers and then after checking give privilege to alter session.

    Also check that the parameters can be modified using alter session

    Select the name of the parameter $ v where ISSES_MODIFIABLE = 'TRUE '.

    Hope this helps

  • ORA-02248: invalid option for ALTER SESSION during the connection of the customer

    Hello
    I'm a junior dba and I was hoping if someone could help me with a problem I have. I recently installed on the oracle 10g client on my windows machine. I am trying to remote connect to my database on a unix machine, but I get error trying to connect from the client below.

    ERROR:
    ORA-00604: an error has occurred at the SQL level 1 recursive
    ORA-02248: invalid option for ALTER SESSION

    I did some searching on that and I think it might be something to do with the NLS_LANG setting maybe. I do not know if and to be honest, I'm a little lost on this.

    Any help would be greatly appreciated. See you soon.

    RGS,
    Rob

    Hello

    what the SQL you gave?

    Check the run-> regedit NLS_LANG parameter and change it according to env

  • ALTER session in cfquery statement

    Hello world

    Would it not possible to use the alter session in a query?
    I would like to do something like this:
    < cfquery >
    ALTER SESSION SET NLS_COMP = LINGUISTIC;
    ALTER SESSION SET NLS_SORT = GENERIC_BASELETTER;
    Select geo_indication in the eccgis where country_fk = 'PT' and geo_indication like "% O";
    < / cfquery >
    As good in sqlDeveloper (oracle, without cfquery...), the application gives an error in CF (of semicolumns?).
    Did anyone get an idea?

    Thanks in advance,
    Michel

    Thank you very much.

    It is now fixed:
    The sort order also has implications on the SEARCH mechanism
    Looking for Oxxxxxx you can't find Óbidos
    and now:
    Search do not look upcase and focus more.

    Michel

  • ALTER session isn't wofking

    Hi all

    I created the process to edit the session to control the currency format, in any way the process works fine on the home page, but when you visit another page or return to the home page the session value (currency format) goes back to the previous setting ($). How can I keep this session fixed and consistent across my Web site?

    Also when I change the order of any report that the currency format will be shown in the older framework ($), I use the reports of PPR.

    PS, does not change when moving between pages of session state is same. Also, I tried the application process and process page on new session and the page load.

    Thank you
    Fadi.

    Try to add to the attribute VPD of your application (security settings):

    run immediately "alter session set nls_currency ="? "" ' ;

    .. .adjusted for what you really need.

    To clarify, it is an "equal" sign, followed by two single quotes consecutive, followed by a question mark where you can use the desired currency symbol, followed by three apostrophes, terminated by a semicolon.

    Scott

  • TV Guide will not retain the local settings. There is no user.js file. How can I fix it?

    TV Guide will not retain the local settings. After that the closure of the site reverts to the default settings. There is no user.js file. Delete the prefs.js file did not help. Any suggestions?

    If Web sites don't remember your personal information, it is likely that Firefox is set to remember any cookies after the release. You must configure your privacy settings to remember - see the parameters of privacy, and-not-track browsing history.

  • My modified photos do not retain the changes I did photos particularly lift and the sunset.

    My modified photos do not retain the changes I did photos particularly lift and the sunset.

    I use the latest iPhoto - 9.6.1

    Please explain? Don't engage Photos for Mac where you posted?  If so, how the pictures to transfer to your Mac?

    LN

  • Microsoft windows media player does not retain the previous size. is irrtating so me gift of reorganize its size every time when I open it.plz help I want stable wmp version 11

    Microsoft windows media player does not retain the previous size. is irrtating so me gift of reorganize its size every time when I open it.plz help I want stable wmp version 11, version 12 is sucks.

    Hello, Simone

    I'll assume you're on Windows 7. Windows Media Player 12 is not supported on Windows Vista or XP and as such, you will need to go back to Windows Media Player 11.

    You can check the permissions in the registry to ensure that it is able to record information.

    Change the settings of the REGISTRY can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the REGISTRY settings configuration can be solved. Changes to these settings are at your own risk.

    Open the registry editor by clicking on start, type regedit.exe in the search box and press on enter, you may be prompted to continue.

    In the registry editor, navigate to HKEY_CURRENT_USER, Software, Microsoft, MediaPlayer, then Preferences.

    It should be an element named LastLocation_26, right-click on it and select Rename, and rename it to old LastLocation_26.

    Leave the open registry editor and open Media Player, then move it to your favorite place and close Media Player.

    In the registry editor, press F5 on your keyboard and check if LastLocation_26 has been recreated.

    If this is not the case, there is probably a permissions problem.

    If so, the location must be registered.

    Let us know.

    David
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • When I try to send an email to MYOB I get error message saying: "an email session could not be started. Please check your MAPI installation '.

    Error message: a message session could not be started. Please check your MAPI installation - sending email from MYOB

    When I try to send an email to MYOB I get error message saying: "an email session could not be started. Please check your MAPI installation '.

    How can I solve this problem?

    Hi all

    I have a workaround which is a little less boring that the patch "restart the PC": If you get the error where MYOB crashes when you try to send an e-mail, open Task Manager (ctrl-alt-del or right click on the start bar), then go to the "Processes" tab and close all instances of wlmail.exe using the button "complete the process".

    It seems that this error occurs if you have Windows Live Mail opened when you try and send emails of MYOB. If you then close WLMail after that get the error the process seems to never close, so you have to close it manually. If you send all your emails with closed WLMail MYOB it seems to be OK.

    See you soon

  • WRT600N - Wireless MAC Filter Table will not retain MAC for the Droid 2 phones

    Hello

    I have a Linksys WRT600N router and I succumbed adding our new Motorola Droid 2 to the MAC table on the Wireless Security tab.

    It allows access if I disable MAC filtering wireless and appears on the list of clients, but when I try to add the customer list or manually enter the MAC table, it does not retain it when I save it. The only thing that seems different from the MAC standard is the 1 byte

    (F8:7 B: 7 A: 76:98:22 is the MAC of my phone).

    I don't want to leave my network open and prefer to avoid using a WEP key if possible.

    Can anyone tell me what I am doing wrong or is this a bug? Y at - it a firmware update I have to apply to this effect in my MAC filter (current version is 1.01.36 build 3)?

    Oh and I'm not worried about hackers if as much as deterrence of neighbors stealing my bandwidth. To implement the keys on all my devices was too much time to consider unless a last resort. MAC filters make it also easier for me to add guests fairly quickly.

Maybe you are looking for

  • I just ran the update, now my email do not open. Why?

    I click on an e-mail, it is reproduced below, but no content, empty, just the senders name/email address. Nothing else. I try clicking on/double clicking in the field, but nothing.

  • The display is large

    Often the screen is medium to large, and I can't see the time. It is not set to iphone for big screen. Is there a way when it is out of the screen to return to the regular? I've tried everything.

  • Before: attachments not in the body of the letter. Now: attachments in the body of the letter - not wanted to so. How can I fix it?

    A few days when I used Thunderbird in sending electronic messages that I place an attachment it would remain just as an attachment and there was not change to what I had entered in the body of the message. Now, when I do an attachment to an e-mail me

  • Satellite L360D - no boot up - black screen

    Our laptop won't start.Don't even give a start of the screen (Bios/Cmos output). Not even a cursor or anything like that.Screen remains completely black. At the beginning of year t helped by pressing a key (we choose: insert) during start and/or remo

  • Single pass mode and sleep

    Name of product: notebook PC HP ENVY 17 of TS Product number: C8U17AV I have another problem of Simple passage.  When I wake my desire to fashion 'sleep', the fingerprint reader does not and I have to restart or to put the password in.  There was a q