背景:项目数据库变动,在别的服务器重建数据库,表空间和用户空间命名完全相同,需要将该数据库替换掉原数据库
1.将新数据库的数据导出dump文件(该文件包含表结构、关系、数据等)
windows cmd 命令提示符下运行:exp bsScan/bsScan@192.168.10.236:1521/orcl file=E:\bsScan.dmp
注:file=xxxx 为Linux文件路径(?)
2.将原数据库的用户空间删掉(表空间不变)
xsell连接数据库:
su - oracle
sqlplus / as sysdba
drop user bsScan cascade;
3.新建用户空间
xsell连接数据库:
create user bsScan identified by bsScan default tablespace bsScan account unlock;
授权:
grant dba to bsScan;
4.完成用户空间新建之后,导入之前准备好的dump文件
windows cmd 命令提示符下运行:imp bsScan/bsScan@218.65.178.235:1521/orcl file=E:\bsScan.dmp full=y
另:
drop user bsScan cascade;
create user bsScan identified by bsScan default tablespace bsScan account unlock;
grant dba to bsScan;
exp bsScan/bsScan@192.168.10.236:1521/orcl file=E:\bsScan.dmp
imp bsScan/bsScan@218.65.178.235:1521/orcl file=E:\bsScan.dmp full=y
exp gpssgp/gpssgp@192.168.10.235:1521/orcl file=D:\myfile\BS_460_T.dmp tables=T_BS_460
imp LOGMINER/LOGMINER@192.168.10.235:1521/orcl file=D:\mufile\BS_460_T.dmp full=y