zoukankan      html  css  js  c++  java
  • Linux导入导出Oracle数据库

    一 导出

    1.在Linnux服务器上如果不是oracle用户,则要切换到oracle用户。

       命令如下:

        su - oracle

    2.exp导出工具

        exp导出工具将数据库中数据备份压缩成一个二进制系统文件,可以在不同OS间迁移。

        exp导出工具又分为交互式命令行方式非交互式命令行方式 .

     

        (1)交互式命令行方式

        exp username(用户名)/password(口令)@servicename(数据库服务名)

        例如

        $exp  ttt/123@sername
        Enter array fetch buffer size: 4096 > 回车
        Export file: expdat.dmp > t.dmp  导出的文件名 

           (1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3

           1:整个数据库  2:所有的用户,schema  3:所有的表

        Export table data (yes/no): yes > no

        是否导出表中的数据
        Compress extents (yes/no): yes > 回车

        是否压缩
       

       Export done in US7ASCII character set and UTF8 NCHAR character set
       server uses AL32UTF8 character set (possible charset conversion)
       About to export specified tables via Conventional Path ...

       Table(T) or Partition(T:P) to be exported: (RETURN to quit) > t  要导出的表名

       . . exporting table                       t
       Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要导出的表名n
       Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回车
       Export terminated successfully without warnings. 

     

    (2)交互式命令行方式

       exp username/password@service_name file=/home/oracle/databasename.dmp

             username:用户名

             password:密码

             service_name:数据库的服务名

             file:要导出数据库文件的路径

     

     

     二 导入

         1.在要导入的oracle数据库上创建相应的用户,只有拥有IMP_FULL_DATABASE和DBA权限的用户才能做整个数据库导入。

          create user username identified by password
          grant dba to username

         2.导入前Linux服务器切换到oracle用户

             su - oracle

         3.imp导入工具

           导入工具imp也分交互式和非交互式

          (1)交互式命令行方式

          $ imp

          Username: username
          Password:  password

          Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
          With the Partitioning, OLAP, Data Mining and Real Application Testing options

          Import data only (yes/no): no >

          是否只导入数据

          Import file: expdat.dmp > /t/t.dmp

          导入数据库文件的路径

          Enter insert buffer size (minimum is 8192) 30720>

          输入插入缓冲区大小(最小为 8192 )

          Export file created by EXPORT:V10.02.01 via conventional path
          import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
          export client uses US7ASCII character set (possible charset conversion)
          export server uses UTF8 NCHAR character set (possible ncharset conversion)
          List contents of import file only (yes/no): no >

          只列出导入文件的内容

          Ignore create error due to object existence (yes/no): no > yes

          由于对象已存在, 忽略创建错误

          Import grants (yes/no): yes >

          导入权限

          Import table data (yes/no): yes >

          导入表数据

          Import entire export file (yes/no): no > yes

          导入整个导出文件

          . importing XXXXXXobjects into XXXXXX
          . . importing table              "t"       2775 rows imported
          Import terminated successfully with warnings. 

           (2)交互式命令行方式

           $ imp usrname/password file = t.dmp full=y 

    三 注意事项

         1.oracle数据库导出时老是遇到一错误.ora-12641:验证服务无法初始化

            这个问题的标准代码应该为 tns-12641(ora-12500到ora-12699的错误,应该是tns-12500到tns-12699).

            网络问题,从网络方面着手 

            将sqlnet.ora文件中的SQLNET.AUTHENTICATION_SERVICES = (TNS)

            修改为SQLNET.AUTHENTICATION_SERVICES = (none)

     
  • 相关阅读:
    Linux下Bind error: Address already in use处理
    详解基本TCP套接字函数
    C/C++常用头文件及函数汇总
    Centos编译Unix网络编程(第三版)卷1的源代码
    C++ 多线程中使用cout还是printf
    VIM常用指令
    Linux C头文件查找与动态库搜索
    linux常用头文件详解
    linux makefile自动生成
    ubuntu开机出现memtest86,重启也无法取消的原因
  • 原文地址:https://www.cnblogs.com/yanch/p/8676445.html
Copyright © 2011-2022 走看看