`
teamojiao
  • 浏览: 350440 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

oracle修改字符集的小工具csscan

阅读更多

oracle提供了csscan工具用来修改字符集,csscan(Database Character Set Scanner)也可以单独的扫描某些表某些列能否进行字符集转换,并且能够并行扫描以加快扫描速度。

1.首先以sys用户身份创建用户(CSMIG)和相应的数据字典视图

SQL> conn /as sysdba
Connected.
SQL> @?/rdbms/admin/csminst.sql

User created.


Grant succeeded.


Grant succeeded.


Grant succeeded.


User altered.


1 row created.


1 row updated.

Connected.

......

Commit complete.

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
$

建立用户scott和demo表用来做测试,数据量小点,速度快些。

SQL> conn /as sysdba
Connected.
SQL> grant connect,resource to scott identified by tiger;

Grant succeeded.

SQL> conn scott/tiger
Connected.
SQL> @?/sqlplus/demo/demobld.sql
Building demonstration tables. Please wait.
Demonstration table build is complete.
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
$

2.脚本执行完成之后,执行csscan符集扫描工具,并查看输出报告

$ csscan system/manager


Character Set Scanner v1.1 : Release 9.2.0.1.0 - Production on Tue May 27 10:51:57 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production

(1)Full database, (2)User, (3)Table: 1 > 2

Current database character set is WE8ISO8859P1.

Enter new database character set name: > WE8ISO8859P1

Enter array fetch buffer size: 10240 > 1024000

Enter number of scan processes to utilize(1..32): 1 > 2

Enter user name to scan: > scott

Enumerating tables to scan... --开始扫描,如果数据量大,会很慢

. process 1 scanning SCOTT.EMP[AAAi+sAABAAALKZAAA]
. process 1 scanning SCOTT.DEPT[AAAi+tAABAAALKpAAA]
. process 1 scanning SCOTT.BONUS[AAAi+uAABAAALK5AAA]

Creating Database Scan Summary Report...

Creating Individual Exception Report...

Scanner terminated successfully.
$
$ ls -otr scan*
-rw-r--r--   1 oracle      5803 May 27 11:06 scan.txt
-rw-r--r--   1 oracle       869 May 27 11:06 scan.out
-rw-r--r--   1 oracle      1117 May 27 11:06 scan.err
$
$ more scan.err
Database Scan Individual Exception Report


[Database Scan Parameters]

Parameter                      Value                                          
------------------------------ ------------------------------------------------
Scan type                      User tables                                    
User name                      scott                                          
Scan CHAR data?                YES                                            
Current database character set WE8ISO8859P1                                   
New database character set     WE8ISO8859P1                                   
Scan NCHAR data?               NO                                             
Array fetch buffer size        1024000                                        
Number of processes            2                                              
Capture convertible data?      NO                                             
------------------------------ ------------------------------------------------

[Data Dictionary individual exceptions]


[Application data individual exceptions]

$
$ more scan.txt
Database Scan Summary Report

Time Started : 2008-05-27 11:06:02
Time Completed: 2008-05-27 11:06:06

Process ID         Time Started       Time Completed
---------- -------------------- --------------------
         1 2008-05-27 11:06:06 2008-05-27 11:06:06
---------- -------------------- --------------------

[Database Size]

Tablespace                            Used(MB)        Free(MB)       Total(MB)
------------------------------ --------------- --------------- ---------------
SYSTEM                                 346.000          54.000         400.000
TOOLS                                  112.000           5.000         117.000
......

3.最后看看它的帮助说明

$ csscan -help


Character Set Scanner v1.1 : Release 9.2.0.1.0 - Production on Tue May 27 11:10:00 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


You can let Scanner prompt you for parameters by entering the CSSCAN     
command followed by your username/password:                              
                                                                         
Example: CSSCAN SYSTEM/MANAGER                                         
                                                                         
Or, you can control how Scanner runs by entering the CSSCAN command      
followed by various parameters. To specify parameters, you use keywords:
                                                                         
Example: CSSCAN SYSTEM/MANAGER FULL=y TOCHAR=utf8 ARRAY=102400 PROCESS=3
                                                                         
Keyword    Default Prompt Description                                    
---------- ------- ------ -------------------------------------------------
USERID             yes    username/password                              
FULL       N       yes    scan entire database                           
USER               yes    user name of the table to scan                 
TABLE              yes    list of tables to scan                         
EXCLUDE                   list of tables to exclude from scan            
TOCHAR             yes    new database character set name                
FROMCHAR                  current database character set name            
TONCHAR                   new NCHAR character set name                   
FROMNCHAR                 current NCHAR character set name               
ARRAY      10240   yes    size of array fetch buffer                     
PROCESS    1       yes    number of scan process                         
MAXBLOCKS                 split table if larger than MAXBLOCKS           
CAPTURE    N              capture convertible data                       
SUPPRESS                  suppress error log by N per table              
FEEDBACK                  feedback progress every N rows                 
BOUNDARIES                list of column size boundaries for summary report
LASTRPT    N              generate report of the last database scan      
LOG        scan           base name of log files                         
PARFILE                   parameter file name                            
PRESERVE   N              preserve existing scan results                 
HELP       N              show help screen (this screen)                 
---------- ------- ------ -------------------------------------------------
Scanner terminated successfully.
$

--End--

分享到:
评论

相关推荐

    Oracle字符集扫描工具使用简介.pdf

    Oracle字符集扫描工具是Oracle数据库管理系统提供的一种实用工具,用于检查和评估字符数据在不同字符集之间的转换过程。字符集是Oracle数据库支持多种语言的基础,它定义了如何存储和显示字符。在实际操作中,当需要...

    如何更改Oracle字符集.doc

    Oracle字符集的更改是一个复杂的过程,涉及到数据库的底层结构和数据的编码方式。在Oracle数据库中,字符集用于定义字符的表示方式,不同的字符集对不同语言的支持程度和存储效率也不同。在本文中,我们将讨论如何...

    如何更改Oracle字符集[借鉴].pdf

    Oracle字符集更改是一个复杂的过程,尤其涉及到从超集字符集如UTF8转换为子集字符集如ZHS16GBK。在本文中,我们将探讨如何处理这个问题,以及更改字符集可能涉及的风险和步骤。 首先,Oracle数据库的字符集选择在...

    Oracle CSscan install guide

    CSscan(Character Set Scanner)是一款由Oracle提供的工具,主要用于检查数据库字符集设置的影响或帮助用户纠正不正确的`NLS_CHARACTERSET`配置。通过CSscan,用户可以更深入地了解数据库字符集更改对现有数据可能...

    CSscan summary

    CSscan(Character Set Scanner)是一款由Oracle提供的工具,用于分析数据库中的字符集兼容性问题。它可以帮助用户识别数据库中的数据是否与目标字符集兼容,从而为数据库字符集转换提供必要的信息。 #### 二、...

    csscan_12_linux_920.tar.Z

    Oracle9i 9.2.0 Character set scanner for Linux 应用Linux系统

    Oracle数据库10g支持全球化特性的平台Powe.pptx

    Oracle数据库10g在全球化特性方面的支持主要体现在对多种语言、字符集和文化习惯的兼容性,以及为开发者提供的便捷工具。Oracle致力于提供一个全面的全球化解决方案,使得用户可以使用本地语言存储、处理和检索信息...

    Oracle数据库10g-支持全球化特性的平台-Powe.pptx

    语言和字符集检测工具LCSSCAN和CSSCAN用于分析文本,但其准确性受文本纯度影响,如单一语言的书面文本检测效果更佳。 GDK是Oracle为中间层提供的全球化开发框架,简化了全球化的Java中间层应用程序的开发。它隐藏了...

Global site tag (gtag.js) - Google Analytics