f-l-y

备份:

在cmd命令行中,执行sqlplus,用管理员账号登录

建立目录对象:

create directory expdir as ‘D:\expdir’; 

赋予要备份数据的用户导出权限:

grant exp_full_database to username(你要备份的用户名);

另打开一个cmd窗口

备份数据为DMP格式:

expdp username/password@localhost/orcl directory=expdir dumpfile=beifen.dmp full=y

其中,username(要备份的用户名)、password(要备份的用户的密码)、localhost(本地IP地址,可以是远程地址)、orcl(实例名)、expdir(上面创建的目录对象)、beifen.dmp(备份的文件名,格式是dmp)

如果导出时,要把不需要导出数据的表的数据忽略掉:

expdp username/password@localhost/orcl directory=expdir dumpfile=beifen.dmp full=y exclude=TABLE:\"LIKE \\'表名或表名开头%\\'\",exclude=TABLE:\"LIKE \\'表名或表名开头%\\'\"

还原:

如果要导入的数据库中没有用户则先创建用户

创建用户(用户名以RMS为例):

create tablespace RMS(要还原的用户名) logging datafile \'D:\app\Administrator\oradata\orcl\RMS.dbf\' size 500m autoextend on next 100m maxsize 2048m extent management local;

create temporary tablespace RMSTEMP tempfile \'D:\app\Administrator\oradata\orcl\RMSTEMP.dbf\' size 100M autoExtend on next 50M EXTENT MANAGEMENT LOCAL;

create user RMS identified by 123456 default tablespace RMS;

在cmd命令行中,执行sqlplus,用管理员账号登录

建立目录对象:

create directory expdir as ‘D:\expdir’; 

赋予要备份数据的用户导入权限:

grant imp_full_database to username(你要备份的用户名,即上文的RMS);

另打开一个cmd窗口

导入备份的数据:

impdp username/password schemas=username directory=expdir dumpfile=beifen.dmp table_exists_action=replace logfile=import.log

分类:

技术点:

相关文章:

  • 2021-06-16
  • 2021-12-05
  • 2021-09-14
  • 2021-12-29
  • 2021-11-23
  • 2021-12-04
  • 2022-03-02
  • 2021-12-04
猜你喜欢
  • 2021-11-13
  • 2021-07-17
  • 2021-10-31
  • 2021-11-10
  • 2022-01-07
相关资源
相似解决方案