您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。