• Oracle数据库导入导出总结(dmp文件)


    Oracle 10G 管理页面(Oracle Enterprise Manager 10g):


    http://localhost:1158/em
    http://localhost:1158/em/console/logon/logon


    Oracle数据库导出:
     
     (1)整个用户下的所有数据(dmp文件):
     
      《导出》
      
      
       exp 用户名/密码@数据库 file=保存路径
     
        如:exp woDemo/a123@ORCL file=E:/TestDate.dmp

      《导入》
      
       imp 用户名/密码@数据库 file=文件路径
     
        如:imp scott/tigger@ORCL file=E:/TestDate.dmp
     

     (2)用户下数据库中的某张表 <或多张表>(dmp文件):
      

      《导出》
      
       
       exp 用户名/密码@数据库 file=保存路径 tables=表1,表2
     
        如(张表):exp woDemo/a123@ORCL file=E:/TestDate.dmp tables=TestTable

        如(张表):exp woDemo/a123@ORCL file=E:/TestDate.dmp tables=TestTable1,TestTable2

      《导入》
      
       imp 用户名/密码@数据库 file=文件路径 tables=表1,表2
     
        如(张表):imp woDemo/a123@ORCL file=E:/TestDate.dmp tables=TestTable

        如(张表):imp woDemo/a123@ORCL file=E:/TestDate.dmp tables=TestTable1,TestTable2

     (3)导出用户下的某张表(或多张表)前1000条数据(dmp文件):
     exp userid=用户名/密码@连接名 file=文件路径 tables=(表名) query="where rownum<=1000"

     exp userid=用户名/密码@连接名 file=文件路径 tables=(表名,表名......) query="where rownum<=1000"


    1.导出

       导出使用的命令是exp

       导出本地用户所有表格式:exp 用户名/密码 file=d:name.dmp owner=owner_name

       导出远程用户所有表格式:exp 用户名/密码@数据库实例名 file=d:name.dmp owner=oname1,oname2

       导出本地用户单张表格式:exp 用户名/密码 tables=tname,tname1 file=d:name.dmp  

       导出单张表按过滤条件:(filed1字段以00开头的数据)

       exp 用户名/密码 file=d:aaa.dmp tables=tname query=" where filed1 like ’00%’"

       导出后压缩文件在命令后带 compress=y 参数(一般直接用winzip就可以了)

    2.导入

       导入使用的命令是imp

        导入本地用户所有表格式:imp 用户名/密码 file=d:name.dmp 

       导入远程用户所有表格式:imp 用户名/密码@数据库实例名 file=d:name.dmp 

       导入本地用户单张表格式:imp 用户名/密码 file=d:name.dmp full=y ignore=y

       注意:导入用户下所有表的时候,导出和导入的表空间名字应该对应上,不然会出现错误,触发器全部会作废。

       参数说明:

       1. ignore参数
      Oracle在恢复数据的过程中,当恢复某个表时,该表已经存在,就要根据ignore参数的设置来决定如何 操作。
      若ignore=y,Oracle不执行CREATE TABLE语句,直接将数据插入到表中,如果插入的记录违背了约束条件,比如主键约束,则出错的记录不会插入,但合法的记录会添加到表中。
      若ignore=n,Oracle不执行CREATE TABLE语句,同时也不会将数据插入到表中,而是忽略该表的错误,继续恢复下一个表。

  • 相关阅读:
    ORA-00600: internal error code, arguments: [kgl-no-mutex-held]
    MongoDB3.4版本配置详解
    java.lang.CharSequence cannot be resolved
    truncate表恢复
    ERROR 1045 (28000): Access denied for user 'mycat'@'localhost' (using password: YES)
    安装mysql-python
    pip virtualenv requirements
    mapreduce on yarn简单内存分配解释
    tez参数
    jstat命令的使用及VM Thread分析
  • 原文地址:https://www.cnblogs.com/xulang/p/5506193.html
Copyright © 2020-2023  润新知