1. 程式人生 > 實用技巧 >oracle歸檔日誌滿了/oracle歸檔日誌清理

oracle歸檔日誌滿了/oracle歸檔日誌清理

檢視歸檔檔案資訊

--登入Oracle
sqlplus 賬號/密碼 as sysdba

--檢視當前歸檔日誌目錄	
show parameter recovery;

  

解決方法一:修改歸檔日誌檔案大小


--登入Oracle
sqlplus 賬號/密碼 as sysdba

--
更改歸檔日誌目錄 alter system set db_recovery_file_dest='/u01/app/oracle/archivelog' scope=spfile; --更改歸檔日誌目錄大小 alter system set db_recovery_file_dest_size=4096m scope=
spfile; --重啟資料庫並檢視歸檔日誌目錄及大小(修改後記得重啟) shutdown immediate; startup; show parameter recovery;

解決方法二:刪除歸檔日誌檔案

--rman流程        
set oracle_sid=你自己的sid --1
--    檢視自己的sid: 開始(右鍵)->run->輸入: services.msc -> 找 ORACLEService....(....即為你的sid)格式的Name
rman --2
connect target/ --3

--檢視是否開啟歸檔日誌

archive log list;


--校驗日誌的可用性

crosscheck archivelog all;


--列出所有失效的歸檔日誌

list expired archivelog all;


--刪除log sequencewei16及16之前的所有歸檔日誌

delete archivelog until sequence 16;


--刪除系統時間7天以前的歸檔日誌,不會刪除閃回去有效的歸檔日誌

delete archivelog all completed before 'sysdate-7';


--注意這個命令,刪除系統時間1天以內到現在的歸檔日誌

delete archivelog from time 'sysdate-1';


--該命令清除所有的歸檔日誌

delete noprompt archivelog all completed before 'sysdate';

delete noprompt archivelog all;

Oracle 啟動關閉方式

一、幾種啟動方式:
  1、startup nomount
  非安裝啟動,這種方式啟動下可執行:重建控制檔案、重建資料庫
  啟動instance,即啟動SGA和後臺程序,這種啟動只需要init.ora檔案。

  2、startup mount dbname
  安裝啟動,這種方式啟動下可執行:資料庫日誌歸檔、資料庫恢復、重新命名一些資料庫檔案
  如:系統表空間或日誌檔案。
  執行“nomount”,然後開啟控制檔案

  3、startup open dbname
  先執行“nomount”,然後執行“mount”,再開啟包括Redo log檔案在內的所有資料庫檔案,
  這種方式下可訪問資料庫中的資料。

  4、startup,等於以下三個命令
  startup nomount
  alter database mount
  alter database open

  5、startup restrict
  約束方式啟動
  這種方式能夠啟動資料庫,但只允許具有一定特權的使用者訪問
  非特權使用者訪問時,會出現以下提示:
  ERROR:
  ORA-01035: ORACLE 只允許具有 RESTRICTED SESSION 許可權的使用者使用

  6、startup force
  強制啟動方式
  當不能關閉資料庫時,可以用startup force來完成資料庫的關閉
  先關閉資料庫,再執行正常啟動資料庫命令

  7、startup pfile=引數檔名
  帶初始化引數檔案的啟動方式
  先讀取引數檔案,再按引數檔案中的設定啟動資料庫
  例:startup pfile=E:\Oracle\admin\oradb\pfile\init.ora

  8、startup EXCLUSIVE

二、幾種關閉方式:

  1shutdown normal
  正常方式關閉資料庫。

  2shutdown immediate
  立即方式關閉資料庫。
  在SVRMGRL中執行shutdown immediate,資料庫並不立即關閉,
  而是在Oracle執行某些清除工作後才關閉(終止會話、釋放會話資源),
  當使用shutdown不能關閉資料庫時,shutdown immediate可以完成資料庫關閉的操作。

  3shutdown abort
  直接關閉資料庫,正在訪問資料庫的會話會被突然終止,
  如果資料庫中有大量操作正在執行,這時執行shutdown abort後,重新啟動資料庫需要很長時間。