更改rac oracle归档日志路径

如果开启日志,默认的路径是db_recovery_file_dest,该目录空间有限,一旦占满,则数据库挂起

办法1:更改db_recovery_file_dest大小,虽然闪回恢复区ORACLE会自动管理,如果闪回恢复区空间不足就会清理掉没用的数据,显示没有从根被解决
其次,该目录一般受限制,当达到限时的
SQL> select name,SPACE_LIMIT,SPACE_USED from v$recovery_file_dest;
SQL> alter system set db_recovery_file_dest_size=3G;
SQL>show parameter db_recover ;

NAME                               TYPE         VALUE
--------------------------     --------     --------------------------------
db_recovery_file_dest     string      D:\oracle\flash_recovery_area        db_recovery_file_dest_size  big integer   3G

办法2:改变归档日志存储路径
root# mkdir arch
root# chmod 777 /arch
SQL> alter system set log_archive_dest_1='location=/arch';
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list

Database log mode                  Archive Mode
Automatic archival                    Enabled
Archive destination                   /arch
Oldest online log sequence     323
Next log sequence to archive   324
Current log sequence                324

SQL> show parameter log_archive_format

NAME                       TYPE            VALUE
----------------------   ------------  ------------
log_archive_format     string        ARC%S_%R.%T

SQL> alter system set log_archive_format='ARC%S_%R.%T_%D.log' scope=spfile;
%S也就是0000000326是日志切换号,也就是上文archive log list中的当前日志序列,%R是场景号,%T是线程号,
可以理解成是节点号,如果不是RAC环境,%T都是1,还可以在log_archive_format参数值中加上%D,%D是16进制标识的DBID

SQL> alter system set log_archive_format='ARC%S_%R.%T_%D.log' scope=spfile;
SQL> shutdown immediate
SQL> startup
SQL> alter system switch logfile;
root# cd /arch
root# ls

ARC0000000721_0947408800.0001_e84a5a60.log  ARC0000000724_0947408800.0001_e84a5a60.log
ARC0000000722_0947408800.0001_e84a5a60.log  ARC0000000725_0947408800.0001_e84a5a60.log
ARC0000000723_0947408800.0001_e84a5a60.log  ARC0000000726_0947408800.0001_e84a5a60.log

你可能感兴趣的:(更改rac oracle归档日志路径)