1. 程式人生 > >手動啟動數據庫歸檔

手動啟動數據庫歸檔

oracle 歸檔

-查看實例進程看是否有歸檔的進程
[[email protected] ~]$ ps -ef | grep PROD4

SQL> archive log list;
Database log mode       No Archive Mode
Automatic archival       Disabled
Archive destination      /u01/app/oracle/product/11.2.0/db_1/dbs/archOldest online log sequence     6
Current log sequence       8

sql> show parameter log_archive

--在mount狀態下做
--關閉數據庫
SQL> shutdown immediate        ---必須是immediate 一至性關閉數據庫
SQL> startup mount

SQL> alter system set log_archive_dest_1=‘location=/home/oracle/arch‘;  ---目錄提前創建好

SQL> alter database archivelog;
Database altered.

SQL> alter database open;
Database altered.

SQL> archive log list;
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination       /home/oracle/arch
Oldest online log sequence     6
Next log sequence to archive   8
Current log sequence       8

--生成歸檔(需要切redo日誌)
QL> select group#,member from v$logfile;
    GROUP#
----------
MEMBER
-----------------------------------------------------------------------------
 3
/u01/app/oracle/oradata/PROD4/PROD4/redo03.log
 2
/u01/app/oracle/oradata/PROD4/PROD4/redo02.log
 1
/u01/app/oracle/oradata/PROD4/PROD4/redo01.log

SQL> select group#,status from v$log;
    GROUP# STATUS
---------- ----------------
 1 INACTIVE
 2 CURRENT
 3 INACTIVE

 --切redo
SQL> alter system switch logfile;
System altered.

SQL> select group#,status from v$log;
   GROUP# STATUS
---------- ----------------
 1 INACTIVE
 2 INACTIVE
 3 CURRENT
--三種狀態  current :當前用的
            active   :正在歸檔時的狀態,
            inactive:歸檔完畢,不用的狀態

 --查看歸檔目錄下生成的歸檔文件
[[email protected]
/* */ ~]$ ls /home/oracle/arch/ 1_8_861102502.dbf [[email protected] ~]$ ps -ef | grep PROD4 oracle 8551 1 0 10:29 ? 00:00:00 ora_arc0_PROD4 oracle 8554 1 0 10:29 ? 00:00:00 ora_arc1_PROD4 oracle 8556 1 0 10:29 ? 00:00:00 ora_arc2_PROD4 oracle 8558 1 0 10:29 ? 00:00:00 ora_arc3_PROD4

本文出自 “yangwang” 博客,請務必保留此出處http://yangwang.blog.51cto.com/10855137/1943766

手動啟動數據庫歸檔