您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
1.编写备份脚本 通过操作系统的命令来实现的备份机制:cp、scp 1.1查询所有的文件所在位置(数据文件,控制文件,参数文件,重做日志文件,密码文件) SYS@orcl11g> select name from v$datafile 2 union 3 select name from v$controlfile 4 union 5 select member from v$logfile; 1.2创建备份的路径 SYS@orcl11g> host mkdir /u01/app/backup 1.3通过select语句构建拷贝脚本 SYS@orcl11g> set trim on 截取掉不必要的空格 SYS@orcl11g> set trims on 每个行的空格 SYS@orcl11g> set heading off 去掉标题 SYS@orcl11g> set echo off 去掉反馈 SYS@orcl11g> set feedback off 去掉回显 SYS@orcl11g> set term off 关闭终端信息 SYS@orcl11g> spool /home/oracle/cp.sql SYS@orcl11g>select 'cp '||name||' /u01/app/backup' from v$datafile union select 'cp ' ||name|| ' /u01/app/backup' from v$controlfile union select 'cp '||member||' /u01/app/backup' from v$logfile +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SYS@orcl11g> select 'cp ' || name || ' /u01/app/backup/' from v$datafile; --只备份数据文件 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ cp /u01/app/oracle/fast_recovery_area/orcl11g/control02.ctl /home/backup cp /u01/app/oracle/oradata/orcl11g/control01.ctl /home/backup cp /u01/app/oracle/oradata/orcl11g/example01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/redo01.log /home/backup cp /u01/app/oracle/oradata/orcl11g/redo02.log /home/backup cp /u01/app/oracle/oradata/orcl11g/redo03.log /home/backup cp /u01/app/oracle/oradata/orcl11g/sysaux01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/system01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/undotbs01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/users01.dbf /home/backup [oracle@db253 ~]$ spool off [oracle@db253 ~]$ vi cp.sql [oracle@db253 ~]$ cat cp.sql cp /u01/app/oracle/fast_recovery_area/orcl11g/control02.ctl /home/backup cp /u01/app/oracle/oradata/orcl11g/control01.ctl /home/backup cp /u01/app/oracle/oradata/orcl11g/example01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/redo01.log /home/backup cp /u01/app/oracle/oradata/orcl11g/redo02.log /home/backup cp /u01/app/oracle/oradata/orcl11g/redo03.log /home/backup cp /u01/app/oracle/oradata/orcl11g/sysaux01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/system01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/undotbs01.dbf /home/backup cp /u01/app/oracle/oradata/orcl11g/users01.dbf /home/backup [oracle@db253 ~]$ chmod +x cp.sql awk构建命令: ls -lSr /test | awk '{print "mv " $NF" /tmp/test/t"NR".conf"}' | bash 2.停止数据库 sql> shutdown immediate; 3.拷贝数据文件 [oracle@db253 ~]$ /home/oracle/cp.sql --执行脚本 4.开启数据库 sql> startup;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。