1.创建表空间

--删除用户bxuser

drop user bxuser cascade;
--删除表空间bxuser
DROP TABLESPACE bxuser INCLUDING CONTENTS AND DATAFILES;
--创建表空间bxuser   自动扩展存储空间
create tablespace bxbackup
logging
datafile 'E:\oracletablespace\zjbx.dbf'
size 32m
autoextend on
next 32m maxsize unlimited
extent management local;
--创建用户bxuser,密码bxuser
create user bxbackup identified by bxbackup default tablespace bxbackup
--授予权限
grant resource,connect,dba to bxbackup

--cmd导入数据
imp bxbackup/bxbackup@//109.102.10.2:1521/orcl log=E:\bxuser.log file=E:\linshi\bxBF201709262015.dmp buffer=50000 fromuser=bxuser touser=bxbackup

 --11导出到10

expdp zjbxdev/zjbxdev@139.199.7.38:1521/orcl dumpfile=test.dmp owner=zjbxdev version=10.2.0.1.0

 

2.数据导入导出

cmd

imp命令导入数据:
imp username/password@SID file=XXX.dmp fromuser=XXX touser=XXX tables=(XXX,XXX)
其中
fromuser指对方数据库用户名,
touser指你的数据库的用户名;

fromuser若为多个表空间的话,使用()将其括起来:fromuser=(a,b);
touser参数仿fromuser参数;
若只导入一部分表,使用tables参数,用()括起要导入的表;如果想全部导入,不需要指定tables参数
full=y,是导入文件中全部内容,有可能有多个用户的内容。
如果你联接的用户默认使用的表空间设置成system,则导入文件的内容会导到system上。
使用full=y可以不需要先在目标服务器上创建用户
有的表已经存在,然后它就报错,对该表就不进行导入。 在后面加上 ignore=y 就可以了。

例:
imp fanhua/fanhua@localhost/oracle file=E:\Project\hrhb\dlhx.dmp fromuser=dlhx touser=fanhua ignore=y

数据导出:
1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中
exp system/manager@TEST file=d:\daochu.dmp full=y

2 将数据库中system用户与sys用户的表导出
exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)

3 将数据库中的表inner_notify、notify_staff_relat导出
exp aichannel/aichannel@TESTDB2 file= d:\data\newsmgnt.dmp tables=

(inner_notify,notify_staff_relat)