1.修改日志文件存放位置(或重命名)
1)查询日志状态
select * from v$log;
2)查询日志文件存放位置
select * from v$logfile;
3)找到日志状态为INACTIVE
创建重放的位置
从找到的的非INACTIVE的日志成员的路径,复制到新的位置
修改位置:
SQL> alter database rename file ‘原来日志文件’ to ‘新的日志文件’;
4)处于日志状态为CURRENT
切换日志文件,将日志文件切换到其他的日志组 alter system switch logfile
查询当前要管理的日志文件是否为INACTIVE状态select * from v$log;
修改位置:
SQL> alter database rename file ‘原来日志文件’ to ‘新的日志文件’;
5)改变的日志组成员很多为INVALID状态
执行几次切换日志组语句(alter system switch logfile)同步一下就好了。
例如:
1)查询日志状态
SQL> select GROUP#,STATUS from v$log;
GROUP# STATUS
---------- ----------------
1 CURRENT
2 INACTIVE
3 INACTIVE
2)查询日志文件存放位置
SQL> select GROUP#,MEMBER from v$logfile;
GROUP# MEMBER
---------- -----------------------------------------
1 /u01/app/oracle/oradata/orcl/redo01.log
2 /u01/app/oracle/oradata/orcl/redo02.log
3 /u01/app/oracle/oradata/orcl/redo03.log
3)找到日志状态为INACTIVE(即第2组和第3组可以修改,以第二组为例)
step1:创建重放的位置
mkdir -p /u04/ora11g/student
chown -R oracle:oinstall /u04/ora11g/student
chmod -R 777 /u04/ora11g/student
step2:复制文件到新的位置
$ cp /u01/app/oracle/oradata/orcl/redo02.log /u04/ora11g/student/redo0201.rdo
step3:修改位置:
SQL> alter database rename file '/u01/app/oracle/oradata/orcl/redo02.log' to
2 '/u04/ora11g/student/redo0201.rdo';
step4:查询
SQL> select GROUP#,MEMBER from v$logfile;
GROUP# MEMBER
---------- -----------------------------------------
1 /u01/app/oracle/oradata/orcl/redo01.log
2 /u04/ora11g/student/redo0201.rdo
3 /u01/app/oracle/oradata/orcl/redo03.log
4)修改处于CURRENT状态的日志文件
step1:创建重放的位置
mkdir -p /u03/ora11g/student
chown -R oracle:oinstall /u03/ora11g/student
chmod -R 777 /u03/ora11g/student
step2:复制文件到新的位置
$ cp /u01/app/oracle/oradata/orcl/redo01.log /u03/ora11g/student/redo0101.rdo
step3:切换日志文件
SQL>alter system switch logfile;
step4:查询日志状态
SQL> select GROUP#,STATUS from v$log;
GROUP# STATUS
---------- ----------------
1 INACTIVE
2 CURRENT
3 INACTIVE
step5:修改位置:
SQL> alter database rename file '/u01/app/oracle/oradata/orcl/redo01.log' to
2 '/u03/ora11g/student/redo0101.rdo';
step6:查询
SQL> select GROUP#,MEMBER from v$logfile;
GROUP# MEMBER
---------- -----------------------------------------
1 /u03/ora11g/student/redo0101.rdo
2 /u04/ora11g/student/redo0201.rdo
3 /u01/app/oracle/oradata/orcl/redo03.log