oracle 9i資料庫夯住無法歸檔

tian1982tian發表於2012-09-19
oracle 9i資料庫,在庫裡插入資料夯住,用spotlight監控redo無法歸檔,
在資料庫裡:SQL> alter system switch logfile;命令發出之後一小時
甚至更長時間夯住不動
[oracle@oracle9ivm ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Sep 19 09:59:35 2011
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Disabled
Archive destination            /u01/oracle/dbs/arch
Oldest online log sequence     148
Next log sequence to archive   148
Current log sequence           150
SQL> show parameter archive
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target                   integer     0
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_9                   string
log_archive_dest_state_1             string      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
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      enable
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_duplex_dest              string
log_archive_format                   string      %t_%s.dbf
log_archive_max_processes            integer     2
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      ?/dbs/arch
經檢視:Automatic archival 為 Disabled
        歸檔路徑為預設路徑
以下試圖啟用歸檔:
SQL> alter system set log_archive_start=true;
alter system set log_archive_start=true
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

SQL> alter system set log_archive_start=true scop=spfile;
alter system set log_archive_start=true scop=spfile
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Disabled
Archive destination            /u01/oracle/dbs/arch
Oldest online log sequence     148
Next log sequence to archive   148
Current log sequence           150
SQL> show parameter archive
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target                   integer     0
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_9                   string
log_archive_dest_state_1             string      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
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      enable
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_duplex_dest              string
log_archive_format                   string      %t_%s.dbf
log_archive_max_processes            integer     2
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      ?/dbs/arch
SQL> alter database archivelog;
Database altered.
SQL> alter system set log_archive_dest_1='LOCTION=/u01/oradata/ora10g/arch';
alter system set log_archive_dest_1='LOCTION=/u01/oradata/ora10g/arch'
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE

SQL> alter database open;
Database altered.
SQL> alter system set log_archive_dest_1='LOCATION=/u01/oradata/ora10g/arch';
System altered.
SQL>  show parameter archive
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target                   integer     0
log_archive_dest                     string
log_archive_dest_1                   string      LOCATION=/u01/oradata/ora10g/a
                                                 rch
log_archive_dest_10                  string
log_archive_dest_2                   string
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_8                   string
log_archive_dest_9                   string
log_archive_dest_state_1             string      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
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
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_9             string      enable
log_archive_duplex_dest              string
log_archive_format                   string      %t_%s.dbf
log_archive_max_processes            integer     2
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      ?/dbs/arch
SQL>
SQL>
SQL> SET linesize 400
SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1        149  104857600          1 NO  INACTIVE               5698651 19-SEP-11
         2          1        150  104857600          1 NO  CURRENT                5719360 19-SEP-11
         3          1        148  104857600          1 NO  INACTIVE               5667386 19-SEP-11
SQL> alter system switch logfile;
alter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Disabled
Archive destination            /u01/oradata/ora10g/arch
Oldest online log sequence     148
Next log sequence to archive   148
Current log sequence           150
SQL> alter system set log_archive_start=true;
alter system set log_archive_start=true
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

SQL> alter system set log_archive_start=true scope=both;
alter system set log_archive_start=true scope=both
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
將log_archive_start 值由 FALSE 修改為true寫入spfile,重啟動資料庫生效
SQL> alter system set log_archive_start=true scope=spfile;
System altered.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Disabled
Archive destination            /u01/oradata/ora10g/arch
Oldest online log sequence     148
Next log sequence to archive   148
Current log sequence           150
SQL> shutdown immediaet;
SP2-0717: illegal SHUTDOWN option
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1        149  104857600          1 YES INACTIVE               5698651 19-SEP-11
         2          1        150  104857600          1 NO  CURRENT                5719360 19-SEP-11
         3          1        148  104857600          1 YES INACTIVE               5667386 19-SEP-11
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oradata/ora10g/arch
Oldest online log sequence     148
Next log sequence to archive   150
Current log sequence           150
SQL> alter system switch logfile;
System altered.
SQL>  select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1        149  104857600          1 YES INACTIVE               5698651 19-SEP-11
         2          1        150  104857600          1 YES ACTIVE                 5719360 19-SEP-11
         3          1        151  104857600          1 NO  CURRENT                5753805 19-SEP-11
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
Session altered.
SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
         1          1        149  104857600          1 YES INACTIVE               5698651 2011-09-19 06:19:08
         2          1        150  104857600          1 YES ACTIVE                 5719360 2011-09-19 06:21:01
         3          1        151  104857600          1 NO  CURRENT                5753805 2011-09-19 10:11:50
SQL> alter system switch logfile;
System altered.
SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
         1          1        152  104857600          1 NO  CURRENT                5753971 2011-09-19 10:12:56
         2          1        150  104857600          1 YES INACTIVE               5719360 2011-09-19 06:21:01
         3          1        151  104857600          1 YES ACTIVE                 5753805 2011-09-19 10:11:50
SQL> alter system switch logfile;
System altered.
SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
         1          1        152  104857600          1 YES ACTIVE                 5753971 2011-09-19 10:12:56
         2          1        153  104857600          1 NO  CURRENT                5754053 2011-09-19 10:13:31
         3          1        151  104857600          1 YES INACTIVE               5753805 2011-09-19 10:11:50
SQL>
至此,redo 日誌可以正常的歸檔了,且用spotlight觀察也不會再出現警告了

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16400082/viewspace-744235/,如需轉載,請註明出處,否則將追究法律責任。

相關文章