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.
oracle怎样将Scott中的表和记录copy到新建用户_第1张图片

oracle怎样将Scott中的表和记录copy到新建用户_第2张图片

你可能感兴趣的:(oracle)