zoukankan      html  css  js  c++  java
  • SQL Server数据库转换成oracle

    来源:http://blog.csdn.net/hzfu007/article/details/6182151

    经常碰到需要把sql server的数据迁移到Oracle的情况。

    在网上查找一下,有很多方法,有用第三方工具的等,但sql server本身就提供一个“导入导出”的工具,用这个工具就可以把sql server数据转换到oracle中。

    下面简单列一下操作步骤:

    1、

    在sql server中打开导入导出工具,在选择源数据界面上选择数据源,一般默认就可以了。输入源数据的服务器ip、用户名、密码,选择数据库,下一步。

    2、

    选择目的界面中,这里要说明下,最好选择”MicroSoft OLE DB Provider for Oracle方式(这种方式有个缺点就是如果sqlserver表中含有ntext字段的时候,且有多个的时候,就转换不了,这个时候用Oracle Provider  for ole DB这种方式就行,用这个方式的时候,在转换界面的时候,因为默认会用long字段来对应,所以需要手工在列映射与转换界面直接把建表语句中的long字段修改成clob,再转换,ok),选择另外其他方式时那些表和字段的映射好像不太准确(我没有一一去验证其他方式).输入服务器名称和用户密码,测试成功后,下一步。

    3、在指定复制或查询界面中,选择“从数据库复制表和视图”方式,下一步。

    4、在选择源表和视图界面中,选择要转移的表和视图。然后一直按照提示来操作就可以了。

    注意事项:

    1、这些表中的字段映射可能要手工来指定。不过一般自动默认都可以了。

    2、sqlserver导入到oracle的表和字段在oracle中用sql语句访问的时候需要加上双引号才能访问,这个就非常麻烦。因为数据迁移的时候需要

    频繁的操作这些。所以我用了一个很简单的方法,就是在oracle重建所有表,然后把数据拷进来。

    附:

    Access, SQL Server, and Oracle数据类型的对应关系

    The table below shows the ADO Data Type mapping between Access, SQL Server, and Oracle:

    DataType EnumValueAccessSQLServerOracle
    adBigInt 20   BigInt (SQL Server 2000 +)  
    adBinary 128   Binary
    TimeStamp
    Raw *
    adBoolean 11 YesNo Bit  
    adChar 129   Char Char
    adCurrency 6 Currency Money
    SmallMoney
     
    adDate 7 Date DateTime  
    adDBTimeStamp 135 DateTime (Access 97 (ODBC)) DateTime
    SmallDateTime
    Date
    adDecimal 14     Decimal *
    adDouble 5 Double Float Float
    adGUID 72 ReplicationID (Access 97 (OLEDB)), (Access 2000 (OLEDB)) UniqueIdentifier (SQL Server 7.0 +)  
    adIDispatch 9      
    adInteger 3 AutoNumber
    Integer
    Long
    Identity (SQL Server 6.5)
    Int
     
    Int *
    adLongVarBinary 205 OLEObject Image Long Raw *
    Blob (Oracle 8.1.x)
    adLongVarChar 201 Memo (Access 97)
    Hyperlink (Access 97)
    Text Long *
    Clob (Oracle 8.1.x)
    adLongVarWChar 203 Memo (Access 2000 (OLEDB))
    Hyperlink (Access 2000 (OLEDB))
    NText (SQL Server 7.0 +) NClob (Oracle 8.1.x)
    adNumeric 131 Decimal (Access 2000 (OLEDB)) Decimal
    Numeric
    Decimal
    Integer
    Number
    SmallInt
    adSingle 4 Single Real  
    adSmallInt 2 Integer SmallInt  
    adUnsignedTinyInt 17 Byte TinyInt  
    adVarBinary 204 ReplicationID (Access 97) VarBinary  
    adVarChar 200 Text (Access 97) VarChar VarChar
    adVariant 12   Sql_Variant (SQL Server 2000 +) VarChar2
    adVarWChar 202 Text (Access 2000 (OLEDB)) NVarChar (SQL Server 7.0 +) NVarChar2
    adWChar 130   NChar (SQL Server 7.0 +)  

    * In Oracle 8.0.x - decimal and int are equal to number and number(10).

  • 相关阅读:
    UICollectionView中使用 UICollectionViewFlowLayout进行布局(模仿苹果相册)
    使用CocoaPods被卡住:Updating local specs repositories
    【原】iOS 同时重写setter和getter时候报错:Use of undeclared identifier '_name';did you mean 'name'
    iOS 设置不同的字体颜色
    使用java代码,动态给TextView设置drawable
    格式化浮点数(保留指定位数)
    监听输入法的出现和隐藏
    dp和px的转换
    获取状态栏高度
    获取在attr.xml中声明的主题样式
  • 原文地址:https://www.cnblogs.com/ys-wuhan/p/6043934.html
Copyright © 2011-2022 走看看