exp/imp工具:
带参数:rows=y —— 带数据导出导入;rows=n —— 不带数据的导出导入,只移植结构。
例如:
只导出3张表的结构:
exp user/pasword@dbServerName owner=user tables=(table1,table2,table3) rows=n file=c:\1.dmp
连带数据导出:
exp user/pasword@dbServerName owner=user tables=(table1,table2,table3) rows=y file=c:\2.dmp
imp user2/pasword@dbServerName2 fromuser=user touser=user2 file=c:\1.dmp
或者
imp user2/pasword@dbServerName2 fromuser=user touser=user2 file=c:\2.dmp
导出一个用户下的所有表数据
Imp username/password file=file.dmp fromuser=user1 touser=user2 rows=y
导出一个用户下的所有表数据
常用的命令
Exp user/password@instance file=file.dmp rows=y log=log_name
其中username/password为导出用户的用户名和密码
Instance为导出的实例名
导出一个用户下的表结构为sql文件
使用命令好像导出的都是dmp文件
可以使用plsql软件在tools--?export user object
如果不要到处table space,不要勾include storage
选择导出的路径文件名,export可以直接导出了
导入一个用户下的所有表数据
导入一个用户下的所有表数据
Imp username/password file=file.dmp fromuser=user1 touser=user2 rows=y
其中username/password为导入到
数据库的用户名和密码/
Fromuser为备份数据库时的用户
Fromuser为备份数据库时的用户
Touser为导入数据库的用户,一般和username同
一、数据导出(exp.exe)
1、将指定用户的数据全部导出:
将数据库orcl中scott用户的数据全部对象导出
exp scott/accp@orcl file=d:\daochu.dmp
2、将指定用户的指定表的数据导出:
将数据库orcl中的scott用户的表emp、dept导出
exp scott/accp@orcl file= d:\daochu.dmptables=(emp,dept)
3、将指定用户的指定表空间的数据导出:
将数据库orcl中的表空间testSpace导出
exp scott/accp@orcl file=d:\daochu.dmptablespaces=(testSpace)
二、数据导入(imp.exe)
1、把指定的数据文件全部导入到指定的用户中: full=y意思是值全部数据
将d:\daochu.dmp 中的数据导入 orcl数据库的system用户中,
imp scott/accp@orcl file=d:\daochu.dmp full=y
2、把指定的数据文件全部导入到指定的用户中:
如果导入时,数据表已经存在,将报错,对该表不会进行导入;加上ignore=y即可,表示忽略现有表,在现有表上追加记录。
imp scott/accp@orcl file=d:\daochu.dmp full=y ignore=y