oracle資料庫修改歸檔模式
阿新 • • 發佈:2021-01-16
oracle資料庫修改歸檔模式
標籤(空格分隔): oracle
##檢視歸檔模式
su - oracle
sqlplus / as as sysdba
archive log list;
##檢視日誌產生頻率
select a.recid,to_char(a.first_time,'yyyy-mm-dd hh24:mi:ss') begin_time,
b.recid,to_char(b.first_time,'yyyy-mm-dd hh24:mi:ss') end_time,
round((b.first_time - a.first_time) *24*60,2) minutes
from v$log_history a,v$log_history b
where b.recid = a.recid+1 and to_char(a.first_time,'yyyy-mm-dd hh24:mi:ss') >=to_char(sysdate-10,'yyyy-mm-dd hh24:mi:ss') ;
##檢視歸檔目錄大小
###ASM磁碟組大小及剩餘空間
set lines 150 pages 200
col path for a40
col HEADER_STATUS for a9
col disk_name for a12
col type for a16
col bytes for 999,999,999,999
col name for a52
col name2 for a15
col group_number heading 'Group|_NO' format 99
col file_number heading 'FILE|NO' format 9999
col redundancy format a6 noprint
col striped format a6 noprint
col FAILGROUP for a10
col disk_number heading 'Disk|_NO' format 9999
col MOUNT_STATUS heading 'Mount|_Status'
col FAILGROUP heading 'FAIL|_GROUP'
col TOTAL_MB heading 'Total|_MB' format 99,999,999
select name name2,state,type,free_mb/1024 free_G,total_mb/1024 free_G,
usable_file_mb/1024 usable_file_G from v$asm_diskgroup;
###本地儲存大小
linux : df -h
AIX: df -g
unix: bdf
##操作步驟:
1、切換到oracle使用者下,並切換到正確例項:
su - oracle
sqlplus / as sysdba
2、備份spfile檔案
create pfile='/home/oracle/pfile20181213.ora' from spfile;
3、重啟資料庫,開啟/關閉歸檔模式(rac兩個節點均關閉,使用一個節點修改,修改完成後啟動另一個節點)
shutdown immediate;
startup mount;
4、修改歸檔路徑
alter system set log_archive_dest_1 = 'LOCATION=/backup';
5、開啟歸檔模式:
alter database archivelog;
6、啟動資料庫:
alter database open;
7、檢查是否開啟成功:
archive log list;
8、切換日誌,檢視歸檔目錄下產生歸檔檔案
alter system switch logfile;