docker oracle12C dump 恢复与备份

数据库恢复

首先需要创建一个临时目录用于存放备份的dump文件

create or replace directory dp_dir as  '/home/oracle';

将备份文件拷贝到临时目录中

[root@15 ~]# cd /home/oracle/
[root@15 oracle]# ll
total 410552
-rw-r--r--. 1 root root 353361920 Jun 29 10:58 20200624_1463_XIR_MDJ.DMP
-rw-r--r--. 1 root root  38862848 Jun 29 10:58 20200624_1463_XIR_TRDJ.DMP

查看当前的docker容器

[root@15 oracle]# docker ps
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS                 PORTS                                            NAMES
ea83feb3445d        portainer/portainer           "/portainer"             12 days ago         Up About a minute      0.0.0.0:9000->9000/tcp                           prtainer
d7730cbb7360        oracle/database:12.2.0.1-ee   "/bin/sh -c 'exec ..."   12 days ago         Up 12 days (healthy)   0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp   oracle12c

拷贝文件到指定的容器中

docker cp /home/oracle/20200624_1463_XIR_MDJ.DMP oracle12c:/home/oracle/
docker cp /home/oracle/20200624_1463_XIR_TRDJ.DMP oracle12c:/home/oracle/
[root@15 oracle]# docker cp /home/oracle/20200624_1463_XIR_MDJ.DMP oracle12c:/home/oracle/
[root@15 oracle]# docker cp /home/oracle/20200624_1463_XIR_TRDJ.DMP oracle12c:/home/oracle/

进入容器查看

[root@15 oracle]# docker exec -it oracle12c /bin/bash
[oracle@d7730cbb7360 ~]$ ll
total 626768
-rw-r--r--. 1 root root 353361920 Jun 29 02:58 20200624_1463_XIR_MDJ.DMP
-rw-r--r--. 1 root root 288448512 Jun 29 02:59 20200624_1463_XIR_TRDJ.DMP
lrwxrwxrwx. 1 root root        26 Jun 15 11:26 setPassword.sh -> /opt/oracle/setPassword.sh

恢复备份

impdp xir_trdj/xpar@pdborcl directory=dp_dir dumpfile=20200624_1463_XIR_MDJ.DMP logfile=20200624_1463_XIR_MDJ.log schemas=xir_mdj
impdp xir_trdj/xpar@pdborcl directory=dp_dir dumpfile=20200624_1463_XIR_TRDJ.DMP logfile=20200624_1463_XIR_TRDJ.log schemas=xir_trdj
数据库备份
expdp xir_trdj/xpar@pdborcl directory=dp_dir dumpfile=20200629_1463_XIR_MDJ.DMP logfile=20200624_1463_XIR_MDJ.log schemas=xir_mdj
expdp xir_trdj/xpar@pdborcl directory=dp_dir dumpfile=20200629_1463_XIR_TRDJ.DMP logfile=20200624_1463_XIR_TRDJ.log schemas=xir_trdj

将备份数据拷贝到虚拟机临时目录

docker cp oracle12c:/home/oracle/20200629_1463_XIR_MDJ.DMP  /home/oracle/
docker cp oracle12c:/home/oracle/20200629_1463_XIR_TRDJ.DMP  /home/oracle/

你可能感兴趣的:(docker,oracle,centos,oracle,数据库)