NLS_LENGTH_SEMENTICS from BYTE TO CHAR

Hi,
For supporting multibyte character, we need to change NLS_LENGTH_SEMENTICS parameter from BYTE to CHAR. But this parameter setting will effect for new database tables created thereafter. To change the storage characteristics for existing database tables we explicitly executed Alter statements for database tables for columns having datatype as “Varchar2” and “Char”.
Problem:
======
Since the number of database tables in PRODUCTION are very high and contains approx. 600 million of records spread over 400 database tables, we are not in a position to afford the time which will be spent in altering these database tables in PRODUCTION.
We ran the test by alter script in System Test environment and alteration of database tables covering 150 tables and 200 million of records was carried out in almost 16-20 hrs.
APPROACHES WE HAVE IN MIND
==========================
1. Alter all the table columns (We tried the same and taking too much time)
2. Export /Import with NLS_LENGTH_SEMENTICS set as CHAR(We discuss with our DBA about this approach and found that it will also take too much time and there is RISK of data inconsistency)
3. Drop the index of the table, run alter script for changing storage type BYTE to CHAR , and rebuild the index (this is also taking too much time).
All above approaches are very costly in terms of time, that we cannot afford.
If any one having better solution then please suggest.
thanks in advance
Syed

Hi
We are also facing a similar problem
We ran alter table scripts and now compiling the objects
and that is taking lot of time.
we have around 4000 invalids that by parallel recomp came down to 2000 but still these 2000 which are mostly packages .. are giving a hard time.
if anyone has faced/found a similar issue/solution pls post. or maildirectly to me.
Sunil Choudhary

Similar Messages

  • Change NLS_LENGTH_SEMANTICS from BYTE to CHAR on Oracle 9i2 problem!

    Hi,
    I have created a new database on Oracle 9i 2, I did not find the correct pfile parameter for the NLS_LENGTH_SEMANTICS setting.
    So have created a standart UTF8 database and now I am trying to change the standard NLS_LENGTH_SEMANTICS=BYTE to CHAR. When I execute the following command in SQL PLUS "ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR SCOPE=BOTH"
    The system is tells me that command is successfully executed.
    But when I look at the NLS_DATABASE_PARAMETERS table I do not see any change for the NLS_LENGTH_SEMANTICS parameter.
    I have also restarted the instance but still everything is the same as it was before.
    Do you know what I am doing wrong?
    Regards
    RobH

    Hi,
    Yeah you are right, the nls_session_parameters "NLS_LENGTH_SEMANTICS" for the app user is set to CHAR.
    This means that NLS_DATABASE_PARAMETERS is from the SYS or SYSTEM user view?
    Thanks a lot
    Regards
    RobH

  • Exp/imp, convertion from byte to char.

    Hi,
    I have a dump file exported from a database with nls_lenght_sematics=BYTES. When i import it into a database with nls_lenght_sematics=CHAR, it is retaining the BYTE charecteristics. Is there any way to change it into CHAR while importing. This for globalization support.
    Thanks
    Muneer

    Hi Muneer,
    No, import always preserve the LENGTH semantics of the original columns.
    The workaround is to create your schema objects in the traget database first, with the desired semantics, prior to the importing the data.
    Nat

  • How to find out if colums is defined as VARCHAR2 in bytes or char?

    Hello,
    I'd like to know if it is possible to find out if a colum table (or view) is defined as a VARCHAR2 in bytes or in CHAR on Oracle 10g.
    When I do a desc, it shows only VARCHAR2 with its length but not if it is bytes or char. How can I know for sure?
    Thanks,

    SQL> create table t
      id    varchar2 (10 char),
      id2   varchar2 (10 byte)
    Table created.
    SQL> select column_name, data_type, char_used
      from cols
    where table_name = 'T'
    COLUMN_NAME                                   DATA_TYPE       CHAR_USED
    ID                                            VARCHAR2        C       
    ID2                                           VARCHAR2        B       
    2 rows selected.

  • Help needed in understanding conversion alghorithm from byte to hex

    Hi, I'm studying the following code:
    public static char[] byteToHex(byte[] data) {
      char[] retValue = new char[data.length * 2];
      int value = 0;
      int highIndex = 0;
      int lowIndex = 0;
      for (int i = 0; i < retValue.length; i++) {
        value = (data[i] + 256) % 256;
        highIndex = value >> 4;
        lowIndex = value & 0x0f;
        retValue[i * 2 + 0] = hexTable[highIndex];
        retValue[i * 2 + 1] = hexTable[lowIndex];
      return retValue;
    }There are few things (the most important) which I don't understand about the above code.
    I understood that what's returned has got double size related to what's passed in because a char takes 16 bits while a byte takes 8.
    1) I don't understand why each byte must be first added 256 and then % with 256 (returning the same value - Is this to eliminate negative values?)
    2) I do understand that each byte is transformed in two hexadecimal values: one is the highIndex (first 8 bits) and the second is the lowerIndex (last 8 bits) and that each value is tranformed in its hexadecimal value from the array of hex values.
    3) What I don't really understand is why the highIndex is calculated as: value >> 4
    and the lowest index is calculated as value 0x0f (is this last also to eliminate negative values?)
    If someone could clarify this for me, I'd be very grateful.
    Thanks.
    Marco

    So, does this mean that we add 256 to eliminate the sign?No. You need the whole line to convert a signed byte into an int between 0 and 255.
    A simpler way to do this would be
    value = data[i] & 0xFF;
    This moves down the higher bits so that it turnsinto lower bits. i.e. we need it to >be between 0 and
    15.
    Is this shifted of 4 because Math.pow(2, 4) = 16.0?Doing in this case, x >>4 is the same as x / 16
    This leaves only the lowest 4 bits.Is the following what happens?There are no char values produced. Using 0000 as an example is not a good idea as you can change it in many ways and it is still 0000
    >
    Received as initial value:
    byte: 0000 0000
    What we need to obtain:
    char: 0000 0000 0000 0000
    The first 4 bits of the above byte are shifted of 4
    positions to find the hexadecimal equivalent (if from
    2 I want to get to 16 I have to do the opposite of
    powering a number by 4); The last four bits of the
    byte are extracted because of the '&' operator with
    0x0f (which in binary is 1111 - Therefore all the '1'
    are kept)?Yes.

  • Form English Char ( Single Byte  ) TO Double Byte ( Japanese Char )

    Hello EveryOne !!!!
    I need Help !!
    I am new to Java ,.... I got assignment where i need to Check the String , if that string Contains Any Non Japanse Character ( a~z , A~Z , 0 -9 ) then this should be replaced with Double Byte ( Japanese Char )...
    I am using Java 1.2 ..
    Please guide me ...
    thanks and regards
    Maruti Chavan

    hello ..
    as you all asked Detail requirement here i an pasting C code where 'a' is passed as input character ..after process it is giving me Double Byte Japanese "A" .. i want this to be Done ..using this i am able to Convert APLHA-Numeric from singale byte to Doubel Byte ( Japanse ) ...
    Same program i want to Java ... so pleas guide me ..
    #include <stdio.h>
    int main( int argc, char *argv[] )
    char c[2];
    char d[3];
    strcpy( c, "a" ); // a is input char
    d[0] = 0xa3;
    d[1] = c[0] + 0x80;
    printf( ":%s:\n", c ); // Orginal Single byte char
    printf( ":%s:\n", d ); // Converted Double Byte ..
    please ..
    thax and regards
    Maruti Chavan

  • Byte to Chars converter

    Hi,
    I'm looking for a converter from byte array to char for different encodings (ANSI, UTF-8 and UTF-16BE, UTF-16LE encodings).
    I strongly believe there is a library/class that can do this.
    Thanks in advance.
    Lubos

    Well the problem is that I have to count the number of bytes and look for a special characters (like Form Feed).
    The only possibility I've found is to write my own parser..
    I've tried the InputStreamReader and implement my own implementation of InputStream for counting the bytes, but it seems the method read(byte[]) is not called every time..

  • Mixing byte and char input

    Hi,
    I have a setup where I wish to arbitarily read bytes or chars from the same underlying input stream, under jdk 1.3.x.
    As far as I can see, InputStreamReader will always always over-read from the underlying stream (to the tune of 8k, if it can) and never replace the data it didn't use. This could be removing data that should have been read as binary data, and thus corrupting the stream.
    Given that there's no way, it seems, of detecting the number of bytes per character for a given encoding, the only solution that I can think of is to provide an intermediate buffering stream that drip feeds the reader a conservative number of bytes. This obviously has profound efficiency implications if the reader has to re-fill() itself that often.
    Has anyone else sucessfully dealt with this problem?

    I'm still not
    sure I understand the problem. Is it that the char
    reader will keep reading past the chars removing the
    binary data from what is left to be read and
    preventing it from being read by a 'binary' reader?Yes - InputStreamReader, one of two ways to ensure that byte to char conversion is done properly pre-1.4, will use a fixed buffer size of 8192 bytes to read from the underlying stream.
    It seems that you may need to read in everything as
    binary data and delegate chars off to another Reader
    as you come across them. Of course you will have to
    know when the data should be interpreted as chars and
    when it should not. Only acheivable insofar as the underlying mechanism will be told by clients what to read(i.e. readLine() / readBytes(), or something).
    Some sort of home-rolled throttle between the underlying stream and the reader seems to be the only option, but this will be really clunky.
    There will have to be some sort
    of separator between the types. Am I understanding
    that this will be used with several different
    protocols?Yes, potentially a large number (this will, eventually, be a port of the Indy set of components for Delphi, http://www.nevrona.com/indy, FYI).

  • How can I get String from Bytes

    I want to get String from array of bytes but i have some trouble from byte that it's lager more than 128. How can I do ???
    Please hepl me. Thanks very much.

    This program is only to show you what the relationships are between unsigned byte, signed byte, character, and binary values. Because of the constraints that Java has, the program code is not especially clean. Run the program and see if it helps. As has been said, the character output is dependent on the encoding in use.
    Here is a sample of some of its output:
    Unsigned byte= 189 Signed byte= -67 Character= � Binary= 10111101
    Unsigned byte= 190 Signed byte= -66 Character= � Binary= 10111110
    Unsigned byte= 191 Signed byte= -65 Character= � Binary= 10111111
    Unsigned byte= 192 Signed byte= -64 Character= � Binary= 11000000
    Unsigned byte= 244 Signed byte= -12 Character= � Binary= 11110100
    Unsigned byte= 245 Signed byte= -11 Character= � Binary= 11110101
    Unsigned byte= 246 Signed byte= -10 Character= � Binary= 11110110
    public class ATest {
        public static void main(String[] args) {
            int in;
            byte by;
            String bin;
            char chr;
            for(in=0; in<256; in++) {
                // create a byte whose binary value is equal to the;
                // integer loop counter;
                by = (byte)in;
                // mask off sign extension [that I don't agree with!] and;
                // cast the resultant 8 bits to a char;
                chr = (char)(by & 0x00ff);
                // since there's no Byte.toInteger, must cast to int to get;
                // binary string and then delete unwanted portion of string;
                if(in<128) {
                    bin = Integer.toBinaryString((int)by);
                } else {
                    bin = Integer.toBinaryString((int)by).substring(24);
                // print everything;
                System.out.println(
                    "Unsigned byte= "+in+
                    " Signed byte= "+by+
                    " Character= "+chr+
                    " Binary= "+bin);
    }

  • Using byte or char array?

    I am trying to use byte[] or char[] to read from a socket. I used byte[] and char[], both works fine. However, I know byte is 8 bits and char is 16 bits. Does it matter which one I used?
    Thanks.

    When you deal with streams of plain bytes you should use input/outputstreams, not readers or writers that are meant for character streams. The inputstream equivalent to BufferedReader is BufferedInputStream and there is a method for reading a full byte[] there...
    But using a "bigger" data type than you need will not cause you big problems.

  • How to Change the data type of infoobject from NUMC to CHAR

    Hi Experts,
    I have created an infoobject with data type as NUMC, i used in DSO as a key figure and i have loaded data up to PSA.
    Now i want to change the data type of this Info Object from NUMC to CHAR.
    Can anyone suggest me the solution for this issue.
    Regards,
    Venu Gopal.K

    Hi pavan/binu,
    I have not loaded data into DSO i just added IO in Key fields and i started editing this IO then im facing error like
    1.Master Data Table /BIC/PZCUSTOMER contains data: Characteristic ZCUSTOMER cannot be activated     
    2.SID Table /BIC/SZCUSTOMER contains data: Characteristic ZCUSTOMER cannot be activated
    Im also unable to edit the P & S tables in SE14.
    NOTE:I have data only in PSA and when im trying to load data to DSO Im facing these issues.

  • Convert from jchar to char

    Does any one know how to convert from jchar to char?
    Thank you,

    does it have to be a jchar or can you get a jstring? is it possible to convert your jchar into a jstring before you pick it up in jni? if you can get a jstring you can use the function
    const char* GetStringUTFChars(jstring str, jboolean *isCopy)
    you would get back a character pointer that points to a single char plus the null terminator

  • Oracle Best practices for changing  Byte to Char on Varchar2 columns

    Dear Team,
    Application Team wanted to change Byte to Char on Varchar2 columns to accommodate Multi byte character  on couple of production tables.
    Wanted to know is it safe to have mixture of BYTE and CHAR semantics in the same table i have read on the couple of documents that It's good practice to avoid using a mixture of BYTE and CHAR semantics columns in the same table.
    What happens if we have mixture of BYTE and CHAR semantics columns in the same table?
    Do we need to gather stats & rebuild indexes on the table after these column changes .
    Thanks in Advance !!!
    SK

    Application Team wanted to change Byte to Char on Varchar2 columns to accommodate Multi byte character  on couple of production tables.
    Wanted to know is it safe to have mixture of BYTE and CHAR semantics in the same table i have read on the couple of documents that It's good practice to avoid using a mixture of BYTE and CHAR semantics columns in the same table.
    No change is needed to 'accommodate Multibyte characters'. That support has NOTHING to do with whether a column is specified using BYTE or CHAR.
    In 11g the limit for a VARCHAR2 column is 4000 bytes, period. If you specify CHAR and try to insert 1001 characters that each take 4 bytes you will get an exception since that would require 4004 bytes and the limit is 4000 bytes.
    In practice the use of CHAR is mostly a convenience to the developer when defining columns for multibyte characters. For example for a NAME column you might want to make sure Oracle will allocate room for 50 characters REGARDLESS of the actual length in bytes.
    If you provide a name of 50 one byte characters then only 50 bytes will be used. Provide a name of 50 four byte characters and 200 bytes will be used.
    So if  that NAME column was defined using BYTE how would you know what length to use for the column? Fifty BYTES will seldom be long enough and 200 bytes SEEMS large since the business user wants a limit of FIFTY characters.
    That is why such columns would typically use CHAR; so that the length (fifty) defined for the column matches the logical length of the number of characters.
    What happens if we have mixture of BYTE and CHAR semantics columns in the same table?
    Nothing happens - Oracle could care less.
    Do we need to gather stats & rebuild indexes on the table after these column changes .
    No - not if you by 'need' you mean simply because you made ONLY that change.
    But that begs the question: if the table already exists, has data and has been in use without their being any problems then why bother changing things now?
    In other words: if it ain't broke why try to fix it?
    So back to your question of 'best practices'
    Best practices is to set the length semantics at the database level when the database is first created and to then use that same setting (BYTE or CHAR) when you create new objects or make DDL changes.
    Best practices is also to not fix things that aren't broken.
    See the 'Length Semantics' section of the globalization support guide for more best practices
    http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch2charset.htm#i1006683

  • Coversion from byte stream to character & character to byte stream.

    This is a test program.
    import java.io.*;
    class Test
         public static void main(String[] args)
              System.out.println("Hello World!");
              try
                   BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("C:/javafiles/testing/Picture.jpg"))));
                   PrintWriter bw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File("C:/javafiles/testing/Copy.jpg"))));
                   String in = br.readLine();
                   while (in != null)
                        bw.println(in);
                        in = br.readLine();
                   br.close();
                   bw.close();
              catch (Exception e)
                   System.out.println("\n\n**********Exception Occured**************\n" + e);
    **First of all I read jpg file convert it into character stream from byte stream.
    **and copy it back and convert it back into byte steam from character stream.
    **The file copied back is corrupted.(getting open but display has fully scattered.)
    **That means data has been lost in conversion.
    **is it due to the encoding, I havn't specified while writing, or it always happens when we convert from byte stream to character and vice versa.
    **What encoding should I use while writing jpg files.
    please comment.

    **First of all I read jpg file convert it into
    character stream from byte stream.
    **and copy it back and convert it back into byte
    steam from character stream.First of all this operation is meaningless. A JPEG file doesn't contain anything that can be converted to characters. Delete the 'conversions' and all will be well.
    **What encoding should I use while writing jpg files.None. Don't use an encoding. Don't use Readers and Writers. Use InputStreams and OutputStreams only.

  • Byte or CHAR? - as Unit

    Hi all,
    DB - 9.2
    Which is the better option to keep unit as Byte or CHAR while using the VARCHAR2 datatype?
    Suppose unit is selected as Byte then is it not cumbersome to calculate the max. no. of characters could be stored in the field?

    Hi!
    I'd propose CHAR, because with BYTE it is dependent of the character set how many characters you can store in your field. This means -> calculate :)
    Best regards,
    Daniel

Maybe you are looking for

  • Need help to build Portal Insert URL in OAM..

    Hi All, I have a requirement to customize the user Manager screen in such a way that i need to get only the search criteria tab(but not any of the tabs or links) and the search results. To achieve this i have builded below Portal URL. http://training

  • IPod touch will not turn on even after charging and holding buttons

    iPod touch 4th gen will not turn on. I have charged it on computer into a USB port for hours. I have held the SleepWake button together with the Home button for 10 sec, 20 sec, 30 sec, and 40 sec. I have tried releasing the SleepWake button first. I

  • Problems with RowSelection in adf table

    I have problems with selection of a row in a adf table. Even though I have set the property : rowSelection="single" , when i select a row, the two other rows that follow, get selected too. For example I have 10 records an when i select the 7th row, t

  • Setting the document language in a pdf for accessibility

    I have created a form in livecycle and ran the full accessiblity check in Adobe and it says that 'All of the text on this page lacks a language specification'. I tried to go into the document properties>advanced and set the reading options but everyt

  • Moving movies to apple tv

    My powerbook G4 harddrive is full. I have an external drive and an apple tv. what would be the safest/fastest way to have those movies off my computer to free up space, and have them on my apple tv?