Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining the NLS_LANG setting for an existing Oracle database dump file

We were handed a dump file by another team who are gone away for the rest of the year. When we try to import the dump into our own database, we get the following error:

IMP-00038: Could not convert to environment character set's handle

Upon some research, our speculation is that we have a mismatch between the NLS_LANG setting of the source machine and our local machine. We currently don't have any means to check what the value of NLS_LANG is on the source machine.

So, having just a dump file in our hands, is there a way to figure out the NLS_LANG value with which the export was done? From the looks of it, we should be able to override the NLS_LANG environment variable before running the import client (imp).

Another thing is, the dump was done from an 11g instance and our imp version is 10. I read that imp is not forward compatible. Could this be the issue here (instead of the NLS_LANG mismatch)?

like image 879
Ates Goral Avatar asked Nov 25 '10 16:11

Ates Goral


People also ask

What command will you use to find the value of the system environment variable Nls_lang?

You can view the NLS_LANG setting by entering the SELECT command: SELECT * FROM NLS_SESSION_PARAMETERS; The NLS_TERRITORY and NLS_LANGUAGE values correspond to the language and territory components of the NLS_LANG variable.

What is NLS setting in Oracle?

Oracle's National Language Support (NLS) architecture allows you to store, process, and retrieve data in native languages. It ensures that database utilities and error messages, sort order, date, time, monetary, numeric, and calendar conventions automatically adapt to the native language and locale.

How are character sets used Oracle Nls_lang?

The character set defined with the NLS_LANG parameter does NOT CHANGE your client's character set. It is used to let Oracle know what character set you are USING on the client side, so Oracle can do the proper conversion. You cannot change the character set of your client by using a different NLS_LANG!


3 Answers

Ates, try impdp - sometimes that could help :-)

like image 75
Stephan Avatar answered Sep 30 '22 07:09

Stephan


easiest way on unix is:

#>imp username/password file=test.dmp show=y

Import: Release 10.2.0.3.0 - Production on Fri Nov 26 08:38:47 2010

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


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

Export file created by EXPORT:V10.02.01 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8ISO8859P1 character set (possible charset conversion)

Version exp/imp is a problem: I usually use the V10 export program and make it connect to the V11 database. Make sure you have a alias for dev11 in your tnsnames.ora in dev10's oracle_home.

hostname{oracle}# . oraenv
ORACLE_SID = [oracle] ? dev10
hostname{oracle}#
hostname{oracle}#>exp username/password@dev11 full=y dumpfile=dump.exp
like image 35
Rob van Laarhoven Avatar answered Sep 30 '22 07:09

Rob van Laarhoven


Even though the file is a binary garble, there are some human-readable text excerpts. I saw the following strings in there, and I think this answers my question:

<CHARSET>AL32UTF8</CHARSET><NCHARSET>AL16UTF16</NCHARSET>
...
NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA'
like image 37
Ates Goral Avatar answered Sep 30 '22 07:09

Ates Goral