更多相关信息,参见Oracle官方文档:
忠告:
查询logfile相关信息:
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER ---------- ------- ------- -------------------------------------------------- 3 ONLINE /u01/app/oracle/oradata/knitter/redo03.log 2 ONLINE /u01/app/oracle/oradata/knitter/redo02.log 1 ONLINE /u01/app/oracle/oradata/knitter/redo01.log 4 ONLINE /u01/app/oracle/oradata/knitter/redo04.rdo 4 INVALID ONLINE /u01/app/oracle/oradata/knitter/redo04_02.rdo
SQL> SELECT GROUP#, ARCHIVED, STATUS FROM V$LOG;
GROUP# ARC STATUS ---------- --- ---------------- 1 NO CURRENT 2 YES INACTIVE 3 YES INACTIVE 4 YES INACTIVE
SQL> select * from V$LOG_HISTORY;
RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# ---------- ---------- ---------- ---------- ------------- --------- ------------ 1 716304893 1 1 158900 01-APR-10 260498 2 716317218 1 2 260498 14-APR-10 296893 3 716317260 1 3 296893 14-APR-10 296990 4 716319163 1 4 296990 14-APR-10 303247 5 716319176 1 5 303247 14-APR-10 303252 6 716384800 1 6 303252 14-APR-10 332583 7 716384854 1 7 332583 15-APR-10 332775 8 716384882 1 8 332775 15-APR-10 332881 9 716384892 1 9 332881 15-APR-10 332889
============================================================================================
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/dbs/log2b.rdo' TO GROUP 2;
ALTER DATABASE ADD LOGFILE MEMBER '/u01/app/oracle/oradata/knitter/redo05_3.rdo', '/u01/app/oracle/oradata/knitter/redo05_4.rdo' TO GROUP 5;
ALTER DATABASE ADD LOGFILE MEMBER '/oracle/dbs/log2c.rdo'
说明: 在增加组成员的时候, 不能指定logfile文件大小,因为同一组(logGroup)中所有member文件是完全一样的(大小、内容),Oracle将自动根据已有组员确定其大小。如果指定了大小,将会出错,如: SQL> alter database add logfile member '/oracle/dbs/log1f.rdo' size 100k to group 5; alter database add logfile member '/oracle/dbs/log1f.rdo' size 100k to group 5 * ERROR at line 1: ORA-00946: missing TO keyword
前提条件:
ALTER SYSTEM SWITCH LOGFILE; 然后通过如下语句查询,确保待操作组不为active或current状态: SELECT GROUP#, ARCHIVED, STATUS FROM V$LOG;
ALTER DATABASE DROP LOGFILE MEMBER '/oracle/dbs/log3c.rdo';
说明:
还应该使用操作系统删除指令,删除硬盘上相应的日志文件
前提条件:
ALTER SYSTEM SWITCH LOGFILE; 然后通过如下语句查询,确保待操作组不为active或current状态: SELECT GROUP#, ARCHIVED, STATUS FROM V$LOG;
ALTER DATABASE DROP LOGFILE GROUP 3;
说明:
还应该使用操作系统删除指令,删除硬盘上相应的日志文件
说明:
还应该使用操作系统删除指令,删除硬盘上相应的日志文件
增加一个新的日志组成员,删除原有组成员, 以达到移动和重命名的效果
SQL> shutdown;
SQL> startup mount;
ALTER DATABASE
SQL> alter database open;
忠告: 在清空未归档日志文件前,进行数据库完全备份
使用场景: 日志文件无法Drop, 常见有如下情况
指令:
ALTER DATABASE CLEAR LOGFILE GROUP 3;
ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 3; |
没有评论:
发表评论