www.icesr.com
IT运维工程师的摇篮

docker下oracle备份

回顾

上一篇提到的镜像只是简单的运行在容器里,数据无法持久化
http://blog.csdn.net/wm5920/article/details/78770556

拉取镜像

docker pull sath89/oracle-xe-11g

启动实例并挂载数据到宿主机

<code>docker run <span class="hljs-attribute">-d</span>  <span class="hljs-attribute">-p</span> <span class="hljs-number">49161</span>:<span class="hljs-number">1521</span> <span class="hljs-subst">--</span>name<span class="hljs-subst">=</span>oracle11g  <span class="hljs-attribute">-e</span> TZ<span class="hljs-subst">=</span>Asia/Shanghai  <span class="hljs-attribute">-v</span> /home/oracledata/oracle:/u01/app/oracle  sath89/oracle<span class="hljs-attribute">-xe</span><span class="hljs-subst">-</span><span class="hljs-number">11</span>g</code>

-e TZ=Asia/Shanghai是为了统一系统时间

数据库实例信息

<code><span class="hljs-attribute">port</span>: <span class="hljs-string">49161</span>
<span class="hljs-attribute">sid</span>: <span class="hljs-string">xe</span>
<span class="hljs-attribute">username</span>: <span class="hljs-string">sys</span>
<span class="hljs-attribute">password</span>: <span class="hljs-string">oracle</span></code>

创建备份数据库

<code>docker run <span class="hljs-attribute">-d</span>  <span class="hljs-attribute">-p</span> <span class="hljs-number">49162</span>:<span class="hljs-number">1521</span> <span class="hljs-subst">--</span>name<span class="hljs-subst">=</span>oracle11gbak  <span class="hljs-attribute">-e</span> TZ<span class="hljs-subst">=</span>Asia/Shanghai  <span class="hljs-attribute">-v</span> /home/oracledata/oracle<span class="hljs-attribute">-bak</span>:/u01/app/oracle  sath89/oracle<span class="hljs-attribute">-xe</span><span class="hljs-subst">-</span><span class="hljs-number">11</span>g</code>

如何备份

  • 停掉主备数据库
    docker stop oracle11g oracle11gbak
  • 删除备份实例数据文件
    rm -rf /home/oracledata/oracle-bak
  • 拷贝数据文件夹
    cp -r /home/oracledata/oracle /home/oracledata/oracle-bak
  • 启动实例
    docker start oracle11g oracle11gbak

未经允许不得转载:冰点网络 » docker下oracle备份

分享到:更多 ()

评论 抢沙发

评论前必须登录!