修改歸檔模式的通用步驟(非RAC 資料庫)

zhulch發表於2007-05-15
操作記錄如下[@more@]


- 檢視當前資料庫的日誌模式
1* select name,log_mode from v$database
SYS on 15-MAY-07 at testdb>/
TESTDB NOARCHIVELOG

- 正常關閉資料庫
SYS on 15-MAY-07 at testdb>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

- 啟動到資料庫到 MOUNT 狀態
SYS on 15-MAY-07 at testdb>startup mount
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2073096 bytes
Variable Size 234884600 bytes
Database Buffers 356515840 bytes
Redo Buffers 6311936 bytes
Database mounted.
- 修改資料庫歸檔模式
SYS on 15-MAY-07 at testdb>alter database archivelog;

Database altered.

- 開啟資料庫
SYS on 15-MAY-07 at testdb>alter database open;

Database altered.

- 顯示歸檔資訊
SYS on 15-MAY-07 at testdb>archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 41
Next log sequence to archive 43
Current log sequence 43

- 檢視是否用的SPFILE
SYS on 15-MAY-07 at testdb>show parameter spfile
spfile string /oradev2/app/oracle/product/10
.2.0/dbs/spfiletestdb.ora


1* alter system set log_archive_dest_1='location=/testdata/arch' scope=spfile
SYS on 15-MAY-07 at testdb>/

System altered.

- 檢視ARCHIVE 並沒有生效
SYS on 15-MAY-07 at testdb>show parameter arch
archive_lag_target integer 0
log_archive_config string
log_archive_dest string
log_archive_dest_1 string
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.dbf
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
remote_archive_enable string true
standby_archive_dest string ?/dbs/arch

- 關閉資料庫
SYS on 15-MAY-07 at testdb>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-啟動資料庫
SYS on 15-MAY-07 at testdb>startup
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2073096 bytes
Variable Size 234884600 bytes
Database Buffers 356515840 bytes
Redo Buffers 6311936 bytes
Database mounted.
Database opened.

- 檢視ARCH 引數
SYS on 15-MAY-07 at testdb>show parameter arch
archive_lag_target integer 0
log_archive_config string
log_archive_dest string
log_archive_dest_1 string location=/testdata/arch
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.dbf
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
remote_archive_enable string true
standby_archive_dest string ?/dbs/arch

- 手動切換日誌一次
SYS on 15-MAY-07 at testdb>alter system switch logfile;

System altered.

- 顯示 歸檔日誌資訊

SYS on 15-MAY-07 at testdb>archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /testdata/arch
Oldest online log sequence 42
Next log sequence to archive 44
Current log sequence 44

- 檢視資料庫的日誌模式
SYS on 15-MAY-07 at testdb>select name,log_mode from v$database;
TESTDB ARCHIVELOG

- 檢視歸檔日誌資訊
SYS on 15-MAY-07 at testdb>col name format a40
SYS on 15-MAY-07 at testdb>select name,sequence#,first_change# from v$archived_l
og;
/testdata/arch/1_43_620836561.dbf 43 1932379
- 檢視歸檔目錄位置
SYS on 15-MAY-07 at testdb>col dest_name format a20
SYS on 15-MAY-07 at testdb>col destination format a20
SYS on 15-MAY-07 at testdb>select dest_name,destination,status from v$archive_de
st;
LOG_ARCHIVE_DEST_1 /testdata/arch VALID
LOG_ARCHIVE_DEST_2 INACTIVE
LOG_ARCHIVE_DEST_3 INACTIVE
LOG_ARCHIVE_DEST_4 INACTIVE
LOG_ARCHIVE_DEST_5 INACTIVE
LOG_ARCHIVE_DEST_6 INACTIVE
LOG_ARCHIVE_DEST_7 INACTIVE
LOG_ARCHIVE_DEST_8 INACTIVE
LOG_ARCHIVE_DEST_9 INACTIVE
LOG_ARCHIVE_DEST_10 INACTIVE

10 rows selected.

- 顯示日子歷史記錄
SYS on 15-MAY-07 at testdb>select * from v$log_history;
1 620836661 1 1 565658 25-APR-07 599847
565658 25-APR-07
2 620836676 1 2 599847 25-APR-07 605539
565658 25-APR-07
3 620863236 1 3 605539 25-APR-07 635641
565658 25-APR-07
4 620892186 1 4 635641 25-APR-07 666830
565658 25-APR-07
5 620941861 1 5 666830 26-APR-07 708709
565658 25-APR-07
6 620959555 1 6 708709 26-APR-07 729048
565658 25-APR-07
7 621009181 1 7 729048 27-APR-07 768753
565658 25-APR-07
8 621039642 1 8 768753 27-APR-07 798367
565658 25-APR-07
9 621072031 1 9 798367 27-APR-07 828115
565658 25-APR-07
10 621118815 1 10 828115 28-APR-07 866550
565658 25-APR-07
11 621165642 1 11 866550 28-APR-07 904786
565658 25-APR-07
12 621212413 1 12 904786 29-APR-07 942643
565658 25-APR-07
13 621261184 1 13 942643 29-APR-07 981120
565658 25-APR-07
14 621295233 1 14 981120 30-APR-07 1011126
565658 25-APR-07
15 621417949 1 15 1011126 30-APR-07 1044165
565658 25-APR-07
16 621468001 1 16 1044165 01-MAY-07 1084169
565658 25-APR-07
17 621492357 1 17 1084169 01-MAY-07 1109293
565658 25-APR-07
18 621540033 1 18 1109293 02-MAY-07 1148185
565658 25-APR-07
19 621558037 1 19 1148185 02-MAY-07 1168622
565658 25-APR-07
20 621606148 1 20 1168622 02-MAY-07 1207997
565658 25-APR-07
21 621640821 1 21 1207997 03-MAY-07 1238686
565658 25-APR-07
22 621666590 1 22 1238686 03-MAY-07 1263378
565658 25-APR-07
23 621714060 1 23 1263378 04-MAY-07 1302567
565658 25-APR-07
24 621727829 1 24 1302567 04-MAY-07 1319791
565658 25-APR-07
25 621756027 1 25 1319791 04-MAY-07 1346348
565658 25-APR-07
26 621797850 1 26 1346348 05-MAY-07 1381525
565658 25-APR-07
27 621833581 1 27 1381525 05-MAY-07 1413006
565658 25-APR-07
28 621879541 1 28 1413006 06-MAY-07 1450435
565658 25-APR-07
29 621925386 1 29 1450435 06-MAY-07 1488191
565658 25-APR-07
30 622064150 1 30 1488191 07-MAY-07 1515599
565658 25-APR-07
31 622105254 1 31 1515599 08-MAY-07 1546308
565658 25-APR-07
32 622159221 1 32 1546308 09-MAY-07 1580374
565658 25-APR-07
33 622241123 1 33 1580374 09-MAY-07 1629494
565658 25-APR-07
34 622278899 1 34 1629494 10-MAY-07 1656657
565658 25-APR-07
35 622332022 1 35 1656657 11-MAY-07 1703869
565658 25-APR-07
36 622390604 1 36 1703869 11-MAY-07 1741972
565658 25-APR-07
37 622471046 1 37 1741972 12-MAY-07 1790059
565658 25-APR-07
38 622555203 1 38 1790059 13-MAY-07 1838733
565658 25-APR-07
39 622569550 1 39 1838733 14-MAY-07 1861718
565658 25-APR-07
40 622591249 1 40 1861718 14-MAY-07 1880369
565658 25-APR-07
41 622638046 1 41 1880369 14-MAY-07 1910895
565658 25-APR-07
42 622638660 1 42 1910895 15-MAY-07 1932379
565658 25-APR-07
43 622639353 1 43 1932379 15-MAY-07 1933429
565658 25-APR-07

43 rows selected.

SYS on 15-MAY-07 at testdb>select * from v$loghist;
1 1 565658 25-APR-07 599847
1 2 599847 25-APR-07 605539
1 3 605539 25-APR-07 635641
1 4 635641 25-APR-07 666830
1 5 666830 26-APR-07 708709
1 6 708709 26-APR-07 729048
1 7 729048 27-APR-07 768753
1 8 768753 27-APR-07 798367
1 9 798367 27-APR-07 828115
1 10 828115 28-APR-07 866550
1 11 866550 28-APR-07 904786
1 12 904786 29-APR-07 942643
1 13 942643 29-APR-07 981120
1 14 981120 30-APR-07 1011126
1 15 1011126 30-APR-07 1044165
1 16 1044165 01-MAY-07 1084169
1 17 1084169 01-MAY-07 1109293
1 18 1109293 02-MAY-07 1148185
1 19 1148185 02-MAY-07 1168622
1 20 1168622 02-MAY-07 1207997
1 21 1207997 03-MAY-07 1238686
1 22 1238686 03-MAY-07 1263378
1 23 1263378 04-MAY-07 1302567
1 24 1302567 04-MAY-07 1319791
1 25 1319791 04-MAY-07 1346348
1 26 1346348 05-MAY-07 1381525
1 27 1381525 05-MAY-07 1413006
1 28 1413006 06-MAY-07 1450435
1 29 1450435 06-MAY-07 1488191
1 30 1488191 07-MAY-07 1515599
1 31 1515599 08-MAY-07 1546308
1 32 1546308 09-MAY-07 1580374
1 33 1580374 09-MAY-07 1629494
1 34 1629494 10-MAY-07 1656657
1 35 1656657 11-MAY-07 1703869
1 36 1703869 11-MAY-07 1741972
1 37 1741972 12-MAY-07 1790059
1 38 1790059 13-MAY-07 1838733
1 39 1838733 14-MAY-07 1861718
1 40 1861718 14-MAY-07 1880369
1 41 1880369 14-MAY-07 1910895
1 42 1910895 15-MAY-07 1932379
1 43 1932379 15-MAY-07 1933429

43 rows selected.

- 顯示歸檔程式資訊
SYS on 15-MAY-07 at testdb>select * from v$archive_processes;
0 ACTIVE 0 IDLE
1 ACTIVE 0 IDLE
2 STOPPED 0 IDLE
3 STOPPED 0 IDLE
4 STOPPED 0 IDLE
5 STOPPED 0 IDLE
6 STOPPED 0 IDLE
7 STOPPED 0 IDLE
8 STOPPED 0 IDLE
9 STOPPED 0 IDLE
10 STOPPED 0 IDLE
11 STOPPED 0 IDLE
12 STOPPED 0 IDLE
13 STOPPED 0 IDLE
14 STOPPED 0 IDLE
15 STOPPED 0 IDLE
16 STOPPED 0 IDLE
17 STOPPED 0 IDLE
18 STOPPED 0 IDLE
19 STOPPED 0 IDLE
20 STOPPED 0 IDLE
21 STOPPED 0 IDLE
22 STOPPED 0 IDLE
23 STOPPED 0 IDLE
24 STOPPED 0 IDLE
25 STOPPED 0 IDLE
26 STOPPED 0 IDLE
27 STOPPED 0 IDLE
28 STOPPED 0 IDLE
29 STOPPED 0 IDLE

30 rows selected.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7318139/viewspace-915065/,如需轉載,請註明出處,否則將追究法律責任。

相關文章