三、用dblink在10G中做create table ..as select * from ..varchar2()的column宽度变成3倍
问题描述:例如:varchar2(255)==>varchar(765)
测试:1. 环境: 两台机器都装的10G的数据库
2. 测试步骤和结果:
SQL> conn test1/test1@db10G_server1
SQL> create database link link_server2
connect to test1 identified by test1
using 'db10G_server2'
SQL> conn test1/test1@db10G_server2
SQL> create table test1_t1 as select * from all_objects
where rownum<=3000;
SQL> desc test1_t1;
Name Null? Type
---------------------------------------------------------------
OWNER VARCHAR2(30)
OBJECT_NAME VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED DATE
LAST_DDL_TIME DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
SQL> conn test1/test1@db10G_server1
SQL> create table test1_linkt1 as
select * from test1_t1@link_server2;
SQL> desc test1_linkt1
Name Null? Type
----------------------------------------- -------- ----------------
OWNER VARCHAR2(60)
OBJECT_NAME VARCHAR2(60)
SUBOBJECT_NAME VARCHAR2(60)
OBJECT_ID NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(38)
CREATED DATE
LAST_DDL_TIME DATE
TIMESTAMP VARCHAR2(38)
STATUS VARCHAR2(14)
TEMPORARY VARCHAR2(2)
GENERATED VARCHAR2(2)
SECONDARY VARCHAR2(2)
表结构一样,但是列的长度确实变了, 通过dblink创建的表的varchar2列的长度是原表的两倍
再来看看字符集
1.Server1上的数据库字符集
SQL> column value format A20
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
value
--------------
ZHS16GBK
2. Server2上的数据库字符集
SQL> conn test1/test1@db10G_server2
SQL> column value format A20
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
value
--------------
AL32UTF8
结论: 与数据库字符集不同有关系.
四、在10g不支持的Linux发行版上安装10g的解决方法
正常安装的10g只支持Red Hat Enterprise Linux 2.1 and 3, and on UnitedLinux 1.0。如果是其它的版本,比如fedora,rh9等,10g将会说不支持,而不允许安装,解决方法如下:
1.运行runInstaller -ignoreSysPrereqs,这样会跳过检查
2.修改/etc/redhat-release文件,让10g认为自己处于支持的操作系统中,运行下面的命令即可
su - root
cp /etc/redhat-release /etc/redhat-release.backup
cat > /etc/redhat-release << EOF
Red Hat Enterprise Linux AS release 3 (Taroon)
EOF
安装完毕,再将那个文件还原:
su - root
cp /etc/redhat-release.backup /etc/redhat-release
3.同样的思路,我们可以去修改Oracle 的install/oraparam.ini文件:
[Certified Versions]
Linux=redhat-2.1,UnitedLinux-1.0,redhat-3
把这个屏蔽掉,或者是添加新的内容:
[Certified Versions]
Linux=redhat-2.1,UnitedLinux-1.0,redhat-3
[Linux-redhat-2.1-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256
[UnitedLinux-1.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256
[Linux-redhat-3.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256
对这个地方定制一下就可以了。
注:有兴趣的朋友不妨测试一下,其实在这个地方可以定制很多东西的,但是不推荐在正式的应用中这么做。
推荐链接:oracle 10g常见问题精选 (1)