1)查看日志文件
1
2
3
4
5
6
7
|
sys@CISCOSYS> col member format a60
sys@CISCOSYS>
select
group
#,member,type
from
v$logfile;
GROUP
# MEMBER TYPE
---------- ------------------------------------------------------------ -------
3 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG ONLINE
2 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG ONLINE
1 D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG ONLINE
|
2)添加一个redologgroup,默认只有一个member
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
2.1 可以不使用括号
sys@CISCOSYS>
alter
database
add
logfile
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO04.LOG'
size
100m;
Database
altered.
2.2 使用括号
sys@CISCOSYS>
alter
database
add
logfile (
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO05.LOG'
)
size
100m;
Database
altered.
2.3 一次性添加多个member
CISCOSYS>
alter
database
add
logfile (
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO06-a.LOG'
,
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO06-b.LOG'
)
size
100m;
Database
altered.
2.3 新增1个
group
,并指定
group
号
sys@CISCOSYS>
alter
database
add
logfile
group
9
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO09.LOG'
size
100m;
Database
altered.
2.4 给一个现有的
group
添加member(不能指定
size
)
sys@CISCOSYS>
alter
database
add
logfile member
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO09-b.LOG'
to
group
9;
Database
altered.
2.5 在一个现有
group
,添加member
sys@CISCOSYS>
alter
database
add
logfile member
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO05-b.LOG'
to
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO05.LOG'
;
Database
altered.
|
3删除group
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
3.1 删除UNUSED的
group
sys@CISCOSYS>
alter
database
drop
logfile
group
9;
Database
altered.
sys@CISCOSYS>
select
group
#,
sequence
#,members,archived,status
from
v$log;
GROUP
#
SEQUENCE
# MEMBERS ARC STATUS
---------- ---------- ---------- --- ----------------
1 1 1
NO
CURRENT
2 0 1 YES UNUSED
3 0 1 YES UNUSED
4 0 1 YES UNUSED
5 0 2 YES UNUSED
6 0 2 YES UNUSED
3.2 删除unused
group
member
sys@CISCOSYS>
alter
database
drop
logfile member
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO06-B.LOG'
;
Database
altered.
多次执行
alter
system switch logfile;
test@CISCOSYS>
select
group
#,
sequence
#,members,archived,status
from
v$log;
GROUP
#
SEQUENCE
# MEMBERS ARC STATUS
---------- ---------- ---------- --- ----------------
1 7 1
NO
CURRENT
2 2 1 YES ACTIVE
3 3 1 YES ACTIVE
4 4 1 YES ACTIVE
5 5 2 YES ACTIVE
6 6 1 YES ACTIVE
6
rows
selected.
删除ACTIVE的
group
test@CISCOSYS>
alter
database
drop
logfile
group
6;
alter
database
drop
logfile
group
6
*
ERROR
at
line 1:
ORA-01624: log 6 needed
for
crash recovery
of
instance orcl (thread 1)
ORA-00312: online log 6 thread 1:
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO06-A.LOG'
test@CISCOSYS>
alter
system
checkpoint
;
System altered.
test@CISCOSYS>
select
group
#,
sequence
#,members,archived,status
from
v$log;
GROUP
#
SEQUENCE
# MEMBERS ARC STATUS
---------- ---------- ---------- --- ----------------
1 7 1
NO
CURRENT
2 2 1 YES INACTIVE
3 3 1 YES INACTIVE
4 4 1 YES INACTIVE
5 5 2 YES INACTIVE
6 6 1 YES INACTIVE
6
rows
selected.
由于active的 log
group
不能删除.所以 要先将其置于inactive
3.3 如果不小心删除了 ACTIVE的日志
sys@CISCOSYS>
alter
database
open
2 ;
alter
database
open
*
ERROR
at
line 1:
ORA-00313:
open
failed
for
members
of
log
group
1
of
thread 1
ORA-00312: online log 1 thread 1:
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG'
sys@CISCOSYS>
alter
database
clear unarchived logfile
group
1;
Database
altered.
sys@CISCOSYS>
alter
database
open
2 ;
|
selectcheckpoint_change#fromv$database;
selectname,checkpoint_change#fromv$datafile_header;
selectname,checkpoint_change#fromv$datafile;
selectname,last_change#fromv$datafile;
本文转自 randy_shandong 51CTO博客,原文链接:http://blog.51cto.com/dba10g/1302850,如需转载请自行联系原作者