数据库备份
使用命令:
exp user/password@orcl file=D:\xinji\kaohe.dmp full=y
注意参数full=y ,将会导出整个数据库,不单单是当前 user 用户,包括其他所有用户,所以需具有 system用户权限,普通用户是不可以的。默认为N
数据库恢复
imp导入
sqlplus /nolog
conn / as sysdba
表结构已存在
ALTER TABLESPACE TP6J_NT ADD DATAFILE ‘D:\Oracle\TP7_XA0105.DMP’ SIZE 740M AUTOEXTEND ON NEXT 5M MAXSIZE unlimted;表结构不存在
create tablespace TP7_XA datafile ‘D:\Oracle\TP7_XA0105.DMP’ size 740M autoextend on next 10M maxsize unlimited logging online extent management local autoallocate blocksize 8k segment space management auto flashback on;create user XA identified by 11111 default tablespace F9 temporary tablespace temp profile default account unlock;
给用户授权
Grant connect, resource, dba to XA;
- 创建文件夹
create or replace directory my_dir as ‘D:\xinji’ 授权读写文件夹的权利
Grant write, read on directory my_dir to XA;imp EPOINTBID_TP7_XA/11111 file=D:\xinji\XA0105.DMP full=y ignore=y statistics=none
如果使用 imp 导入时,提示:无法转换为环境字符集句柄,可能是dmp导出使用的是expdp 导出的,所以导入的时候也需要使用impdp。
impdp 导入
create or replace directory my_dir as ‘D:\xinji’
对这个目录进行授权
grant read, write on directory my_dir to public
(如果不授权,可能会出现下面的错误:
错误提示:
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name D:/ is invalid
)impdp XA/11111 directory=my_dir dumpfile=EPOINTBID_TP7_XA0105.DMP full=y remap_schema=EPOINTBID_XINJI_F9:EPOINTBID_XINJI_SZ_F9