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