Switching empty Oracle 12c database to Unicode - oracle

I have Oracle 12c installed in a Ubuntu Linux development environment with NLS_CHARACTERSET = WE8MSWIN1252. I want to import a database using data pump that has AL32UTF8 encoding. Is there a convenient way (other than reinstalling Oracle) to either switch my Oracle to Unicode entirely (no need to worry about preserving existing data), or to somehow "locally" use Unicode encoding for the schemas that I import?

For converting a database to AL32UTF8 characterset, Oracle introduced the Database Migration Assistant for Unicode (DMU) in version 12.1.
It is "convenient" as it is a GUI based tool which guides you through all the steps, at the same time it can be called "complex" as it requires a separate repository.

Related

Migration from Windows Oracle 12c to Linux Oracle 18c

enter image description hereWe are migrating Oracle DB from 12c Windows Oracle to 18c Linux Oracle installation. Some of the columns (derived columns) in views has become unicode and not usable by downstream SSIS. Any reason why these views are giving error in SSIS? SSIS is complaining that in 18c columns have become unicode
12c View definition is
enter image description here
18 c View defintion
enter image description here
I think your problem matches this :
Oraoledb: Cannot Convert Between Unicode And Non-Unicode String Data Types (Doc ID 960508.1)
This is due to a difference in metadata reported by the OleDb provider depending upon whether NLS_LANG environment variable is set. Typically this behaviour would be observed when the SSIS package is developed in an environment that has NLS_LANG set, and then deployed to an environment that does not have it set. The difference in metadata results in the error, and is being investigated via Oracle bug number bug 7836009.
To resolve this issue, set NLS_LANG to the same setting as the box the package was developed on, which result in the same metadata being reported in both cases.The NLS_LANG environment variable should be set in the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_<homename>\NLS_LANG
Export the NLS_LANG variable in Linux with the same value as the original database
The behavior can also be worked around by refreshing the SSIS package after deployment, which will refresh the metadata.
Hope it helps.
Regards.

How to change (migrate) the character set of a root container database in a multi-tenant architecture?

I have at my disposition a multi-tenant database where both the root container database (referred to as CDB from now on) and the pluggable database (referred to as PDB from now on) have been installed with the WE8DEC character set (select value from nls_database_parameters where parameter='NLS_CHARACTERSET';).
The requirement would be that both (or at least the PDB, which I am actually using) use the AL32UTF8 character set. And installing a new database from scratch is not an option.
In 12.2 character set migration to unicode should be done with the DMU (Database Migration Assistant for Unicode) tool. However, in this particular setup this doesn't help me, because:
- DMU can only be used for PDB's
- and I cannot migrate to unicode a PDB whose CDB is not already in unicode
- but DMU cannot migrate the CDB to unicode
Therefore my question is:
How can I migrate the CDB from WE8DEC to AL32UTF8?
(According to my research, and export/import approach could perhaps come into discussion, but that involves installing from scratch a new database server with AL32UTF8 encoding. But as I said that's not an option in my specific case.)
Has anybody encountered this specific dilemma yet?
Thanks in advance for your answers.
Database Migration Assistant for Unicode (DMU) does not support migrating CDB root. The solution is to create a new CDB in AL32UTF8, move the PDB to it and then use DMU to migrate the PDB.

SSIS converts Varchar2 to DT_STR

We have an SSIS package downloading data from an Oracle database to an SQL Server datawarehouse. For this datawarehouse, several environments are set up; Development, Test and Production. Dev and test share a machine, Prod is stand-alone.
When the SSIS package is run on the PROD machine, it downloads the Varchar2 columns from our Oracle source database to MSSQL in DT_WSTR format and saves this to a NVarchar column. I.E. all steps involved support Unicode.
When this same package is run against the same source database on the DEV/Test box, it somehow sees the external columns as being Varchar, derives this to DT_STR in the data flow and refuses to store this in an NVarchar column.
All OS's are Win2K8r2, MSSQL 2008 64 bits. The package is run in 32bits mode, same behaviour is seen when run from BIDS or from SQL Agent.
Anyone care to guess why? I've already seen the suggestion to disable validating external metadata (https://stackoverflow.com/a/18383598/2903056), but that's not a practical suggestion for our situation.
An old question I know, but seems to still be relevant. And since I could not find a suitable answer in the last 3 months I have been searching, I figure now is as good a time as any to post my findings.
I have had the same curious behaviour and have finally been able to resolve it.
My layout looked like this:
Oracle 10g R2 database on Windows 2003 Server (lets call it ORA)
Dev machine with Windows 8, Visual Studio 2012 + SSDT, Sql Express 2012,
ODT 12.1.0.21 (lets call that DEV)
Sql Server 2012 on Windows 2012 Server, Oracle Client 11.2 (lets call that TEST)
Both DEV and TEST were connecting to ORA. DEV was reporting VARCHAR2 columns as DT_WSTR while TEST would insist that they are DT_STR.
I then installed ODT 12.1.0.21 on TEST and the problem was solved. Notably, I used the "machine wide" option during the install. I am not sure how much of an impact that had.
There seems to be a difference in the datatypes that are returned by the Oracle OleDb providers across the different versions of the client side components.
Check the value of the NLS_LANG in the registry.
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\KEY_<orahome> /f NLS_LANG
If it matches the server's character set, OraOLEDB will use regular (non-Unicode) datatype DBTYPE_STR, otherwise it uses Unicode-mode, datatype DBTYPE_WSTR.
If the NLS_LANG field is missing, it defaults to US7ASCII which almost certainly will not match your database and you will be using Unicode datatypes.
To get the server's characterset, do:
SELECT parameter, value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET';
Check Metadata validation property value if it true make it false

Change encoding (collation?) of SQL Server 2008 R2 to UTF-8

We'd like to move our Confluence system to a SQL Server 2008 R2. Now, since Confluence uses UTF-8 encoding, I'd need a database using the same encoding (I guess that's the collation?).
There's the command
alter database confluence set collation COLLATION_NAME
Now, as it seems, there is no utf-8, and as I found out SQL Server uses ucs-2 which is basically the same. But I can't figure out what the collation name of ucs-2 would be? Does somebody know about that?
Edit: I do see the difference between encoding and collation now. The Confluence documentation suggests that I should create an schema which relies on UCS-2 (because MS SQL has missing support for UTF-8). I have looked trough the Managment Studio and I found an entry for schemas in the Security directory of the database. However, I can not figure out how to assign UCS-2 encoding to the schema. What do I have to realize this in the Managment Studio to do so (or which query should I use)?
According to the confluence documentation you should set the collation to SQL_Latin1_General_CP1_CS_AS
We have followed this document and have had a successful confluence deployment on SQL Server 2008 R2:
Database Setup for SQL Server

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)?
Ates, try impdp - sometimes that could help :-)
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
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'
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)?
A: You 're right; You cannot import a dump file created with a given Oracle Client, since the Oracle Client of your Target Oracle Database is older.
Although it is not recommended, you can export a newer Source Oracle Database (i.e. 10g+) with an older Oracle Client (i.e. 10g), since you are using the same Oracle Client version to import into your older Target oracle Database (i.e. 10g).
Assumption: The Oracle Client version of your Source Database is the same -or newer- as your Target Oracle Database version. Note that mixing tools Datapump (11g) and imp (-10g) import utility does not work.
Interessant link Using Different Releases and Versions of Export
Maybe it was exported using expdp....try impdp ....that is what I saw when searching google, and truly it worked for me for this same issue.

Resources