NLS_LANG is a client side environmental variable. To specify the locale behavior- setting the NLS_LANG environment parameter is the simplest way.
With the setting of NLS_LANG parameter on client machine it is specified the language, territory and character set used by the client application. As through NLS_LANG parameter, client character set is also specified so oracle has an idea which is the character set for data entered or displayed by a client program as well as Oracle can do (if needed) conversion from the client's character set to the database character set.
On UNIX machine NLS_LANG parameter is an environmental variable and on windows machine this value comes from registry settings.
The parameter NLS_LANG holds the following format.
NLS_LANG=[Language]_[Territory].[clients character set]
The default value of NLS_LANG is AMERICAN_AMERICA.US7ASCII which indicates that
The language is AMERICAN,
the territory is AMERICA, and
the character set is US7ASCII.
The first part of NLS_LANG parameter is language and it is used for Oracle Database messages, sorting, day names, and month names. Each language has a unique name.
The language specifies default values for territory and character set so if language is specified then the other two arguments can be omitted. Language can have the value like AMERICAN, GERMAN, FRENCH, JAPANESE etc. The default value is AMERICAN.
The second part of NLS_LANG parameter is territory and it is used for default date, monetary, and numeric formats. Each territory has a unique name. Territory can have the value like AMERICA, FRANCE, JAPAN, CANADA etc. If the territory is not specified, then the value is derived from the language value.
The third part of NLS_LANG parameter is the client character set. It specifies the character set that is used by the client application. The client character set used for Oracle should be equivalent to the character set supported for the client machine. This character set should also be equivalent to or a subset of the character set used for your database so that every character input through the terminal has a matching character to map to in the database. Example of client character set is US7ASCII, WE8ISO8859P1, WE8DEC, WE8MSWIN1252 etc.
It is important to note that all three parts of NLS_LANG environmental variable/parameter are optional. This means if any of the parts are not specified then default value is used- may be the default value is derived value. You can specify Territory and/or character set without language value; in this case your must include the preceding delimiter -underscore (_) for territory and period (.) for character set. If you don't include the delimiter then the whole value is parsed as a language name.
For example you can only set territory portion by,
NLS_LANG=_FRANCE
You can only set client character set portion by,
NLS_LANG=.WE8MSWIN1252
The three parts of NLS_LANG can be specified in many combination but all of the combination may not work properly. Like,
NLS_LANG = JAPANESE_JAPAN.WE8ISO8859P1
This combination can be will not work properly. Beacuse the specification will try to support Japanese by using a Western European character set but WE8ISO8859P1 character set does not support any Japanese characters.
So if you set your NLS_LANG environmental variable above then you can't store or display Japanese character.
Some logical combination,
NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
NLS_LANG = FRENCH_CANADA.WE8ISO8859P1
NLS_LANG = JAPANESE_JAPAN.JA16EUC
In server machine there is no need to set NLS_LANG environmental variable. This variable is only needed for client machine. The character set defined for NLS_LANG environmental variable should be the subset or equal to the database character set so that oracle can aware of each character set and thus can convert client character set correctly. It is also important that character set value of NLS_LANG variable should reflect client machine supported character set so that client machine can display that properly. For example if japanese character set is not installed in client machine but NLS_LANG parameter is set as JAPANESE_JAPAN.JA16EUC then client will not be able to see JAPANESE characters properly.
Important Notes About NLS_LANG Parameter
1)NLS_LANG is used to let Oracle know what character set client's OS is using so that Oracle can do (if needed) conversion from the client's character set to the database characterset.
2)Don't think that NLS_LANG needs to be the same as the database characterset.
3)The characterset defined with the NLS_LANG parameter does not change your client's character set. You cannot change the characterset of your client by using a different NLS_LANG setting. NLS_LANG is used to let Oracle know what characterset you are using on the client side.
4)Don't think that, if you don't set the NLS_LANG on the client it uses the NLS_LANG of the server (which is not true). If you don't set it then default NLS_LANG as described earlier in this post is used.
5)If the NLS_LANG variable match with database character set then oracle will perform no validation on the character set; and thus incorrect NLS_LANG settings may cause to enter garbage data into the database.
Related Documents
Unicode characterset in Oracle database.
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
Saturday, February 28, 2009
What is NLS_LANG environmental variable?
| Reactions: |
Different ways to set up NLS parameters
The word NLS means National Language Support. The NLS_* parameters determine the
locale-specific behavior on both the client and the server; where * of NLS_* is for various strings which make various NLS parameters.
There are many NLS_* parameters like NLS_SORT, NLS_LANGUAGE, NLS_CHARACTERSET, NLS_DATE_LANGUAGE etc. In this post I will show how the NLS parameters can be set based on their setting of priority.
1)In SQL functions:
If you set NLS_* parameters inside SQL functions then that setting has the highest priority.
You can set in SQL functions like,
TO_CHAR(sysdate, 'DD/MON/YYYY', 'nls_date_language = FRENCH')
Below is an example. Note that in my client machine FRENCH language is not installed so it might not display properly.
Setting in this way (inside sql functions) overrides the default values that are set for the session in the initialization parameter file, set for the client with environment variables, or set for the session by the ALTER SESSION statement.
2)With the ALTER SESSION statement:
Setting through ALTER SESSION parameter has the second highest priority. Setting by an ALTER SESSION statement override the default values that are set for the session in the initialization parameter file or set by the client with environment variables.
Below is an example. As in my client machine Japanese language is not installed so displaying in Japanese character might not work properly.
3)Through Environmental variable on the client machine:
This setting has the third highest priority. Through OS environmental variable you can set NLS_* parameters. Setting of environmental variable is platform specific. On windows machine you can set by,
C:>set NLS_*=value;
On unix machine
$export NLS_*=value (bash shell)
$setenv NLS_*=value (c shell)
Below is an example on my windows client machine.
C:\>set NLS_SORT=FRENCH
4)As initialization parameters on the server:
You can set the NLS_* parameters in the server machine inside the initialization parameter file. Setting in the initialization parameter specify a default session NLS environment. Setting in this way has no effect on the client side, they control only the server's behavior.
For example, if you use spfile then you can set NLS_TERRITORY parameter by below,
SQL> ALTER SYSTEM SET NLS_TERRITORY = "CZECH REPUBLIC" scope=spfile;
System altered.
Then in order to effect bounce database.
If I draw a table based on priority and ways to do then it will be like,
locale-specific behavior on both the client and the server; where * of NLS_* is for various strings which make various NLS parameters.
There are many NLS_* parameters like NLS_SORT, NLS_LANGUAGE, NLS_CHARACTERSET, NLS_DATE_LANGUAGE etc. In this post I will show how the NLS parameters can be set based on their setting of priority.
1)In SQL functions:
If you set NLS_* parameters inside SQL functions then that setting has the highest priority.
You can set in SQL functions like,
TO_CHAR(sysdate, 'DD/MON/YYYY', 'nls_date_language = FRENCH')
Below is an example. Note that in my client machine FRENCH language is not installed so it might not display properly.
SQL> select sysdate from dual;
SYSDATE
---------
07-FEB-09
SQL> select TO_CHAR(sysdate, 'DD/MON/YYYY', 'nls_date_language = FRENCH') from dual;
TO_CHAR(SYSDA
-------------
07/F╔VR./2009
Setting in this way (inside sql functions) overrides the default values that are set for the session in the initialization parameter file, set for the client with environment variables, or set for the session by the ALTER SESSION statement.
2)With the ALTER SESSION statement:
Setting through ALTER SESSION parameter has the second highest priority. Setting by an ALTER SESSION statement override the default values that are set for the session in the initialization parameter file or set by the client with environment variables.
Below is an example. As in my client machine Japanese language is not installed so displaying in Japanese character might not work properly.
SQL> select sysdate from dual;
SYSDATE
---------
07-FEB-09
SQL> alter session set NLS_DATE_LANGUAGE=JAPANESE;
Session altered.
SQL> select sysdate from dual;
SYSDATE
----------
07-2┐ -09
3)Through Environmental variable on the client machine:
This setting has the third highest priority. Through OS environmental variable you can set NLS_* parameters. Setting of environmental variable is platform specific. On windows machine you can set by,
C:>set NLS_*=value;
On unix machine
$export NLS_*=value (bash shell)
$setenv NLS_*=value (c shell)
Below is an example on my windows client machine.
C:\>set NLS_SORT=FRENCH
4)As initialization parameters on the server:
You can set the NLS_* parameters in the server machine inside the initialization parameter file. Setting in the initialization parameter specify a default session NLS environment. Setting in this way has no effect on the client side, they control only the server's behavior.
For example, if you use spfile then you can set NLS_TERRITORY parameter by below,
SQL> ALTER SYSTEM SET NLS_TERRITORY = "CZECH REPUBLIC" scope=spfile;
System altered.
Then in order to effect bounce database.
If I draw a table based on priority and ways to do then it will be like,
Priority Ways to do the task.
----------- -----------------------------------------
1 (highest) Set in SQL functions
2 Set by an ALTER SESSION statement
3 Set as an environment variable
4 Specified in the initialization parameter file
5 (lowest) Default
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
| Reactions: |
How to know whether there is N-type columns on database
Below query will return the name of the owner and the table whether there is N-type columns in the database.
The DBA_FGA_AUDIT_TRAIL comes for Fine Grained Auditing.
ALL_REPPRIORITY, DBA_REPPRIORITY, USER_REPPRIORITY, DEF$_TEMP$LOB , DEF$_TEMP$LOB and REPCAT$_PRIORITY comes for Advanced Replication.
DEFLOB comes for Deferred Transactions functionality.
STREAMS$_DEF_PROC comes for Oracle Streams.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
SQL> select distinct OWNER, TABLE_NAME from DBA_TAB_COLUMNS where DATA_TYPE
in ('NCHAR','NVARCHAR2', 'NCLOB') order by 1;
OWNER TABLE_NAME
------------------------------ ------------------------------
SYS ALL_REPPRIORITY
SYS DBA_AUDIT_EXISTS
SYS DBA_AUDIT_OBJECT
SYS DBA_AUDIT_STATEMENT
SYS DBA_AUDIT_TRAIL
SYS DBA_COMMON_AUDIT_TRAIL
SYS DBA_FGA_AUDIT_TRAIL
SYS DBA_REPPRIORITY
SYS DEFLOB
SYS STREAMS$_DEF_PROC
SYS USER_AUDIT_OBJECT
SYS USER_AUDIT_STATEMENT
SYS USER_AUDIT_TRAIL
SYS USER_REPPRIORITY
SYSTEM DEF$_LOB
SYSTEM DEF$_TEMP$LOB
SYSTEM REPCAT$_PRIORITY
17 rows selected.
The DBA_FGA_AUDIT_TRAIL comes for Fine Grained Auditing.
ALL_REPPRIORITY, DBA_REPPRIORITY, USER_REPPRIORITY, DEF$_TEMP$LOB , DEF$_TEMP$LOB and REPCAT$_PRIORITY comes for Advanced Replication.
DEFLOB comes for Deferred Transactions functionality.
STREAMS$_DEF_PROC comes for Oracle Streams.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
| Reactions: |
Friday, February 27, 2009
Which datatypes use the National Character Set?
There are three datatypes which can store data in the national character set.
1)NCHAR: It is fixed length national character set- character datatype. This datatype uses CHAR length semantics, that is, the length of the NCHAR datatype column is defined in characters.
2)NVARCHAR2: It is variable length national character set- character datatype. This datatype uses CHAR length semantics, that is, the length of the NVARCHAR2 datatype column is defined in characters.
3)NCLOB: It stores national character set data up to four gigabytes. Data is always stored in UCS2 or AL16UTF16, even if the NLS_NCHAR_CHARACTERSET is UTF8.
If you use NCHAR/NVARCHAR2/NCLOB data type then, use the (N'...') syntax when coding these data type so that literals are denoted as being in the national character set by prefixing letter 'N'.
Below is an example.
1)NCHAR: It is fixed length national character set- character datatype. This datatype uses CHAR length semantics, that is, the length of the NCHAR datatype column is defined in characters.
2)NVARCHAR2: It is variable length national character set- character datatype. This datatype uses CHAR length semantics, that is, the length of the NVARCHAR2 datatype column is defined in characters.
3)NCLOB: It stores national character set data up to four gigabytes. Data is always stored in UCS2 or AL16UTF16, even if the NLS_NCHAR_CHARACTERSET is UTF8.
If you use NCHAR/NVARCHAR2/NCLOB data type then, use the (N'...') syntax when coding these data type so that literals are denoted as being in the national character set by prefixing letter 'N'.
Below is an example.
SQL> create table t_test(col1 NVARCHAR2(30));
Table created.
SQL> insert into t_test values(N'This is NLS_NCHAR_CHARACTERSET');
1 row created.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
What is character set and character set encoding
| Reactions: |
What is national character set / NLS_NCHAR_CHARACTERSET?
- The national character set is the character set which is defined in oracle database in addition to normal character set.
- The normal character set is defined by the parameter NLS_CHARACTERSET and the national character set is defined by the parameter NLS_NCHAR_CHARACTERSET.
- The national character set is used for data stored in NCHAR, NVARCHAR2 and NCLOB columns while the normal character set is used for data stored in CHAR, VARCHAR2, CLOB columns.
- You can get the value of national character set or NLS_NCHAR_CHARACTERSET by,
SQL> select value from nls_database_parameters where parameter='NLS_NCHAR_CHARACTERSET';
VALUE
----------------------------------------
AL16UTF16
SQL> select value$ from sys.props$ where name='NLS_NCHAR_CHARACTERSET';
VALUE$
--------------------------------------------------------------------------------
AL16UTF16
SQL> select property_value from database_properties where property_name
='NLS_NCHAR_CHARACTERSET';
PROPERTY_VALUE
--------------------------------------------------------------------------------
AL16UTF16
- NLS_NCHAR_CHARACTERSET is defined when the database is created and specified with the CREATE DATABASE command.
- The default value of NLS_NCHAR_CHARACTERSET is AL16UTF16.
- From Oracle 9i onwards the NLS_NCHAR_CHARACTERSET can have only 2 values, either UTF8 or AL16UTF16 and both are unicode character sets.
- National character set are always defined in CHAR length semantics and you cannot define them in BYTE. That means if you defines NCHAR(5) then 5 maximum characters can be stored regardless of how many bytes they can hold.
- Many one thinks that they need to use the NLS_NCHAR_CHARACTERSET to have UNICODE support in oracle but this is not true. One can always use UNICODE in either two ways. Storing data into NCHAR, NVARCHAR2 or NCLOB columns or you can perfectly use "normal" CHAR and VARCHAR2 columns for storing unicode in a database who has a AL32UTF8 / UTF8 NLS_CHARACTERSET.
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
Which datatypes use the National Character Set?
What is character set and character set encoding
| Reactions: |
Thursday, February 26, 2009
What is Oracle Globalization Support
The term Oracle Globalization Support is used for oracle database as oracle database now support to store, process, and retrieve data from all languages. It also ensures that database utilities, error messages, date, time, monetary, numeric, and calendar conventions automatically adapt to any native language and locale in oracle.
Before 9i the term Oracle Globalization Support term was referred as National Language Support(NLS) features. From 9i onwards, NLS is actually a subset of globalization support. NLS is the ability to choose a national language and store data in a specific character set.
The oracle globalization support feature enables you to develop multilingual applications and software products which can be accessed from anywhere in the world and in any languages. In the database you can now store any language you wish.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
Before 9i the term Oracle Globalization Support term was referred as National Language Support(NLS) features. From 9i onwards, NLS is actually a subset of globalization support. NLS is the ability to choose a national language and store data in a specific character set.
The oracle globalization support feature enables you to develop multilingual applications and software products which can be accessed from anywhere in the world and in any languages. In the database you can now store any language you wish.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
| Reactions: |
What is database character set and how to check it
Note that database character set refers to the term character set encoding and in oracle database the terms character set and character set encoding are often used interchangeably.
The database character set in oracle determines the set of characters can be stored in the database. It is also used to determine the character set to be used for object identifiers and PL/SQL variables and for storing PL/SQL program source.
The database character set information is stored in the data dictionary tables named SYS.PROPS$.
You can get the character set used in the database by SYS.PROPS$ table or any other views (like database_properties/ nls_database_parameters) exist in the database. The parameter NLS_CHARACTERSET value contains the database character set name. Get it from,
The database character set in oracle determines the set of characters can be stored in the database. It is also used to determine the character set to be used for object identifiers and PL/SQL variables and for storing PL/SQL program source.
The database character set information is stored in the data dictionary tables named SYS.PROPS$.
You can get the character set used in the database by SYS.PROPS$ table or any other views (like database_properties/ nls_database_parameters) exist in the database. The parameter NLS_CHARACTERSET value contains the database character set name. Get it from,
SQL> select value$ from sys.props$ where name='NLS_CHARACTERSET';
VALUE$
--------------------------------------------------------------------------------
WE8MSWIN1252
SQL> select property_value from database_properties where property_name=
'NLS_CHARACTERSET';
PROPERTY_VALUE
--------------------------------------------------------------------------------
WE8MSWIN1252
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
----------------------------------------
WE8MSWIN1252
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
What is character set and character set encoding
| Reactions: |
What is character set and character set encoding
The term character set indicates the set of characters used by a particular encoding system. It does not represent the numeric assignments of the characters nor the order of the characters but just the set of characters under an encoding system.
The term character set encoding refers how each character of a character set is represented under an encoding system. In order words character set encoding is the mapping of characters to binary values. It pairs the character from the character set with a natural number. Suppose, in 8-bit character set encoding each character from the character set is mapped to the values range from 0-255.
For example capital A will be encoded to 65. Every time you press A from keyboard it will be interpreted as 65. This system also named as encoding scheme.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
The term character set encoding refers how each character of a character set is represented under an encoding system. In order words character set encoding is the mapping of characters to binary values. It pairs the character from the character set with a natural number. Suppose, in 8-bit character set encoding each character from the character set is mapped to the values range from 0-255.
For example capital A will be encoded to 65. Every time you press A from keyboard it will be interpreted as 65. This system also named as encoding scheme.
Related Documents
Unicode characterset in Oracle database.
What is NLS_LANG environmental variable?
What is database character set and how to check it
Different ways to set up NLS parameters
What is national character set / NLS_NCHAR_CHARACTERSET?
Which datatypes use the National Character Set?
| Reactions: |
Wednesday, February 25, 2009
ORA-00904: "CNVTYPE" CSS-08888: failed to update conversion type
Problem Description
To check all character data in the database and tests for the effects and problems of changing the character set encoding we ran csscan before character set migration but csscan fails with
ORA-00904: "CNVTYPE": invalid identifier
CSS-08888: failed to update conversion type
as below.
C:\>csscan arju/a@orcl user=arju process=2 array=1024000 TOCHAR=AL32UTF8
Character Set Scanner v2.2 : Release 11.1.0.6.0 - Production on Tue Feb 3 17:15:46 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Enumerating tables to scan...
. process 1 scanning ARJU.TEST_VARCHAR[AAAaieAAEAAAPiBAAA]
ORA-00904: "CNVTYPE": invalid identifier
CSS-08888: failed to update conversion type
Scanner terminated unsuccessfully.
Cause of the problem
The ORA-00904: "CNVTYPE": invalid identifier in csscan occurred due to version mismatch between csscan utility and database. From the above output we see Character Set Scanner v2.2 : Release 11.1.0.6.0 that is csscan version is 2.2 and it is of release 11g while it connects to database 10.2g. In order to connect to oracle database 10g it is recommended to use csscan tool of version 2.1. Hence we connect 10.2g database with 11g csscan so above error comes.
Solution of the problem
In order to connect to 10.2g database use 10.2g csscan that is csscan of version 2.1. So from 10g ORACLE_HOME I explicitly selected csscan of version 2.1 and run the operation which goes successful.
C:\>j:\oracle\product\10.2.0\db_1\BIN\csscan.exe arju/a@orcl user=arju process=2 array=1024000 TOCHAR=AL32UTF8
Character Set Scanner v2.1 : Release 10.2.0.0.0 - Production on Tue Feb 3 17:30:02 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Enumerating tables to scan...
. process 1 scanning ARJU.TEST_VARCHAR[AAAaieAAEAAAPiBAAA]
Creating Database Scan Summary Report...
Creating Individual Exception Report...
Scanner terminated successfully.
Related Documents
CSSCAN fails with CSS-00151: failed to enumerate user tables CSS-00120
CSSCAN fails with error while loading shared libraries: libclntsh.so.10.1
How to run csscan in the background as a sysdba
CSSCAN fails with CSS-00107: Character set migration utility schema not installed
CSSCAN fails with ORA-00600, CSS-00152, CSS-00120
To check all character data in the database and tests for the effects and problems of changing the character set encoding we ran csscan before character set migration but csscan fails with
ORA-00904: "CNVTYPE": invalid identifier
CSS-08888: failed to update conversion type
as below.
C:\>csscan arju/a@orcl user=arju process=2 array=1024000 TOCHAR=AL32UTF8
Character Set Scanner v2.2 : Release 11.1.0.6.0 - Production on Tue Feb 3 17:15:46 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Enumerating tables to scan...
. process 1 scanning ARJU.TEST_VARCHAR[AAAaieAAEAAAPiBAAA]
ORA-00904: "CNVTYPE": invalid identifier
CSS-08888: failed to update conversion type
Scanner terminated unsuccessfully.
Cause of the problem
The ORA-00904: "CNVTYPE": invalid identifier in csscan occurred due to version mismatch between csscan utility and database. From the above output we see Character Set Scanner v2.2 : Release 11.1.0.6.0 that is csscan version is 2.2 and it is of release 11g while it connects to database 10.2g. In order to connect to oracle database 10g it is recommended to use csscan tool of version 2.1. Hence we connect 10.2g database with 11g csscan so above error comes.
Solution of the problem
In order to connect to 10.2g database use 10.2g csscan that is csscan of version 2.1. So from 10g ORACLE_HOME I explicitly selected csscan of version 2.1 and run the operation which goes successful.
C:\>j:\oracle\product\10.2.0\db_1\BIN\csscan.exe arju/a@orcl user=arju process=2 array=1024000 TOCHAR=AL32UTF8
Character Set Scanner v2.1 : Release 10.2.0.0.0 - Production on Tue Feb 3 17:30:02 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Enumerating tables to scan...
. process 1 scanning ARJU.TEST_VARCHAR[AAAaieAAEAAAPiBAAA]
Creating Database Scan Summary Report...
Creating Individual Exception Report...
Scanner terminated successfully.
Related Documents
CSSCAN fails with CSS-00151: failed to enumerate user tables CSS-00120
CSSCAN fails with error while loading shared libraries: libclntsh.so.10.1
How to run csscan in the background as a sysdba
CSSCAN fails with CSS-00107: Character set migration utility schema not installed
CSSCAN fails with ORA-00600, CSS-00152, CSS-00120
| Reactions: |
Tuesday, February 24, 2009
CSSCAN fails with CSS-00107: Character set migration utility schema not installed
Problem Description
While running csscan in order to check all character data in the database and tests for the effects and problems of changing the character set encoding, "CSS-00107: Character set migration utility schema not installed" error returned as below.
Cause of the problem
In order to run character set scanner in the database it is needed to create tables for Database Character Set Migration Utility. The tables are required to run csscan utility successfully. These tables are created under csmig user. The script named $ORACLE_HOME/rdbms/admin/csminst.sql contains all the tables/synonyms/grants that is requied for cssan.
Solution of the problem
As sys user run the csminst.sql script under $ORACLE_HOME/rdbms/admin directory.
1)Connect as sys.
C:\>sqlplus sys/a@san as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Feb 2 18:32:38 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2)Execute csminst.sql.
Here my $ORACLE_HOME is F:\app\Administrator\product\11.1.0\db_1.
While execute the script it will prompt password of csscan. Type password as you like and then press enter.
3)Now run csscan
CSSCAN fails with CSS-00151: failed to enumerate user tables CSS-00120
CSSCAN fails with error while loading shared libraries: libclntsh.so.10.1
How to run csscan in the background as a sysdba
CSSCAN fails with ORA-00600, CSS-00152, CSS-00120
ORA-00904: "CNVTYPE" CSS-08888: failed to update conversion type
While running csscan in order to check all character data in the database and tests for the effects and problems of changing the character set encoding, "CSS-00107: Character set migration utility schema not installed" error returned as below.
C:\>csscan arju/a@san user=arju array=1024000 TOCHAR=AL32UTF8 process=2
Character Set Scanner v2.2 : Release 11.1.0.6.0 - Production on Mon Feb 2 18:31:14 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
CSS-00107: Character set migration utility schema not installed
Scanner terminated unsuccessfully.
Cause of the problem
In order to run character set scanner in the database it is needed to create tables for Database Character Set Migration Utility. The tables are required to run csscan utility successfully. These tables are created under csmig user. The script named $ORACLE_HOME/rdbms/admin/csminst.sql contains all the tables/synonyms/grants that is requied for cssan.
Solution of the problem
As sys user run the csminst.sql script under $ORACLE_HOME/rdbms/admin directory.
1)Connect as sys.
C:\>sqlplus sys/a@san as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Feb 2 18:32:38 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2)Execute csminst.sql.
Here my $ORACLE_HOME is F:\app\Administrator\product\11.1.0\db_1.
SQL> @F:\app\Administrator\product\11.1.0\db_1\RDBMS\ADMIN\csminst.sql
Grant succeeded.
Grant succeeded.
drop user csmig cascade
*
ERROR at line 1:
ORA-01918: user 'CSMIG' does not exist
Please create password for user CSMIG:
Enter value for csmig_passwd: a
old 1: create user csmig identified by &csmig_passwd
new 1: create user csmig identified by a
User created.
Grant succeeded.
Grant succeeded.
drop public synonym csmv$triggers
*
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist
Synonym created.
View created.
View created.
Commit complete.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
While execute the script it will prompt password of csscan. Type password as you like and then press enter.
3)Now run csscan
Related Documents
C:\>csscan arju/a@san user=arju array=1024000 TOCHAR=AL32UTF8 process=2
Character Set Scanner v2.2 : Release 11.1.0.6.0 - Production on Mon Feb 2 18:35:50 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Enumerating tables to scan...
.
.
.
And everything goes fine.
CSSCAN fails with CSS-00151: failed to enumerate user tables CSS-00120
CSSCAN fails with error while loading shared libraries: libclntsh.so.10.1
How to run csscan in the background as a sysdba
CSSCAN fails with ORA-00600, CSS-00152, CSS-00120
ORA-00904: "CNVTYPE" CSS-08888: failed to update conversion type
| Reactions: |
Monday, February 23, 2009
Split, Merge, Add, Drop, Exchange, Modify, Rename Partition syntax.
If you look for partition related posts in my blog then have a look at,
How to do partition
Partitioning using online re-definition
How to make partitioning in Oracle more Quickly
Example of global partitioned, global non-partitioned and local Indexes
In this post I will write about syntax/example of partitioning related aspects.
1)Split Table Partition Example:
Partition activity_06_2007 of table user_activity split into two partitions at date 15-JUN-2007. Data before date 15-JUN-2007 is stored into partition activity_06_2007a. Data after date 15-JUN-2007 is stored into partition activity_06_2007b.
ALTER TABLE user_activity SPLIT PARTITION activity_06_2007
AT (TO_DATE('15-JUN-2007','DD-MON-YYYY'))
INTO (PARTITION activity_06_2007a, PARTITION activity_06_2007b);
The above example is for split range partition.
The following example is for split partition of list partition.
ALTER TABLE list_country SPLIT PARTITION rest
VALUES ('BANGLADESH', 'PAKISTAN')
INTO (PARTITION asia, partition rest);
2)Merge Table Partition Example:
In part 1) merge range partition as before by,
ALTER TABLE user_activity MERGE PARTITIONS activity_06_2007a, activity_06_2007b
INTO PARTITION activity_06_2007;
In part 1) merge list partition as before by,
ALTER TABLE list_country
MERGE PARTITIONS asia, rest INTO PARTITION rest;
3)Add Table Partition with LOB Example:
Add a new partition into user_activity table and also store lob column into another tablespace data03.
ALTER TABLE user_activity ADD partition prest values less than (MAXVALUE)
LOB (log, description) STORE AS (TABLESPACE data03);
4)Drop Table Partition Example:
ALTER TABLE DROP PARTITION p1;
Drop and update global indexes in one statement.
ALTER TABLE DROP PARTITION p1 UPDATE GLOBAL INDEXES;
5)Exchange Table Partition Example:
Create the same table as of structure(only column and data type is mandatory) of the partitioned table.
And then run command,
ALTER TABLE user_activity
EXCHANGE PARTITION P_JUN_2007 WITH TABLE UA_JUN_2007;
Note that UA_JUN_2007 must be created prior to execute ALTER TABLE ... EXCHANGE command.
6)Modify Table Partitions Example:
Marking local indexes of partition P3 unusable of table user_activity.
ALTER TABLE user_activity MODIFY PARTITION P3
UNUSABLE LOCAL INDEXES;
Rebuilds all the local index partitions that were marked UNUSABLE,
ALTER TABLE user_activity MODIFY PARTITION P3
REBUILD UNUSABLE LOCAL INDEXES;
7)Move Table Partitions Example:
The following statement will move partition P3 of table user_activity to a new tablespace data04;
ALTER TABLE user_activity MOVE PARTITION p3 TABLESPACE data04;
8)Rename Table Partitions Example:
The partition P3 of user_activity table will be renamed as MAR_2008.
ALTER TABLE sales RENAME PARTITION p3 TO MAR_2008;
9)Truncating Table Partitions Example:
Deletes all the data in the MAR_2008 partition of user_activity table and deallocates the freed space,
ALTER TABLE user_activity
TRUNCATE PARTITION mar_2008 DROP STORAGE;
Related Documents
How to do partition
Partitioning using online re-definition
How to make partitioning in Oracle more Quickly
Example of global partitioned, global non-partitioned and local Indexes
How to do partition
Partitioning using online re-definition
How to make partitioning in Oracle more Quickly
Example of global partitioned, global non-partitioned and local Indexes
In this post I will write about syntax/example of partitioning related aspects.
1)Split Table Partition Example:
Partition activity_06_2007 of table user_activity split into two partitions at date 15-JUN-2007. Data before date 15-JUN-2007 is stored into partition activity_06_2007a. Data after date 15-JUN-2007 is stored into partition activity_06_2007b.
ALTER TABLE user_activity SPLIT PARTITION activity_06_2007
AT (TO_DATE('15-JUN-2007','DD-MON-YYYY'))
INTO (PARTITION activity_06_2007a, PARTITION activity_06_2007b);
The above example is for split range partition.
The following example is for split partition of list partition.
ALTER TABLE list_country SPLIT PARTITION rest
VALUES ('BANGLADESH', 'PAKISTAN')
INTO (PARTITION asia, partition rest);
2)Merge Table Partition Example:
In part 1) merge range partition as before by,
ALTER TABLE user_activity MERGE PARTITIONS activity_06_2007a, activity_06_2007b
INTO PARTITION activity_06_2007;
In part 1) merge list partition as before by,
ALTER TABLE list_country
MERGE PARTITIONS asia, rest INTO PARTITION rest;
3)Add Table Partition with LOB Example:
Add a new partition into user_activity table and also store lob column into another tablespace data03.
ALTER TABLE user_activity ADD partition prest values less than (MAXVALUE)
LOB (log, description) STORE AS (TABLESPACE data03);
4)Drop Table Partition Example:
ALTER TABLE DROP PARTITION p1;
Drop and update global indexes in one statement.
ALTER TABLE DROP PARTITION p1 UPDATE GLOBAL INDEXES;
5)Exchange Table Partition Example:
Create the same table as of structure(only column and data type is mandatory) of the partitioned table.
And then run command,
ALTER TABLE user_activity
EXCHANGE PARTITION P_JUN_2007 WITH TABLE UA_JUN_2007;
Note that UA_JUN_2007 must be created prior to execute ALTER TABLE ... EXCHANGE command.
6)Modify Table Partitions Example:
Marking local indexes of partition P3 unusable of table user_activity.
ALTER TABLE user_activity MODIFY PARTITION P3
UNUSABLE LOCAL INDEXES;
Rebuilds all the local index partitions that were marked UNUSABLE,
ALTER TABLE user_activity MODIFY PARTITION P3
REBUILD UNUSABLE LOCAL INDEXES;
7)Move Table Partitions Example:
The following statement will move partition P3 of table user_activity to a new tablespace data04;
ALTER TABLE user_activity MOVE PARTITION p3 TABLESPACE data04;
8)Rename Table Partitions Example:
The partition P3 of user_activity table will be renamed as MAR_2008.
ALTER TABLE sales RENAME PARTITION p3 TO MAR_2008;
9)Truncating Table Partitions Example:
Deletes all the data in the MAR_2008 partition of user_activity table and deallocates the freed space,
ALTER TABLE user_activity
TRUNCATE PARTITION mar_2008 DROP STORAGE;
Related Documents
How to do partition
Partitioning using online re-definition
How to make partitioning in Oracle more Quickly
Example of global partitioned, global non-partitioned and local Indexes
| Reactions: |
Sunday, February 22, 2009
File manipulation in oracle with UTL_FILE package -Part 2
In the post http://arjudba.blogspot.com/2009/02/file-manipulation-in-oracle-with.html I already discussed about the subprograms FOPEN, FOPEN_NCHAR, FREMOVE, FRENAME, FCOPY, FCLOSE, FCLOSE_ALL of UTL_FILE package. Those subprograms were about the basic file handling operation such as opening, closing, renaming, moving, copying files. In this post I will write about the subprograms that are used to write contents inside OS files.
1)NEW_LINE procedure: The NEW_LINE procedure writes one or more new line terminator to the file. The syntax to use this procedure is,
UTL_FILE.NEW_LINE (
file IN FILE_TYPE,
lines IN NATURAL := 1);
file is the name of the file handle that is open by FOPEN/FOPEN_NCHAR function.
lines is the number of line terminators written to the file.
2)PUT procedure: The PUT procedure writes the text string stored in the buffer parameter to the open file identified by the file handle. The file must be opened by FOPEN/FOPEN_NCHAR function for write operation. The syntax is,
UTL_FILE.PUT (
file IN FILE_TYPE,
buffer IN VARCHAR2);
The maximum size of the buffer parameter is 32767 bytes. The default value is 1024 bytes.
Note that the sum of all sequential PUT calls cannot exceed 32767 without intermediate buffer flushes.
3)PUT_LINE procedure: The PUT_LINE procedure writes the text string stored in the buffer parameter to the open file identified by the file handle. This procedure terminates the line with the line terminator. The syntax to use of this procedure is,
UTL_FILE.PUT_LINE (
file IN FILE_TYPE,
buffer IN VARCHAR2,
autoflush IN BOOLEAN DEFAULT FALSE);
file and buffer is same as PUT procedure. Autoflash determines whether to flush to disk after write operation.
4)PUT_LINE_NCHAR procedure: The PUT_LINE_NCHAR procedure is used to write in unicode instead of database character set text string into text file. The syntax of this procedure is,
UTL_FILE.PUT_LINE_NCHAR (
file IN FILE_TYPE,
buffer IN NVARCHAR2);
5)PUT_NCHAR procedure: The PUT_NCHAR is used to write in unicode instead of database character set text string into text file. The syntax for using this procedure is,
UTL_FILE.PUT_NCHAR (
file IN FILE_TYPE,
buffer IN NVARCHAR2);
6)PUTF procedure: The PUTF procedure is like PUT procedure but while writing to file you can format string with the PUTF procedure. The syntax is,
UTL_FILE.PUTF (
file IN FILE_TYPE,
format IN VARCHAR2,
[arg1 IN VARCHAR2 DEFAULT NULL,
arg2 IN VARCHAR2 DEFAULT NULL
arg3 IN VARCHAR2 DEFAULT NULL
arg4 IN VARCHAR2 DEFAULT NULL
arg5 IN VARCHAR2 DEFAULT NULL]);
The Format parameter can contain text as well as the formatting characters \n and %s.
The \n is the line terminator.
The %s is the substitute with the string value of the next argument in the argument list.
7)PUTF_NCHAR procedure: The PUTF_NCHAR procedure is like PUT_NCHAR procedure but while writing to file you can format string with the PUTF_NCHAR procedure. The syntax is,
UTL_FILE.PUTF_NCHAR (
file IN FILE_TYPE,
format IN NVARCHAR2,
[arg1 IN NVARCHAR2 DEFAULT NULL,
. . .
arg5 IN NVARCHAR2 DEFAULT NULL]);
8)PUT_RAW function: The PUT_RAW function accepts as input a RAW data value and writes the value to the output buffer. The syntax of this function is,
UTL_FILE.PUT_RAW (
fid IN utl_file.file_type,
r IN RAW,
autoflush IN BOOLEAN DEFAULT FALSE);
Example with these functions and procedures
1)NEW_LINE procedure: The NEW_LINE procedure writes one or more new line terminator to the file. The syntax to use this procedure is,
UTL_FILE.NEW_LINE (
file IN FILE_TYPE,
lines IN NATURAL := 1);
file is the name of the file handle that is open by FOPEN/FOPEN_NCHAR function.
lines is the number of line terminators written to the file.
2)PUT procedure: The PUT procedure writes the text string stored in the buffer parameter to the open file identified by the file handle. The file must be opened by FOPEN/FOPEN_NCHAR function for write operation. The syntax is,
UTL_FILE.PUT (
file IN FILE_TYPE,
buffer IN VARCHAR2);
The maximum size of the buffer parameter is 32767 bytes. The default value is 1024 bytes.
Note that the sum of all sequential PUT calls cannot exceed 32767 without intermediate buffer flushes.
3)PUT_LINE procedure: The PUT_LINE procedure writes the text string stored in the buffer parameter to the open file identified by the file handle. This procedure terminates the line with the line terminator. The syntax to use of this procedure is,
UTL_FILE.PUT_LINE (
file IN FILE_TYPE,
buffer IN VARCHAR2,
autoflush IN BOOLEAN DEFAULT FALSE);
file and buffer is same as PUT procedure. Autoflash determines whether to flush to disk after write operation.
4)PUT_LINE_NCHAR procedure: The PUT_LINE_NCHAR procedure is used to write in unicode instead of database character set text string into text file. The syntax of this procedure is,
UTL_FILE.PUT_LINE_NCHAR (
file IN FILE_TYPE,
buffer IN NVARCHAR2);
5)PUT_NCHAR procedure: The PUT_NCHAR is used to write in unicode instead of database character set text string into text file. The syntax for using this procedure is,
UTL_FILE.PUT_NCHAR (
file IN FILE_TYPE,
buffer IN NVARCHAR2);
6)PUTF procedure: The PUTF procedure is like PUT procedure but while writing to file you can format string with the PUTF procedure. The syntax is,
UTL_FILE.PUTF (
file IN FILE_TYPE,
format IN VARCHAR2,
[arg1 IN VARCHAR2 DEFAULT NULL,
arg2 IN VARCHAR2 DEFAULT NULL
arg3 IN VARCHAR2 DEFAULT NULL
arg4 IN VARCHAR2 DEFAULT NULL
arg5 IN VARCHAR2 DEFAULT NULL]);
The Format parameter can contain text as well as the formatting characters \n and %s.
The \n is the line terminator.
The %s is the substitute with the string value of the next argument in the argument list.
7)PUTF_NCHAR procedure: The PUTF_NCHAR procedure is like PUT_NCHAR procedure but while writing to file you can format string with the PUTF_NCHAR procedure. The syntax is,
UTL_FILE.PUTF_NCHAR (
file IN FILE_TYPE,
format IN NVARCHAR2,
[arg1 IN NVARCHAR2 DEFAULT NULL,
. . .
arg5 IN NVARCHAR2 DEFAULT NULL]);
8)PUT_RAW function: The PUT_RAW function accepts as input a RAW data value and writes the value to the output buffer. The syntax of this function is,
UTL_FILE.PUT_RAW (
fid IN utl_file.file_type,
r IN RAW,
autoflush IN BOOLEAN DEFAULT FALSE);
Example with these functions and procedures
| Reactions: |
Subscribe to:
Posts (Atom)
Tag Cloud
10.2g
10g
11g
11gR2
Abasa
About Oracle
Administration
Adsense
Alerts
Archival
ASM
ASP.Net
Audit
Audit Vault
Backup
Bangladesh
Block Corruption
Blogger
Browser
Bug
Business
Clone
Clusterware
Comments
Concepts
Connection
Controlfiles
Crime
CSS
Data Block
Data Dictionary
Data Guard
Data Mining
Data Pump
Data Type
Database Administration
Database Vault
DBConsole
Developer
Economics
EM
Excel
Exercise
Explain plan
Export
External Table
Facebook
Firefox
Firmware
Flashback
Forum
Functions
Games
Globalization Support
Grid Control
Hardware
History
HTML
IE
Import
Indexes
initializaion parameter
initialization parameter
Installation
Internals
Internet
Interview
isql*plus
Java
JavaScript
Job
Joins
Joke
Limitation
Linux
Listener
Logminer
Magento
Mail
Materialized View
Medical
Memory
Mobile
Money
Multimedia
MySQL
Net Services
Network
OCP
Operators
Oracle
Oracle Concepts
Oracle Recovery
OS
Others
OUI
Package
Packages
Parameters
Partitioning
Patchset
Performance
Perl
Pfile
Photos
PHP
PL/SQL
Profile
Pseudocolumns
Puzzle
Quiz
Quota
RAC
RAC Installation
Recovery
Recovery Problems
Redo Log
Reports
RMAN
Scripts
Security
SEO
Server Administration
SGA
Shell Script
Smarty
Social Marketing
Solaris
Spfile
SQL
SQL Tuning
SQL*Loader
Sql*Plus
Startup Problem
Streams
SwingBench
System Analysis
Tablespaces
Technology
Temp
TNS Error
Tools
Troubleshooting
Tuning
Undo
UNIX
Upgradation
Utilities
Version
Views
Vmware
Windows
Wordpress
XML