您的位置:首页 > 数据库 > Oracle

linux下oracle数据的导入导出

2014-06-11 10:28 309 查看
数据库的导入导出方法

首先说一下导入导出的关键字:导出exp、导入imp 这两个关键字是不能再sqlplus中运行的,实在登录状态下执行的

1、导出数据

【1】将实例名为ihis下完全导出,登录用户是username,密码是password,file是导出文件的存放地址命令如下

exp username/password@127.0.0.1/ihis file=/home/oracle/daochu.dmp full=y--->这是数据库ihis下所有表的数据都导出

【2】如果只想导出ihis下的名叫test的表的数据,命令如下

exp username/password@127.0.0.1/ihis file=/home/oracle/daochu.dmp tables=test

【3】如果想导出多个数据库下面的表,命令如下

exp username/password@ihis file=/home/oracle/daochu.dmp owner=(username,sys)

【4】如果想导出ihis下表test中的字段field以”0812112“开头的数据,命令如下

exp username/password@ihis file=/home/oracle/daochu.dmp tables=test query=\"where field like '0812112%'\"

注:如果需要导出权限关系,可使用grants=y

2、导入数据

【1】将/home/oracle/daochu.dmp中的所有数据导入,命令如下

imp username/password@ihis file=/home/oracle/daochu.dmp ignore=y full=y

【2】如果是想导入其中的一个表,命令如下

imp username/password@ihis file=/home/oracle/daochu.dmp tables=test ignore=y full=y

注:ignore:当导入的表和数据库中的表有重复的时候会报错,加上ignore表示忽略

full:表示全部
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: