1.編寫備份腳本
通過操作系統(tǒng)的命令來實現(xiàn)的備份機制:cp、scp
1.1查詢所有的文件所在位置(數(shù)據(jù)文件,控制文件,參數(shù)文件,重做日志文件,密碼文件)
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創(chuàng)建備份的路徑
SYS@orcl11g> host mkdir /u01/app/backup
1.3通過select語句構(gòu)建拷貝腳本
SYS@orcl11g> set trim on 截取掉不必要的空格
SYS@orcl11g> set trims on 每個行的空格
SYS@orcl11g> set heading off 去掉標(biāo)題
SYS@orcl11g> set echo off 去掉反饋
SYS@orcl11g> set feedback off 去掉回顯
SYS@orcl11g> set term off 關(guān)閉終端信息
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; --只備份數(shù)據(jù)文件
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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構(gòu)建命令:
ls -lSr /test | awk '{print "mv " $NF" /tmp/test/t"NR".conf"}' | bash
2.停止數(shù)據(jù)庫
sql> shutdown immediate;
3.拷貝數(shù)據(jù)文件
[oracle@db253 ~]$ /home/oracle/cp.sql --執(zhí)行腳本
4.開啟數(shù)據(jù)庫
sql> startup;
創(chuàng)新互聯(lián)服務(wù)項目包括墨脫網(wǎng)站建設(shè)、
墨脫網(wǎng)站制作、墨脫網(wǎng)頁制作以及墨脫網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,
墨脫網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到墨脫省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
新聞標(biāo)題:Oracle數(shù)據(jù)庫的冷備-創(chuàng)新互聯(lián)
新聞來源:
http://weahome.cn/article/cesogg.html