I am having issues with a numeric format on my db.
I checked the NSL_Parameters and there is a difference between the database ones and session ones.
Can someone explain me if on this case, the queries will have the session format or the database one?
Your queries will always use the session NLS_Parameters. Actually most of all NLS_Parameters on database are only used to define the default session parameters if they are not set.
I think NLS_CHARACTERSET is the only NLS_Parameter which is relevant only on database level and cannot be changed on session level.
Related
The current encoding of oracle instance is WE8ISO8859P1 and needs to be moved to UTF-8. I have found some challenges in my database instance due to its current setup and requirements of my business.
This instance in question has 100+ schema users with number of tables created under each schema. We can say logically each schema exists for application or specific system within the enterprise. The requirement is to move only certain schema and their table objects to new character set of UTF-8.
Also, remember the reason for this migration right now is compliance with Restful POST calls that will perform CRUD operations in UTF format.
NLS_NCHAR_CHARACTERSET- AL16UTF16
NLS_CHARACTERSET- WE8ISO8859P1
I did do some research earlier and here are my findings.
• Oracle doesn’t support character encoding at the tablespace , table or column level. Therefore options start reducing for any charset migration strategy at schema level only.
• We have CRUD calls by other enterprise legacy systems to this schema. Therefore should not have a any wider impact. Off course, other schema's in this instance doesn't have any requirements of UTF-8.
The only way I see a solution is
OPTION 1 - Move the target schema and thier objects into new database instance with NLS_LANGUAGE to be UTF-8.
OPTION 2 - Converting all the relevant columns to NCHAR and NVARCHAR but with loss of length and truncation.
Both the approaches lead to big impact and not able to conclude what is best. Any suggestions are welcome that solves my charset migration without impact and changes to other schema in the instance.
I'm using Oracle Database 12c on RHEL System, and I wanna to set the parameters NLS_CHARACTERSET=AL32UTF8 and NLS_NCHAR_CHARACTERSET=AL16UTF16 by default for all created databases with sql create statement to avoid to add them every time when I issue the create query.
I have tried to add these parameters to initSID.ora but it seems they are not valid as initialization parameters.
Thanks.
I'm trying to figure out where our project went wrong.
A long time ago, our database administrator created a user and a schema for the project we were working on.
We gave that user to a contractor who created the tables and installed the application.
Today I discovered that our database doesn't support UTF-8 characters and we need it to.
select value from nls_database_parameters
where parameter='NLS_CHARACTERSET'
The result is : WE8ISO8859P1
My question is, was the mistake made when the user was created, or was the mistake done by the contractor who created the tables?
Thanks
The character set is an attribute of the database. So whoever created the database presumably chose the wrong character set. There are no character set related settings when you create a user or create a table (other than determining whether to use the database character set (CHAR/ VARCHAR2) or the national character set (NCHAR/ NVARCHAR2) data types).
Changing the character set of an existing database may take a bit of effort. The Globalization Guide has a section on character set migration. Depending on the Oracle version (the procedure is different in 10g and 11g) and what data already exists, doing an export & import to a new database may be the easiest option.
I should add that the order of operations you specified in your post doesn't make sense. The database has to be created before the user or the schema can be created. So it doesn't make sense that the DBA could have created the user and the schema a long time ago and the contractor created the database more recently. Are you possibly using the terms "database" and "schema" in a non-Oracle context?
I have Oracle database with following settings
NLS_CHARACTERSET EE8MSWIN1250
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_LANGUAGE AMERICAN
I've created test table with one column of type NVARCHAR2, where I'm going to store cyrillic.
I use SQL Developer to connect DB.
The problem is when I put a cyrillic chain into DB using SQL Developer cell, the data is stored correctly. But when I use INSERT query with the same data using N'' or not the data is stored as question marks.
Interesting thing is that query generated by SQL Developer, and written by me is identical.
I solved this problem by changing NLS_CHARACTERSET to UTF8, but on production server I can't do such a thing.
IMO it must be some way to store cyrillic into that DB in proper way using query if SQL Developer can do that.
Regards
Depending on the ODBC/JDBC in use, localization settings on your computer may override any config values in the database. Try using ALTER SESSION and set the proper NLS parameters before executing your query, and see if that helps. SQL developer might do this behind the scenes when you edit the data cell.
The database user has got two schemas. I need to read the data from a specific schema using ado.net. I am using OleDbConnection object to create the connection to database. Appreciate your answers.
Use SCHEMA_NAME.TABLE_NAME in your queries.
If you don't specify a schema, Oracle will look into the current schema. The schema is by default the connexion user (so if you connect with USER1 and query TABLE1, Oracle will look for the table USER1.TABLE1). You can change your current schema at any time during a session with:
ALTER SESSION SET CURRENT_SCHEMA=SCHEMA2;
You can also use synonyms to point to the correct table.