oracle字符集深入研究(四)

2014-11-24 11:49:01 · 作者: · 浏览: 4
呢?oracle提供了一个工具,那就是csscan,可以通过它进行判定,如果存在导入数据时破坏了数据的一部分完整性,那么可以通过手动的方式对这些数据在进行整理调整。

eg:

平台A字符集为:WE8ISO8859P1需要将数据库全部导入到B库字符集为:US7ASCII,使用csscan工具进行校验:

首先创建用户和数据字典对象:

[oracle@tf lbuilder]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on  l  12  4 07:45:04 2013

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

SQL> @ /rdbms/admin/csminst.sql
grant READ on directory log_file_dir to system
                        *
ERROR at line 1:
ORA-22930: directory does not exist


grant READ on directory data_file_dir to system
                        *
ERROR at line 1:
ORA-22930: directory does not exist


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: root
old   1: create user csmig identified by &csmig_passwd
new   1: create user csmig identified by root

User created.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


Grant succeeded.


User altered.


0 rows created.


1 row updated.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


Table created.


Synonym dropped.


Synonym created.


Grant succeeded.


13 rows created.


View created.


Synonym dropped.


Synonym created.


View created.


Synonym dropped.


Synonym created.


View created.


Synonym dropped.


Synonym created.


View created.


Synonym dropped.


Synonym created.


View created.


Synonym dropped.


Synonym created.


View created.


Synonym dropped.


Synonym created.


View created.


View created.


Commit complete.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@tf lbuilder]$ 


之后使用csscan工具进行校验,如校验一张表在数据移动时是否存在问题。

[oracle@tf lbuilder]$ csscan system/root table=scott.emp fromchar=WE8ISO8859P1 tochar=US7ASCII log=verify.log array=1024000  process=10


Character Set Scanner v2.1 : Release 10.2.0.0.0 - Production on  l  12  4 07:48:57 2013

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 table to scan...

. process 1 scanning SCOTT.EMP[AAAMmGAAEAAAAAhAAA]

Creating Database Scan Summary Report...

Creating