RAC開啟數(shù)據(jù)庫歸檔:
從事溫江服務(wù)器租用,服務(wù)器租用,云主機(jī),虛擬空間,域名申請,CDN,網(wǎng)絡(luò)代維等服務(wù)。
首先要確定歸檔存放的路徑:
1.切換至grid用戶下使用asmcmd命令查看要把歸檔存放到那個(gè)路徑下
在節(jié)點(diǎn)1上執(zhí)行上執(zhí)行
[root@yang1 ~]#
su - grid
[grid@yang1 ~]$
sqlplus / as sysasm
SQL>
select name from v$asm_diskgroup;
NAME
------------------------------
DATA
OCR
FRA
SQL>
alter system set log_archive_dest_1='LOCATION=+RECOC1/yang/archivelog' scope=spfile sid='yang1';
Diskgroup altered.
SQL>
alter system set log_archive_dest_1='LOCATION=
+RECOC1/yang/archivelog
' scope=spfile sid='
yang
2';
Diskgroup altered.
2. 使用shutdown immediate命令關(guān)閉節(jié)點(diǎn)的兩個(gè)實(shí)例
節(jié)點(diǎn)yang1上執(zhí)行
SQL>
shutdown immediate
節(jié)點(diǎn)
yang
2上執(zhí)行
SQL>
shutdown immediate
3.開啟歸檔模式
在yang1上執(zhí)行
SQL>
startup mount
SQL>alter database archivelog
Database altered.
SQL>
archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +RECOC1/yang/archivelog
Oldest online log sequence 48
Next log sequence to archive 50
Current log sequence 50
在節(jié)點(diǎn)一上修改成功。
節(jié)點(diǎn)yang2上執(zhí)行執(zhí)行
SQL>
startup mount
SQL>alter database archivelog
Database altered.
SQL>
archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination +RECOC1/yang/archivelog
Oldest online log sequence 53
Current log sequence 55
4.打開數(shù)據(jù)庫
節(jié)點(diǎn)yang1,yang2上分別執(zhí)行
SQL>
alter database open
5.驗(yàn)證歸檔文件成功生成在目標(biāo)位置
節(jié)點(diǎn)yang1上執(zhí)行
SQL>
alter system switch logfile;
System altered.
[oracle@yang1 ~]$
su - grid
[grid@yang1 ~]$
asmcmd
ASMCMD> cd yang/archivelog/2018_11_29
ASMCMD> pwd
+RECOC1/RISKDB/archivelog/2018_11_29
ASMCMD> ls
thread_1_seq_55.41248.993493281
thread_1_seq_56.41243.993493295
thread_2_seq_49.41922.993492943
thread_2_seq_50.40857.993493383
thread_2_seq_51.41798.993493589
可以使用同樣的方法驗(yàn)證節(jié)點(diǎn)是否成功。
按照此方法在節(jié)點(diǎn)yang2上執(zhí)行alter system switch logfile并且多切換幾次確定每次切換都有相對應(yīng)的歸檔日志生成.
說明一點(diǎn)關(guān)于歸檔的路徑問題:
如果在grid用戶下沒有設(shè)置歸檔的路徑
oracle用戶會把歸檔放在db_recovery_file_dest 會使用db_recovery_file_dest_size ,如果歸檔db_recovery_file_dest_size的大小滿了,數(shù)據(jù)庫會hang住。
db_recovery_file_dest string +RECOC1
db_recovery_file_dest_size big integer 5000000M