Character Set Migration Using CSSCAN and CSALTER
Character Set Migration Using CSSCAN and CSALTER
and CSALTER
Note. This functionality has been superseded by the Database Migration Assistant for
Unicode (DMU) described here. Although the article is based around Oracle 12c, the
DMU supports previous versions also.
This article presents a simple example of migrating the default character set of a database
using the CSSCAN and CSALTER character set scanner utilities provided by Oracle.
The basic steps involved in character set conversion are listed below.
Backup
CLUSTER_DATABASE=FALSE (*RAC Only*)
SHUTDOWN IMMEDIATE
STARTUP
CSSCAN
SHUTDOWN IMMEDIATE
STARTUP RESTRICT
CSALTER
CLUSTER_DATABASE=TRUE (*RAC Only*)
SHUTDOWN IMMEDIATE
STARTUP
Performing a backup before starting the character set conversion is very important. If the
conversion fails part way through, you must restore from a backup before re-attempting
the conversion.
With the backup complete, the instance must be restarted. In the case of RAC databases,
the CLUSTER_DATABASE parameter should be set to FALSE, then all RAC instances
stoped and only one restarted.
ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=SPFILE; -- RAC Only
SHUTDOWN IMMEDIATE;
STARTUP;
Once the database is open, the CSSCAN utility is run. This example command below
would perform a scan of the whole database.
CSSCAN "sys/password@db10g AS SYSDBA" FULL=Y
If the character set migration utility schema is not installed on your database, you will get
the following error.
C:\>CSSCAN "sys/password@db10g AS SYSDBA" FULL=Y
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
CSS-00107: Character set migration utility schema not installed
Scanner terminated unsuccessfully.
C:\>
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Current database character set is WE8MSWIN1252.
Enter new database character set name: > WE8ISO8859P15
Enter array fetch buffer size: 1024000 >
Enter number of scan processes to utilize(1..32): 1 > 32
Enumerating tables to scan...
.
.
.
.
.
.
C:\>
Once the scan has completed successfully, the database should be opened in restricted
mode so you can run the "$ORACLE_HOME/rdbms/admin/csalter.plb" script as the SYS
user. The example below shows a successful conversion.
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP RESTRICT
ORACLE instance started.
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted.
Database opened.
SQL> @@csalter.plb
289406976
1248600
83886760
201326592
2945024
bytes
bytes
bytes
bytes
bytes
0 rows created.
Function created.
Function created.
Procedure created.
This script will update the content of the Oracle Data Dictionary.
Please ensure you have a full backup before initiating this procedure.
Would you like to proceed (Y/N)?Y
old
6:
if (UPPER('&conf') <> 'Y') then
new
6:
if (UPPER('Y') <> 'Y') then
Checking data validility...
begin converting system objects
PL/SQL procedure successfully completed.
Alter the database character set...
CSALTER operation completed, please restart database
PL/SQL procedure successfully completed.
0 rows deleted.
Function dropped.
Function dropped.
Procedure dropped.
SQL>
If there are possible conversion problems, the process will report the problem and clean
itself up without performing the conversion. Here are a couple of the messages I got
when trying this process.
# When I tried to convert WE8MSWIN1252 -> AL32UTF8.
Checking data validility...
Unrecognized convertible date found in scanner result
# When I tried to run the CSALTER script without a SHUTDOWN-STARTUP
RESTRICT.
Checking data validility...
Sorry only one session is allowed to run this script
Once the conversion is complete, you must restart the instance. In the case of RAC
databases, the CLUSTER_DATABASE parameter should be set back to TRUE.
ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE; -- RAC Only
SHUTDOWN IMMEDIATE;
STARTUP;