oracle怎样将Scott中的表和记录copy到新建用户

exp导出:
exp userid=scott/tiger file='d:\exp.dmp' log='d:\exp.log' tables=(EMP,DEPT)

imp导入
imp userid="\"sys/sys as sysdba"\" file='d:\exp.dmp' log='d:\imp.log' tables=(EMP,DEPT)  fromuser=scott touser=test
注意:执行导入导出的时候,命令是在操作系统上执行,不是在数据库里执行。命令最后不要带分号";"。log参数可以不要(只是个日志文件)。导入时,userid必须具有dba权限才行,否者会报错:IMP-00007: must be a DBA to import objects to another user's account如果scott有dba权限,也可以用如下脚本导入:
imp userid=scott/tiger file='d:\exp.dmp' log='d:\imp.log' tables=(EMP,DEPT)  fromuser=scott  touser=test
实例如下:
C:\Documents and Settings\ty>exp userid=scott/tiger file='d:\exp.dmp' log='d:\exp.log' tables=(EMP,DEPT)
Export: Release 10.2.0.1.0 - Production on Fri Mar 5 09:31:54 2010Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character setAbout to export specified tables via Conventional Path .... . exporting table EMP 14 rows exported. . exporting table DEPT 4 rows exportedExport terminated successfully without warnings.
C:\Documents and Settings\ty>imp userid="\"sys/sys as sysdba"\" file='d:\exp.dmp' log='d:\imp.log' tables=(EMP,DEPT)  fromuser=scott touser=test
Import: Release 10.2.0.1.0 - Production on Fri Mar 5 09:30:38 2010Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsExport file created by EXPORT:V10.02.01 via conventional pathWarning: the objects were exported by SCOTT, not by youimport done in ZHS16GBK character set and AL16UTF16 NCHAR character set. importing SCOTT's objects into TEST. . importing table "EMP" 14 rows imported. . importing table "DEPT" 4 rows importedAbout to enable constraints...Import terminated successfully without warnings.

 


                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

沙漏无语

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值