您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“如何將Oracle數(shù)據(jù)庫(kù)改為歸檔模式并啟用RMAN備份”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“如何將Oracle數(shù)據(jù)庫(kù)改為歸檔模式并啟用RMAN備份”吧!
如下Linux環(huán)境下對(duì)Oracle單節(jié)點(diǎn)數(shù)據(jù)庫(kù)采用文件系統(tǒng)情況的配置歸檔模式過(guò)程。首先查看數(shù)據(jù)庫(kù)歸檔模式和磁盤(pán)使用情況,確定歸檔文件放到什么位置:
[oracle@gisdbserver ~]$ sqlplus / as sysdba SQL> archive log list Database log mode No Archive Mode Automatic archival Disabled Archive destination /dbback/archivelog Oldest online log sequence 92 Current log sequence 97
根據(jù)如下磁盤(pán)使用情況,在相應(yīng)的目錄下建立相關(guān)歸檔和備份目錄:
[root@gisdbserver ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_gisdbserver-lv_root 99G 3.8G 90G 4% / tmpfs 16G 76K 16G 1% /dev/shm /dev/sda2 485M 39M 421M 9% /boot /dev/sda1 200M 260K 200M 1% /boot/efi /dev/mapper/vg_gisdbserver-LogVol03 481G 198M 457G 1% /dbback /dev/mapper/vg_gisdbserver-LogVol04 407G 9.3G 377G 3% /home /dev/mapper/vg_gisdbserver-LogVol02 99G 4.5G 89G 5% /opt dev/sdb 441G 72G 347G 18% /oradata
創(chuàng)建相關(guān)歸檔日志存放目錄:
[root@gisdbserver ~]# cd /dbback/ [root@gisdbserver dbback]# mkdir archivelog [root@gisdbserver dbback]# chown -R oracle:oinstall archivelog/ [root@gisdbserver dbback]# mkdir rman [root@gisdbserver dbback]# chown oracle:oinstall rman/ [root@gisdbserver rman]# mkdir fullback [root@gisdbserver rman]# mkdir archiveback [root@gisdbserver rman]# chown oracle:oinstall archiveback/ [root@gisdbserver rman]# chown oracle:oinstall fullback/
登錄數(shù)據(jù)庫(kù)指定歸檔存放目錄:
[oracle@gisdbserver ~]$ sqlplus / as sysdba SQL> alter system set log_archive_dest_1='location=/dbback/archivelog'; System altered. SQL> show parameter log_archive_dest_1 NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ log_archive_dest_1 string location=/dbback/archivelog
要將非歸檔數(shù)據(jù)庫(kù)模式改為歸檔模式,需要在mount狀態(tài)下執(zhí)行alter database archivelog命令才行,如下:
SQL> archive log list Database log mode No Archive Mode Automatic archival Disabled Archive destination /dbback/archivelog Oldest online log sequence 92 Current log sequence 97 SQL> alter database archivelog; alter database archivelog * ERROR at line 1: ORA-01126: database must be mounted in this instance and not open in any instance
因此需要在合適的時(shí)間關(guān)閉數(shù)據(jù)庫(kù),重新啟動(dòng)到mount狀態(tài)下才能改變?yōu)闅w檔模式。
SQL> shutdown immediate; SQL> startup mount; SQL> alter database archivelog;
要開(kāi)啟rman備份,需要對(duì)配置rman相關(guān)的一些參數(shù),具體如下:
oracle@gisdbserver ~]$ rman target / RMAN> backup DATABASE include CURRENT controlfile format '/dbback/rman/fullback/data_%d_%T_%s_%p' plus archivelog format '+/dbback/rman/archiveback/arch_%d_%T_%s';
以上語(yǔ)句也可以通過(guò)linux的crontab 和 bash腳本方式進(jìn)行自動(dòng)化運(yùn)行。
run{ DELETE NOPROMPT expired archivelog ALL; allocate channel d1 TYPE disk maxpiecesize=30G; allocate channel d2 TYPE disk maxpiecesize=30G; backup DATABASE include CURRENT controlfile format '/dbback/rman/fullback/data_%d_%T_%s_%p' plus archivelog format '+/dbback/rman/archiveback/arch_%d_%T_%s'; release channel d1; release channel d2; crosscheck backup; DELETE noprompt obsolete REDUNDANCY 1; }
到此,相信大家對(duì)“如何將Oracle數(shù)據(jù)庫(kù)改為歸檔模式并啟用RMAN備份”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。