Oracle的数据库日志(redolog)的使用说明


Oracle的数据库日 志称为redo log,所有数据改变都记录redo log,可以用于修复受损的数据库。Redo日志是分组的,,默认是三组。Redo日志是轮流使用的,一个redo log满了,LGWR会切换到下一组redo log,这种操作称为log switch,做log switch的同时也会做checkpoint,相应的信息还会写入控制文件。
1.查看系统的redo log信息:
SQL> select group#,sequence#,bytes,members,status from v$log;

SQL> select member from v$logfile;

2.添加日志组
alter database add logfile group 4 ('D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo04.log') size 50m;

3.添加日志组(指定日志已经存在)
alter database add logfile group 4 ('D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo04.log') size 50m reuse;
4.添加日志成员
alter database add logfile member 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log' to group 4;

5.添加日志成员(指定日志已经存在)
alter database add logfile member 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log' reuse to group 4;
6.删除日志组
alter database drop logfile group 4;

7.删除日志成员
alter database drop logfile member 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log';

8.给日志组文件换一个位置
(1)shutdown database
(2) copy the online redo log files to the new location;
(3) start database to mount;
(4)execute the command
alter database rename file 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log' to 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log';
(5)open database
9.归档Redo log文件
启动日志归档有两个好处:


select A.tablespace_name, (1 - (A.total) / B.total) * 100 used_percent
from (select tablespace_name, sum(bytes) total
from dba_free_space
group by tablespace_name) A,
(select tablespace_name, sum(bytes) total
from dba_data_files
group by tablespace_name) B
where A.tablespace_name = B.tablespace_name;

2、查询表空间文件存放位置:
select tablespace_name, file_id, file_name,round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name;

3、以增加方式扩增表空间
alter tablespace SYSAUX add datafile 'E:\oracle11g\oradata\orcl\SYSAUX02.DBF' size 500M

alter tablespace SYSTEM add datafile 'D:\ORACLE\ORADATA\XKXXOA\SYSTEM04.DBF' size 3000M

alter tablespace "gtp-default" add datafile 'D:\ORACLE\PRODUCT\11.2.0\DBHOME_1\DATABASE\GTP-DEFAULT3.DBF' size 1500M

posted @ 2021-03-27 08:58  Coderlhx  阅读(2755)  评论(0编辑  收藏  举报