数据库导出导入过程 详细说明
时间:2021-07-01 10:21:17
帮助过:4人阅读
us.BYTES/1024 kb ,us.SEGMENT_NAME from user_segments us where us.segment_type=‘TABLE‘ order by BYTES desc
truncate table 垃圾数据过多的表;
导出UAT2 数据库脚本
确定 directory DATA_PUMP_DIR 存在 在数据库中
select * from dba_directories ;
|
登录到 远程 linux 数据库服务器,切换到 启动 oracle的用户,导出数据
su - oracle启动用户
expdp system/manager1 SCHEMAS=hecuat directory=DATA_PUMP_DIR dumpfile=hecuat_20161006.dmp logfile =DATA_PUMP_DIR:hecuat_20161006.log
|
linux 突发异常处理
如果command not found 错误, root用户 ,重新连接一下
可以在家目录 /home/用户文件夹 下查看.bash_profile里的PATH
PATH=$PATH:$HOME/bin:/sbin:/usr/bin:/usr/sbin
|
|
先登录到应用服务器关闭tomcat
然后关闭 要删除的用户的所有连接
select a.sid, a.serial#,‘‘‘‘ ||a.sid|| ‘,‘||a.serial#|| ‘‘‘‘ from v$session a
where a.USERNAME= ‘HECUAT‘ ;
alter system kill session ‘419,34697‘ ;
|
重置用户
drop user hecprd cascade;
create user HECPRD identified by hecprd default tablespace HECPRD temporary tablespace TEMP;
grant dba to HECPRD;
grant connect to HECPRD;
grant create any materialized view to HECPRD;
grant create any synonym to HECPRD;
grant create any table to HECPRD;
grant create any view to HECPRD;
grant select any dictionary to HECPRD;
grant read ,write on directory DATA_PUMP_DIR to HECPRD;
|
导入数据
把导出的文件上传或者移动到 目标数据库服务器 DATA_PUMP_DIR 目录下
chown oracle:oracle 源数据库导出文件
chmod 777 源数据库导出文件 cp 文件 目录
impdp hecprd/hecprd remap_schema=hecuat:hecprd remap_tablespace=hecuat:hecprd directory =DATA_PUMP_DIR dumpfile=20161002_uat.dmp logfile =20161002_uat.log transform=oid:n |
|
导入数据类型需要注意的
关联oid相同,说明type的oid在Oracle内部是作为关联的重要信息使用的。
在impdp中,我们可以使用transform参数设置,要求将原有dmp文件中oid映射重新生成。
impdp scottback/scottback@wilson directory=my_dir dumpfile=scott.dmp logfile=resimp2.log remap_schema=scott:scottback transform=oid:n
|
数据库导出导入过程 详细说明
标签: