ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 更改archive log 归档路径和归档文件名称

更改archive log 归档路径和归档文件名称

原创 Linux操作系统 作者:it_newbalance 时间:2011-07-01 16:02:37 0 删除 编辑

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oracle/product/dbs/arch
Oldest online log sequence     749
Next log sequence to archive   751
Current log sequence           751
SQL> show parameter archive

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
archive_lag_target                   integer                                   
0                                                                              
log_archive_config                   string                                    
                                                                               
log_archive_dest                     string                                    
                                                                               
log_archive_dest_1                   string                                    
                                                                               
log_archive_dest_10                  string                                    

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
                                                                               
log_archive_dest_2                   string                                    
                                                                               
log_archive_dest_3                   string                                    
                                                                               
log_archive_dest_4                   string                                    
                                                                               
log_archive_dest_5                   string                                    
                                                                               

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
log_archive_dest_6                   string                                    
                                                                               
log_archive_dest_7                   string                                    
                                                                               
log_archive_dest_8                   string                                    
                                                                               
log_archive_dest_9                   string                                    
                                                                               
log_archive_dest_state_1             string                                    

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
enable                                                                         
log_archive_dest_state_10            string                                    
enable                                                                         
log_archive_dest_state_2             string                                    
enable                                                                         
log_archive_dest_state_3             string                                    
enable                                                                         
log_archive_dest_state_4             string                                    
enable                                                                         

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
log_archive_dest_state_5             string                                    
enable                                                                         
log_archive_dest_state_6             string                                    
enable                                                                         
log_archive_dest_state_7             string                                    
enable                                                                         
log_archive_dest_state_8             string                                    
enable                                                                         
log_archive_dest_state_9             string                                    

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
enable                                                                         
log_archive_duplex_dest              string                                    
                                                                               
log_archive_format                   string                                    
ora_%t_%s_%r.arc                                                               
log_archive_local_first              boolean                                   
TRUE                                                                           
log_archive_max_processes            integer                                   
2                                                                              

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
log_archive_min_succeed_dest         integer                                   
1                                                                              
log_archive_start                    boolean                                   
FALSE                                                                          
log_archive_trace                    integer                                   
0                                                                              
remote_archive_enable                string                                    
true                                                                           
standby_archive_dest                 string                                    

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
?/dbs/arch                                                                     
SQL> alter system set log_archive_dest_1="location=/oratest/arch" scope=both;   

System altered.

SQL> show parameter log_archive_dest_1

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
log_archive_dest_1                   string                                    
location=/oratest/arch                                                         
log_archive_dest_10                  string                                    
                                                                               
SQL> alter system set log_archive_format="oratest_%t_%S_%r.arc" scope=both;
alter system set log_archive_format="oratest_%t_%S_%r.arc" scope=both
                 *
ERROR at line 1:   
ORA-02095: specified initialization parameter cannot be modified

//不可修改内存中的参数,只可修改spfile中的,重启数据库生效


SQL> alter system set log_archive_format="oratest_%t_%S_%r.arc" scope=spfile;

System altered.
SQL> show parameter log_archive_format

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
log_archive_format                   string                                    
ora_%t_%s_%r.arc                                                               
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  591396864 bytes                                      
Fixed Size                  2022536 bytes                                      
Variable Size             159384440 bytes                                      
Database Buffers          423624704 bytes                                      
Redo Buffers                6365184 bytes                                      
Database mounted.
Database opened.
SQL> show parameter log_archive_format

NAME                                 TYPE                                      
------------------------------------ ----------------------                    
VALUE                                                                          
------------------------------                                                 
log_archive_format                   string                                    
oratest_%t_%S_%r.arc              

// t 是thread 的意思,通常单实例模式的为 1 ,RAC模式的会有多个情况

// S 指序列号,有固定长度的,不足的将前补0,s没有固定长度,按顺序显示                                             
SQL> alter system switch logfile;

System altered.

//切换redo log 从一个组到另一个组,这时将触发checkpoint,归档

SQL> alter system switch logfile;

System altered.

SQL> !ls -l /oratest/arch

SQL> archive log list
Database log mode              Archive Mode   //归档和非归档模式
Automatic archival             Enabled                //显示是自动还是手动
Archive destination            /oratest/arch         //归档目录,已修改。有多个时只显示一个,dest_1的
Oldest online log sequence     751               //已经归档的sequence 号
Next log sequence to archive   753               // 即将要归档的sequence 号
Current log sequence           753                    // 当前的sequence 号
SQL> spool off

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24558279/viewspace-701139/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-03-28

  • 博文量
    143
  • 访问量
    705062