<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        歸檔日志管理

        來源:懂視網 責編:小采 時間:2020-11-09 15:46:19
        文檔

        歸檔日志管理

        歸檔日志管理:數據環境: SQL select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.
        推薦度:
        導讀歸檔日志管理:數據環境: SQL select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.

        數據環境: SQL select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CO

        數據環境:
        SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production 
        1. 歸檔日志概念
        什么是歸檔重做日志:An archived redo log file is a copy of one of the filled members of a redo log group. It includes the redo entries and the unique log sequence number of the identical member of the redo log group. For example, if you are multiplexing your redo log, and if group 1 contains identical member files a_log1 andb_log1, then the archiver process (ARCn) will archive one of these member files. Should a_log1 become corrupted, then ARCn can still archive the identical b_log1. The archived redo log contains a copy of every group created since you enabled archiving.歸檔重做日志:就是在歸檔模式下,對非活動重做日志進行備份。有后臺ARCn進程進行歸檔備份
        [oracle@localhost orcl]$ ps -ef|grep arcoracle 3835 1 0 01:26 ? 00:00:01 ora_arc0_orcloracle 3837 1 0 01:26 ? 00:00:01 ora_arc1_orcloracle 3839 1 0 01:26 ? 00:00:01 ora_arc2_orcloracle 3841 1 0 01:26 ? 00:00:00 ora_arc3_orcl
        2. 歸檔和非歸檔模式切換
        
        模式切換需要在mount狀態才可切換
        SQL> startup mount;
        SQL> archive log list;
        
        Database log mode	 Archive Mode
        
        Automatic archival	 Enabled
        
        Archive destination	 USE_DB_RECOVERY_FILE_DEST
        
        Oldest online log sequence 92
        
        Next log sequence to archive 94
        
        Current log sequence	 94
        歸檔模式切換到非歸檔模式:
        SQL> alter database noarchivelog;
        Database altered.
        
        SQL> archive log list;
        
        Database log mode	 No Archive Mode
        
        Automatic archival	 Disabled
        
        Archive destination	 USE_DB_RECOVERY_FILE_DEST
        
        Oldest online log sequence 92
        
        Current log sequence	 94
        非歸檔模式切換到歸檔模式:
        SQL> alter database archivelog;
        
        Database altered.
        
        SQL> archive log list;
        
        Database log mode	 Archive Mode
        
        Automatic archival	 Enabled
        
        Archive destination	 USE_DB_RECOVERY_FILE_DEST
        
        Oldest online log sequence 93
        
        Next log sequence to archive 95
        
        Current log sequence	 95
        如果非歸檔模式切換到歸檔模式,報ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
        SQL> alter database archivelog;
        
        alter database archivelog
        
        *
        
        ERROR at line 1:
        
        ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
        錯誤原因:在非歸檔模式下,直接用shutdown abort關閉數據,導致ora-00265錯誤
        解決方法:把數據啟動到open狀態,然后shutdown immediate關閉數據,重新把數據庫啟動mount狀態
        3. 配置歸檔進程
        
        oracle 11g 默認歸檔進程是4
        SQL> show parameter log_archive_max_processes;
        
        NAME	 TYPE	 VALUE
        
        ------------------------------------ ----------- ------------------------------
        
        log_archive_max_processes	 integer	 4
        后臺進程:
        [oracle@localhost ~]$ ps -ef|grep arc
        
        oracle 9164 1 0 17:12 ? 00:00:00 ora_arc0_orcl
        
        oracle 9166 1 1 17:12 ? 00:00:00 ora_arc1_orcl
        
        oracle 9168 1 1 17:12 ? 00:00:00 ora_arc2_orcl
        
        oracle 9170 1 1 17:12 ? 00:00:00 ora_arc3_orcl
        
        修改歸檔進程數量:
        例如開啟10個歸檔進程
        SQL> alter system set log_archive_max_processes=10;
        System altered.
        
        SQL> show parameter log_archive_max_processes;
        
        NAME	 TYPE	 VALUE
        
        ------------------------------------ ----------- ------------------------------
        
        log_archive_max_processes	 integer	 10
        [oracle@localhost ~]$ ps -ef|grep arc
        
        oracle 9164 1 0 17:12 ? 00:00:00 ora_arc0_orcl
        
        oracle 9166 1 0 17:12 ? 00:00:00 ora_arc1_orcl
        
        oracle 9168 1 0 17:12 ? 00:00:00 ora_arc2_orcl
        
        oracle 9170 1 0 17:12 ? 00:00:00 ora_arc3_orcl
        
        oracle 9198 1 0 17:16 ? 00:00:00 ora_arc4_orcl
        
        oracle 9200 1 0 17:16 ? 00:00:00 ora_arc5_orcl
        
        oracle 9202 1 0 17:16 ? 00:00:00 ora_arc6_orcl
        
        oracle 9204 1 0 17:16 ? 00:00:00 ora_arc7_orcl
        
        oracle 9206 1 0 17:16 ? 00:00:00 ora_arc8_orcl
        
        oracle 9208 1 0 17:16 ? 00:00:00 ora_arc9_orcl
        4 配置歸檔文件格式
        默認格式:%t_%s_%r.arc
        SQL> show parameter log_archive_format;
        
        NAME	 TYPE	 VALUE
        
        ------------------------------------ ----------- ------------------------------
        
        log_archive_format	 string	 %t_%s_%r.dbf
        修改歸檔文件格式,修改完成以后需要重啟數據庫才會生效
        SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
        
        System altered.
        log_archive_format參數說明:
        (歸檔文件格式必須包含以下幾個參數:%s, %t and %r,否則啟動數據庫會報錯
        SQL> startup open;
        
        ORA-19905: log_archive_format must contain %s, %t and %r
        %s log sequence number

        %S log sequence number, zero filled

        %t thread number

        %T thread number, zero filled

        %a activation ID

        %d database ID

        %r resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database

        5. 修改歸檔文件目錄
        歸檔日志存默認路徑:受DB_RECOVERY_FILE_DEST參數控制
        SQL> select dest_id,dest_name,destination from v$archive_dest;
        
         DEST_ID DEST_NAME	DESTINATION
        
        ---------- -------------------- --------------------------------------------------
        
        	 1 LOG_ARCHIVE_DEST_1	USE_DB_RECOVERY_FILE_DEST
        SQL> show parameter db_recovery_file_dest;
        
        
        NAME	 TYPE	 VALUE
        
        ------------------------------------ ----------- ------------------------------
        
        db_recovery_file_dest	 string	 /home/oracle/app/oracle/flash_
        
        	 recovery_area
        語法:alter system set log_archive_dest_n='location=文件路徑' scope=spfile
        說明:a.文件存放路徑必須本地需要用location指定,遠程需要service指定,另外重啟數據庫才會生效。
        配置遠程歸檔位置時,SERVICE選項需要指定遠程數據庫的網絡服務名(在tnsnames.ora文件中配置)
         b. 初始化參數LOG_ARCHIVE_DEST_n 不能與初始化參數LOG_ARCHIVE_DEST和LOG_ARCHIVE_DUPLEX_DEST同時使用.
         (oracle官方文檔說明:如果是企業,將不在推薦使用log_archive_duplex_dest參數
         If you are using Oracle Enterprise Edition, this parameter is deprecated in favor of the LOG_ARCHIVE_DEST_n parameters.
         If Oracle Enterprise Edition is not installed or it is installed but you have not specified any LOG_ARCHIVE_DEST_n parameters, this parameter is valid)
         c.LOG_ARCHIVE_DEST_n參數 
         OPTIONAL:該選項是默認選項.使用該選項時,無論歸檔是否成功,都可以覆蓋重做日志.
         MANDATORY:強制歸檔.使用該選項時,只有在歸檔成功之后,重做日志才能被覆蓋.
         REOPEN:該屬性用于指定重新歸檔的時間間隔,默認值為300秒,必須跟在MANDATORY后.
        
        SQL> alter system set log_archive_dest_1='location=/home/oracle/app/oracle' scope=spfile;
        System altered
        SQL> select dest_id,dest_name,destination from v$archive_dest;
        
         DEST_ID DEST_NAME	DESTINATION
        
        ---------- -------------------- --------------------------------------------------
        
        	 1 LOG_ARCHIVE_DEST_1	/home/oracle/app/oracle
        SQL> alter system archive log current;
        (手動強制歸檔)
        
        System altered.
        [oracle@localhost oracle]$ ls -ls /home/oracle/app/oracle
        
        總計 244
        
        208 -rw-r----- 1 oracle oinstall 207872 12-10 18:26 4bc445e1_1_102_818781763.arc
        歸檔日志已經在相應的目錄下生成
        知識擴展:
        ALTER SYSTEM SWITCH LOGFILE 是強制日志切換,不一定就歸檔當前的重做日志文件(若自動歸檔打開,就歸檔前的重做日志,若自動歸檔沒有打開,就不歸檔當前重做日志。)
        ALTER SYSTEM ARCHIVE LOG CURRENT 是歸檔當前的重做日志文件,如果自動歸檔有沒有打開,將報ORA-00258錯誤。
        alter system archive log all;--歸檔所有已填滿的聯機日志(只能在非歸檔模式下起作用,如果在歸檔模式下運行,會報ORA-00271: there are no logs that need archiving)
        主要的區別在于
        ALTER SYSTEM SWITCH LOGFILE 對單實例數據庫或RAC中的當前實例執行日志切換。
        ALTER SYSTEM ARCHIVE LOG CURRENT 會對數據庫中的所有實例執行日志切換
        設置:log_archive_duplex_dest參數
        SQL> alter system set log_archive_duplex_dest='/home/oracle/app/oracle/archiveduplex' scope=spfile;
        取消歸檔文件路徑
        alter system set log_archive_dest_n='' scope=spfile
        alter system set log_archive_duplex_dest='' scope=spfile
        禁用某個歸檔日志路徑
        語法:
        alter system set LOG_ARCHIVE_DEST_STATE_n = { enable | defer | alternate }
        SQL> alter system set log_archive_dest_state_2=defer;--禁用
        5. 歸檔涉及到視圖
        v$archive_dest:查詢歸檔所在的目錄(重要字段是:dest_id , dest_name , destination)
        v$loghist:顯示日志歷史信息
        v$archive_processes:歸檔進程信息
        v$archived_log:顯示歸檔信息(重要字段:name, sequence#, first_change#)

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        歸檔日志管理

        歸檔日志管理:數據環境: SQL select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.
        推薦度:
        標簽: 數據 日志 管理
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 国产黄色一级毛片亚洲黄片大全| 男女啪啪永久免费观看网站| 亚洲中文字幕无码永久在线 | 亚洲欧美不卡高清在线| 国产精品免费在线播放| www国产亚洲精品久久久日本| 国产精品亚洲一区二区无码| 国产免费久久精品| 未满十八私人高清免费影院| 99久久综合精品免费 | 精品国产日韩久久亚洲| 免费看香港一级毛片| 国产AV无码专区亚洲AV蜜芽 | 免费看男人j放进女人j免费看| 亚洲人成在线播放网站| 久久午夜无码免费| 国产男女猛烈无遮挡免费视频网站 | 亚洲影院在线观看| 一区二区三区免费在线观看| 国产亚洲精品成人a v小说| 亚洲国产综合AV在线观看| 国产成人高清精品免费软件| 免费看一级高潮毛片| 在线观看免费亚洲| 永久免费无码日韩视频| 国产AV无码专区亚洲Av| 无码中文字幕av免费放| 亚洲a∨无码一区二区| 在线精品亚洲一区二区小说| 91香蕉国产线观看免费全集| 国产自偷亚洲精品页65页| 久久久久国产精品免费免费不卡 | 亚洲国产aⅴ综合网| 最近免费mv在线观看动漫| 亚洲综合激情另类小说区| 可以免费观看的毛片| 亚洲精品伊人久久久久| 亚洲综合色视频在线观看| 亚洲成人免费电影| 99久久精品国产亚洲| 日本免费一区尤物|