设为首页
加入收藏夹

ORACLE7 用户之间数据拷贝的方法
浏览选项:

 大型数据库系统不是一个简单的文件系统,不象FOXBASE的DBF文件那样,可以简单地
拷来拷去。就拿ORACLE数据库来说,数据是隶属于某个用户的,每个用户都有各自的权限,如
果某用户要用另一个用户的数据,可以通过访问权限来实现。有时需要将某用户的数据直接搬
  1.例子
  ORACLE7数据库服务器操作系统为UNIX。
  ORACLE用户1:o7user1,密码:passwd1
  ORACLE用户2:o7user2密码:passwd2
  现在要做的工作是,将用户o7user1 的所有的表(视图及其它全部应用)复制到o7user2
  2.具体实现方法
  2.1 将用户o7user1的数据卸出
  $ exp o7user1/passwd1
  Export:......   Export file:expdat.dmp>
  E(ntire database),(2)U(sers),or (3)T(ables):(2)U>
  Export grants(yes/no):yes>
  Export table data(yes/no):yes>
  Compress extents(yes/no):yes>
  Abort to export specified users....
  Abort to export O7USER1's tables...
  Export terminated successfully without warnings

  最后将o7user1用户的数据生成于默认的expdat.dmp 文件中。
  2.2 确认已建立用户o7user2,并赋有相应的权限(一般用户的权限为connect和
  2.3 将o7user1的数据全部复制到o7user2 中
  $ imp o7user2/passwd2
  Import:Release ......   Import file: > expdat.dmp
  Enter insert buffer size (minimum is 4096) 30720>307200
  Export file created by EXPORT:   List contents of import file only(yes/no):no>
  Ignore create error due to object existence(yes/no):no>
  Import grants(yes/no):yes>
  Import table data(yes/no):yes>
  Import entire export file(yes/no):no>y
  开始复制o7user1之数据到o7user2中,出现如下提示:
  .importing O7USER1's objects into O7USER2
  .. importing table "table1" 10 rows imported

  …
  Import terminated successfully without warnings.
  至此,o7user1的数据已全部复制到了o7user2用户中。值得注意的是,在Import entire export file(yes/no):no>y,选择的是"y",若选择"no",就不能完成复制工作。


Copyright © 2004 wanxu.com All Rights Reserved