您好,登錄后才能下訂單哦!
配置本地歸檔
歸檔配置有兩種方式:一是聯機歸檔配置,數據庫服務器啟動情況下,使用SQL語句完成dmarch.ini和ARCH_INI配置;二是手動配置歸檔,數據庫服務器未啟動的情況下,手動編寫dmarch.ini文件和設置參數ARCH_INI。下面將分別說明這兩種歸檔如何配置。
聯機配置歸檔
使用SQL語句配置本地歸檔。語法如下:
ALTER DATABASE <ADD|MODIFY|DELETE> ARCHIVELOG <歸檔配置語句>;
<歸檔配置語句>::= 'DEST = <歸檔目標>,TYPE = <歸檔類型>'
<歸檔類型>::=<local方式>|<remote方式>
<local方式>::=LOCAL [,FILE_SIZE = <文件大小>][,SPACE_LIMIT = <空間大小限制>]
<remote方式>::=REMOTE [,FILE_SIZE = <文件大小>][,SPACE_LIMIT = <空間大小限制>],INCOMING_PATH = <歸檔存放路徑>
使用SQL語句開啟和關閉歸檔模式。
語法如下:
ALTER DATABASE ARCHIVELOG | NOARCHIVELOG;
在歸檔模式下,不允許刪除本地歸檔。
例如,RAC環境聯機歸檔配置如下:
1)修改數據庫為MOUNT狀態。
節點1:
SQL> alter database mount; executed successfully used time: 00:00:01.852. Execute id is 0.
節點2:
SQL> alter database mount; executed successfully used time: 00:00:01.853. Execute id is 0.
2)配置本地歸檔。
節點1:
SQL> alter database add archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0'; executed successfully used time: 3.110(ms). Execute id is 0.
節點2:
SQL> alter database add archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0'; executed successfully used time: 3.171(ms). Execute id is 0.
3)開啟歸檔模式。
節點1:
SQL> alter database archivelog; executed successfully used time: 11.986(ms). Execute id is 0.
節點2:
SQL> alter database archivelog; executed successfully used time: 11.780(ms). Execute id is 0.
4)修改數據庫為OPEN狀態。
節點1:
SQL> alter database open; executed successfully used time: 00:00:01.466. Execute id is 0.
節點2:
SQL> alter database open; executed successfully used time: 711.999(ms). Execute id is 0.
5)查看歸檔配置文件dmarch.ini
節點1:
[dmdba@dmrac1 rac0_config]$ pwd /dm7/data/rac0_config [dmdba@dmrac1 rac0_config]$ cat dmarch.ini #DaMeng Database Archive Configuration file #this is comments ARCH_WAIT_APPLY = 1 --性能模式,是否等待重演完成,取值0:高性能模式, 1:數據一致模式。本地歸檔取值NULL [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm7/data/local_arch ARCH_FILE_SIZE = 256 ARCH_SPACE_LIMIT = 0
節點2:
[dmdba@dmrac2 rac1_config]$ pwd /dm7/data/rac1_config [dmdba@dmrac2 rac1_config]$ cat dmarch.ini #DaMeng Database Archive Configuration file #this is comments ARCH_WAIT_APPLY = 1 --性能模式,是否等待重演完成,取值0:高性能模式, 1:數據一致模式。本地歸檔取值NULL [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm7/data/local_arch ARCH_FILE_SIZE = 256 ARCH_SPACE_LIMIT = 0
6)檢查ARCH_INI參數是否為1
節點1:
SQL> select * from v$dm_ini where para_name='ARCH_INI'; LINEID PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE ---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- --------- 1 ARCH_INI 1 0 1 N 1 1 dmarch.ini SYS used time: 30.251(ms). Execute id is 5.
節點2:
SQL> select * from v$dm_ini where para_name='ARCH_INI'; LINEID PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE ---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- --------- 1 ARCH_INI 1 0 1 N 1 1 dmarch.ini SYS used time: 29.498(ms). Execute id is 13.
禁用歸檔
1修改數據庫為MOUNT狀態。
節點1:
SQL> alter database mount; executed successfully used time: 00:00:01.858. Execute id is 0.
節點2:
SQL> alter database mount; executed successfully used time: 00:00:01.858. Execute id is 0.
2.禁用歸檔
節點1:
SQL> alter database noarchivelog; executed successfully used time: 42.916(ms). Execute id is 0.
節點2:
SQL> alter database noarchivelog; executed successfully used time: 42.533(ms). Execute id is 0.
3.刪除配置的本地歸檔設置
節點1:
SQL> alter database delete archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0'; executed successfully used time: 0.931(ms). Execute id is 0.
節點2:
SQL> alter database delete archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0'; executed successfully used time: 0.952(ms). Execute id is 0.
4.刪除之前生成的歸檔日志文件(可選項)
節點1:
SQL> sf_archivelog_delete_before_time(sysdate+1); DMSQL executed successfully used time: 2.907(ms). Execute id is 7.
節點2:
SQL> sf_archivelog_delete_before_time(sysdate+1); DMSQL executed successfully used time: 3.542(ms). Execute id is 16.
5.打開數據庫
節點1:
SQL> alter database open; executed successfully used time: 00:00:01.609. Execute id is 0.
節點2:
SQL> alter database open; executed successfully used time: 00:00:02.304. Execute id is 0.
6.檢查歸檔配置文件dmarch.ini的內容是否已經被刪除
節點1:
[dmdba@dmrac1 rac0_config]$ cat dmarch.ini #DaMeng Database Archive Configuration file #this is comments ARCH_WAIT_APPLY = 1 --性能模式,是否等待重演完成,取值0:高性能模式, 1:數據一致模式。本地歸檔取值NULL
節點2:
[dmdba@dmrac2 rac1_config]$ cat dmarch.ini #DaMeng Database Archive Configuration file #this is comments ARCH_WAIT_APPLY = 1 --性能模式,是否等待重演完成,取值0:高性能模式, 1:數據一致模式。本地歸檔取值NULL
7.檢查ARCH_INI參數是否為0
節點1:
SQL> select * from v$dm_ini where para_name='ARCH_INI'; LINEID PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE ---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- --------- 1 ARCH_INI 0 0 1 N 0 0 dmarch.ini SYS used time: 7.086(ms). Execute id is 8.
節點2:
SQL> select * from v$dm_ini where para_name='ARCH_INI'; LINEID PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE ---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- --------- 1 ARCH_INI 0 0 1 N 0 0 dmarch.ini SYS used time: 14.366(ms). Execute id is 18.
手動配置歸檔示例如下:
1)手動編輯dmarch.ini文件,之后保存在dm.ini所在的目錄。dmarch.ini文件內容如下:
[ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm7/data/local_arch ARCH_FILE_SIZE = 256 ARCH_SPACE_LIMIT = 0
2)編輯dm.ini文件,設置參數ARCH_INI=1,保存。
3)啟動服務器,服務器已運行于歸檔模式。
多路歸檔,指配置多個本地歸檔。配置的第一個歸檔,稱為第一路歸檔,后面依次是第二路、第三路......
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。