使用oracle自带工具DMU 更改数据库字符集

环境要求:jdk版本不低于1.5

1.安装dmu工具

上传dmu-2.0.zip

liunx 下执行dmu.sh即可

如果在执行过程中,需要退出所有的会话,或者启动到受限模式

startup restrict

 

因为文件较大,不允许直接上传,

dmu下载链接 如下:http://down.51cto.com/data/1865423


2.登录数据库,在sys用户下执行

@$ORACLE_HOME/rdbms/admin/prvtdumi.plb

 

3.如果数据库中有中文命令的表名,那么在检查时 数据字典会出现错误。

obj$,wri$_adv_objects

其中如果obj$无法通过,可以在中文的表名purge删除即可。

如果 wri$_adv_objects  无法通过,可以直接delete

delete from  wri$_adv_objects  where ATTR2='增值发票基本费表';

 

4.根据图形界面向导走完后,重启数据库即可, 数据库字符集将会自动变更。

 

注意:此工具只能讲数据更改成AL32UTF8 或者UTF8. 其中AL32UTF8 oracle 推荐使用的字符集。

 

--------官方文档安装步骤--------------------

oracle Database Migration Assistant for Unicode:

Getting Started

Updated: July 2014

 

 

To start working with the Oracle Database Migration Assistant for Unicode (DMU), please follow these steps:

 

1. Learn about the DMU

 

To learn about the basic features of the tool, read the DMU Data Sheet. For more in-depth information, see the user's guide in the DMU Documentation Library. Check also the Frequently Asked Questions.

 

2. Check if your database and operating system platform are supported

 

Go to Supported Configurations and check if the current DMU release is supported with your database release and platform.

 

To avoid network overhead, Oracle recommends that you run the DMU on the machine that hosts the database to be migrated. If this recommendation is in conflict with what platforms are supported, make sure that the DMU host is connected to the database host with a fast LAN.

 

3. Check for additional restrictions in Release Notes

 

Refer to DMU Release Notes for any additional restrictions on databases to be migrated.

 

4. Download and install the appropriate database patch

 

If the page Supported Configurations shows that a patch is required for your database, go to My Oracle Support website and download the patch. Alternatively, click on the direct link below:

 

Patch #9825461

You will need to log in with your My Oracle Support account credentials that give you access to database patches. Select the patch corresponding to your database release and platform.

 

Follow the instructions in the patch installation README to install the patch.

 

5. Install the required PL/SQL package in the database

 

The interface between the DMU client and the DMU functionality in the database kernel is the PL/SQL package SYS.DBMS_DUMA_INTERNAL. This package is not installed by default. After any required database patches have been installed, start an SQL*Plus session in the Oracle Home of your database, log in with SYSDBA credentials, and run the script ?/rdbms/admin/prvtdumi.plb:

 

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 17 08:04:48 2011

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production

With the Partitioning, Oracle Label Security, OLAP, Data Mining

and Real Application Testing options

 

SQL>@?/rdbms/admin/prvtdumi.plb

 

Library created.

 

 

Package created.

 

No errors.

 

Package body created.

 

No errors.

SQL>

               

6. Download and install JDK6 or JDK7

 

The DMU requires Java SE Development Kit in version 6 or 7. If you do not have JDK6 or JDK7 installed on the host machine on which you want to run the DMU, download the JDK from here (click the JDK "Download" button) or ask your hardware vendor about JDK availability for your platform. Match the architecture of your platform (32-bit vs. 64-bit) with the architecture of the JDK. Follow the installation instructions in the accompanying documentation. Write down the directory into which you have installed the JDK as later you will need to provide the DMU with the path to the Java Runtime executable java or java.exe.

 

7. Download and install the DMU software

 

The DMU is available from its OTN download page. It is also available from My Oracle Support (MOS) as Patch #18392374. Both download packages are identical but they are covered by different licenses. The OTN download is covered by the standard OTN Developer License, which only entitles you to evaluate the product. The MOS download is covered by your database license and your database support contract, which give you the right to use the tool to migrate production databases. To download the software from MOS, click on the patch number above and log in with MOS credentials associated with a valid support identifier for an Oracle Database support contract.

 

To install the DMU, extract the downloaded archive into any target folder/directory using an un-ZIP utility for your platform. Make sure the utility retains the subdirectory structure from the archive. The extraction target folder/directory is referenced as the DMU installation folder/directory in this document.

 

Note: For security reasons, make sure the extracted files are writable only by those operating system users with access to the DMU host who are authorized to run the DMU against all relevant databases. Otherwise, malicious users could modify the DMU files to make the DMU execute arbitrary SQL statements when it is later started by a privileged user and connects to a database as SYSDBA.

 

8. Start the tool

 

To start the DMU:

 

If on Microsoft Windows:

 

Within the DMU installation folder, open the folder dmu\

To start the DMU, double-click dmuW32.exe (on Windows 32-bit) or dmuW64.exe (on Windows 64-bit)

To start the DMU with a Java runtime output (console) window, which may contain debugging messages for troubleshooting purposes, double-click dmu32.exe or dmu64.exe correspondingly instead

For your convenience, create a shortcut to dmuW32.exe (dmuW64.exe) and place it on your desktop or in the Quick Launch area of the Windows taskbar

If on a Unix-based operating system:

 

Within the DMU installation directory, go to the sub-directory dmu/

Set the execution bit of the script dmu.sh by running:

 

$ chmod u+x dmu.sh

 

Make sure the /bin/bash shell is available and run:

 

$ ./dmu.sh

 

If your window manager allows it, create a shortcut to run the application by simply clicking on an icon

When started for the first time, the DMU asks for the path to the JDK installation directory. Enter the correct path. On Windows, you can also click the Browse button in the provided dialog box and select the java.exe executable in the JDK bin sub-folder. Make sure to choose the JDK with the right architecture (32-bit vs. 64-bit).

 

The provided path is saved so that you do not have to reenter it the next time you start the DMU. If you select a wrong path and you want the DMU to ask for it again, exit the DMU and do one of the following: (i) on Microsoft Windows, locate the file dmu\dmu\bin\dmu32.conf (or dmu\dmu\bin\dmu64.conf, correspondingly) in the DMU installation folder, remove the line starting with SetJavaHome and save the file, or (ii) on a Unix-based operating system, remove the file $HOME/.dmu_jdk. Now, when you start the DMU, it will ask for the path again.

 

9. Create a database connection

 

Before you can connect to a target database to start its migration process, you need to define a connection by providing the name of a database administrative user, its password, and the network connection data: the target database host name, the TNS listener port, and the database service name. The specified user must have the SYSDBA privilege in the database. Refer to the DMU guide for more details.

 

10. Install the DMU repository

 

When you connect for the first time to a database, you will be prompted to install a DMU migration repository. Install the repository as described in the DMU guide. The DMU does not function without a repository.

 

11. Start the migration process

 

Now, you are ready to begin the migration process to Unicode, as described in the DMU documentation. You will scan the database to identify convertibility issues, cleanse the database from these issues, and run the actual conversion step.

 

12. Start the validation process

 

If your database is already in a Unicode character set, you can use the DMU to validate that the database contents is really in the declared character set. Regular checks may help you spot any application or ETL configuration issues quickly, preventing illegal data to build up in the database. See the DMU guide for more details.

 

---------------------------------------------------------------------

备注:

 

错误一、

Error: /bin/java not found

Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.dmu_jdk

解决方法:

root@soshare-db ~]# whereis java

java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java

[root@soshare-db ~]# ln -s /usr/bin/java /bin/java

 

错误二、

[oracle@soshare-db dmu]$ ./dmu.sh

 

   Database Migration Assistant for Unicode

 Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.

 

Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.dmu_jdk

 

Error: Java home /bin/java is not a J2SE SDK.

Running DMU under a JRE is not supported.

 

If the Java VM specified by the SetJavaHome is actually a full J2SDK installation

then add 'SetSkipJ2SDKCheck true' to /home/oracle/dmu/dmu/bin/dmu.conf

解决方法:

/home/oracle/dmu/dmu/bin/dmu.conf 文件末尾添加“SetSkipJ2SDKCheck true

 

错误三。

Exception in thread "main" java.lang.NoClassDefFoundError: oracle/ide/boot/Launc

her

Caused by: java.lang.ClassNotFoundException: oracle.ide.boot.Launcher

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

Could not find the main class: oracle.ide.boot.Launcher. Program will exit.

 

解决方法:

升级jdk版本,jdk应不低于1.5


 


本文出自 “狂奔的蜗牛” 博客,谢绝转载!

你可能感兴趣的:(oracle,AL32UTF8,更改字符集,dmu)