例:
create user his identified by his default tablespace users temporary tablespace temp;
grant connect,resource,dba to his;
create tablespace his
logging
datafile 'd:/oracle/product/10.2.0/oradata/zjxsh/his.ora' size 100M extent
management local segment space management auto;
exp his/ny@ny file=d:/0706ny full=y
exp his/his@xshis file=d:/0724xshis full=y
imp his/his@zjxshis file=d:/0724xshis.DMP fromuser=(his,chk,emr,fee,inv,med,opr,dig)touser=(his,chk,emr,fee,inv,med,opr,dig) ignore=y
imp his/his@zjxsh file=d:/0724xshis.DMP fromuser=his touser=his ignore=y
imp chk/chk@zjxsh file=d:/0724xshis.DMP fromuser=chk touser=chk ignore=y
imp emr/emr@zjxsh file=d:/0724xshis.DMP fromuser=emr touser=emr ignore=y
imp fee/fee@zjxsh file=d:/0724xshis.DMP fromuser=fee touser=fee ignore=y
imp inv/inv@zjxsh file=d:/0724xshis.DMP fromuser=inv touser=inv ignore=y
imp med/med@zjxsh file=d:/0724xshis.DMP fromuser=med touser=med ignore=y
imp opr/opr@zjxsh file=d:/0724xshis.DMP fromuser=opr touser=opr ignore=y
imp dig/dig@zjxsh file=d:/0724xshis.DMP fromuser=dig touser=dig ignore=y
imp mat/mat@zjxsh file=d:/0724xshis.DMP fromuser=mat touser=mat ignore=y
imp pas/pas@zjxsh file=d:/0724xshis.DMP fromuser=pas touser=pas ignore=y
create table name2 as select * from name1;
insert into name3 select * from name2;(*表示表字段,按顺序插入)
有时候我们会遇到这样的情况,现有的数据库要从一个机器转移到另外一个机器上,一般我们会使用导出,导入。但是如果数据库的数据非常多,数据文件尺寸很大,那么在导出导入的过程就很可能会出现问题,并且漫长的过程也是我们无法容忍的。 在这种情况下,我们可以简单地使用操作系统的copy命令,直接进行数据库的转移。以下示例均在Redhat Fedora Core 1上的Oracle9.2.0.1中操作,其它操作系统和Oracle版本同样适用。假设我们的数据库在服务器A上,$ORACLE_BASE是/oracle,$ORACLE_HOME是 /oracle/prodUCt/9.2.0。现在我们要将此数据库转移到服务器B上,并且新的$ORACLE_BASE是/u01/oracle,$ ORACLE_HOME是/u01/oracle/product/9.2.0。SID是oraLinux。
操作步骤如下:
一. 在服务器B上安装Oracle,安装过程中不要创建数据库。
用户的profile直接从服务器A上copy过来即可,注意需要修改原先的$ORACLE_HOME到现在的位置。
二. 如果服务器A上的Oracle使用的是spfile,那么根据此spfile创建pfile:
create pfile from spfile;
三. 关闭服务器A上的数据库,shutdown immediate。如果数据库不允许关闭,
那么可以使用联机备份,这种情况数据库必须处于archivelog模式,
转移的原理和允许关闭的情况一样,此处不作讨论。
四. 备份服务器A上的所有数据文件,包括以下:
a) 所有的datafile(临时文件可以不copy,比如temp01.dbf)
b) 所有的online redo log
c) 所有的archive redo log
d) 所有的control file
e) $ORACLE_HOME/dbs/init.ora(此文件是在上面第二步中创建的)
f) $ORACLE_HOME/dbs/orapw(这是p