Chinaunix首页 | 论坛 | 博客
  • 博客访问: 898200
  • 博文数量: 1812
  • 博客积分: 90800
  • 博客等级: 元帅
  • 技术积分: 22390
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-03 18:35
文章分类

全部博文(1812)

文章存档

2008年(1812)

我的朋友

分类:

2008-05-03 18:39:30

一起学习 见到有人问关于中文表名的导入导出问题,随手作了一个实验。
其实我从不推荐使用中文表名,因为可能在导入导出、字符集设置、应用显示等方面存在问题,要想正确解决面对的所有问题,必然需要对Oracle相关知识具有相当的了解,否则只是徒增困扰而已。

这个实验之前,只是见过别人使用中文表名、字段名等,自己却是第一次尝试,万事都有第一次么。
1.用中文名建立一个测试表
SQL> create table 测试 as select username from dba_users;



Table created.



Elapsed: 00:00:00.08

SQL> select * from 测试;



USERNAME

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

SYS

SYSTEM

OUTLN

EYGLE

CSMIG

TEST

REPADMIN

SCOTT

...

DBSNMP

WMSYS



13 rows selected.



Elapsed: 00:00:00.00


2.exp导出数据
导出的时候需要注意客户端的字符集设置
[oracle@jumper oracle]$ exp eygle/eygle file=a.dmp          



Export: Release 9.2.0.4.0 - Production on Tue Oct 18 10:58:24 2005



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





Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production

Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set



About to export specified users ...

. exporting pre-schema procedural objects and actions

. exporting foreign function library names for user EYGLE 

. exporting PUBLIC type synonyms

. exporting private type synonyms

. exporting object type definitions for user EYGLE 

About to export EYGLE's objects ...

. exporting database links

. exporting sequence numbers

. exporting cluster definitions

. about to export EYGLE's tables via Conventional Path ...

. . exporting table                     PLAN_TABLE          0 rows exported

. . exporting table                             T1          5 rows exported

. . exporting table                             T2         13 rows exported

. . exporting table                           测试         13 rows exported

. ...

Export terminated successfully without warnings.


3.drop掉测试表
SQL> drop table 测试

  2  /



Table dropped.



Elapsed: 00:00:00.36


4.imp导出数据
[oracle@jumper oracle]$ imp eygle/eygle file=a.dmp tables=测试



Import: Release 9.2.0.4.0 - Production on Tue Oct 18 10:59:03 2005



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





Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production



Export file created by EXPORT:V09.02.00 via conventional path

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set

. importing EYGLE's objects into EYGLE

. . importing table                         "测试"         13 rows imported

Import terminated successfully without warnings.


5.验证数据无误
SQL> select * from 测试; 



USERNAME

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

SYS

SYSTEM

OUTLN

EYGLE

CSMIG

TEST

...

WMSYS



13 rows selected.



Elapsed: 00:00:00.01

SQL> 


那么看来只要设置正确,也没有什么问题。
查看本文来源
见到有人问关于中文表名的导入导出问题,随手作了一个实验。
其实我从不推荐使用中文表名,因为可能在导入导出、字符集设置、应用显示等方面存在问题,要想正确解决面对的所有问题,必然需要对Oracle相关知识具有相当的了解,否则只是徒增困扰而已。

这个实验之前,只是见过别人使用中文表名、字段名等,自己却是第一次尝试,万事都有第一次么。
1.用中文名建立一个测试表
SQL> create table 测试 as select username from dba_users;



Table created.



Elapsed: 00:00:00.08

SQL> select * from 测试;



USERNAME

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

SYS

SYSTEM

OUTLN

EYGLE

CSMIG

TEST

REPADMIN

SCOTT

...

DBSNMP

WMSYS



13 rows selected.



Elapsed: 00:00:00.00


2.exp导出数据
导出的时候需要注意客户端的字符集设置
[oracle@jumper oracle]$ exp eygle/eygle file=a.dmp          



Export: Release 9.2.0.4.0 - Production on Tue Oct 18 10:58:24 2005



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





Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production

Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set



About to export specified users ...

. exporting pre-schema procedural objects and actions

. exporting foreign function library names for user EYGLE 

. exporting PUBLIC type synonyms

. exporting private type synonyms

. exporting object type definitions for user EYGLE 

About to export EYGLE's objects ...

. exporting database links

. exporting sequence numbers

. exporting cluster definitions

. about to export EYGLE's tables via Conventional Path ...

. . exporting table                     PLAN_TABLE          0 rows exported

. . exporting table                             T1          5 rows exported

. . exporting table                             T2         13 rows exported

. . exporting table                           测试         13 rows exported

. ...

Export terminated successfully without warnings.


3.drop掉测试表
SQL> drop table 测试

  2  /



Table dropped.



Elapsed: 00:00:00.36


4.imp导出数据
[oracle@jumper oracle]$ imp eygle/eygle file=a.dmp tables=测试



Import: Release 9.2.0.4.0 - Production on Tue Oct 18 10:59:03 2005



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





Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production



Export file created by EXPORT:V09.02.00 via conventional path

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set

. importing EYGLE's objects into EYGLE

. . importing table                         "测试"         13 rows imported

Import terminated successfully without warnings.


5.验证数据无误
SQL> select * from 测试; 



USERNAME

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

SYS

SYSTEM

OUTLN

EYGLE

CSMIG

TEST

...

WMSYS



13 rows selected.



Elapsed: 00:00:00.01

SQL> 


那么看来只要设置正确,也没有什么问题。
查看本文来源
一起学习 中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集中文表名-导入导出-字符集
阅读(191) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~