【转】解决:ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
今天在發(fā)出全備份命令rman>backup database 時(shí)出現(xiàn)了以上錯(cuò)誤
Cause: You tried to copy or backup a file that was not closed cleanly, and the database was in NOARCHIVELOG mode. This is not allowed because when restored, the file will require redo application before it is usable, and redo is not currently being saved beyond the contents of the online redo logs.
Action: Take the tablespace offline clean or close the database and retry the copy or backup.
原因是我的數(shù)據(jù)庫運(yùn)行在非歸檔模式
我們知道Oracle中 重做日志文件被分為若干組,當(dāng)一組重做日志被寫滿,ORACLE就開始寫下一組,這叫做日志切換。切換是以循環(huán)的方式進(jìn)行的,即當(dāng)最后一組寫滿后又從第一 組開始寫。所以如果只有重做日志,即oracle運(yùn)行在非歸檔模式下,當(dāng)遇到數(shù)據(jù)文件丟失或損壞時(shí),oracle很難保證能夠完全恢復(fù)數(shù)據(jù)庫,因?yàn)榭赡芩?需的重做記錄因?yàn)橐蛑刈鋈罩狙h(huán)被覆蓋掉了。但在歸檔方式下,歸檔日志進(jìn)程會(huì)把切換后的重做日志文件復(fù)制到歸檔日志文件,我們可以把歸檔日志文件看成是重 做日志文件的備份,但歸檔日志文件是脫機(jī)的,即除了在進(jìn)行復(fù)制時(shí),ORACLE數(shù)據(jù)庫在正常運(yùn)行時(shí)是不會(huì)關(guān)注歸檔日志文件的。
所以我們應(yīng)該把數(shù)據(jù)庫改為歸檔模式。
1。關(guān)閉數(shù)據(jù)庫
SQL> shutdown immediate;
2。啟動(dòng)數(shù)據(jù)庫到mount狀態(tài)
SQL> startup mount;
3。啟用歸檔模式
SQL> alter database archivelog;
4。查看修改后的數(shù)據(jù)庫備份和恢復(fù)策略及歸檔文件的位置
SQL> archive log list;
5.修改相應(yīng)的初始化參數(shù)
Oracle10g之前,你還需要修改初始化參數(shù)使數(shù)據(jù)庫處于自動(dòng)歸檔模式。
可用SQL> show parameter log_archive_start;查看
NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- --------------
log_archive_start??????????????????? boolean???? FALSE
SQL> alter system set log_archive_start=true scope=spfile;
重啟數(shù)據(jù)庫此參數(shù)生效,此時(shí)數(shù)據(jù)庫處于自動(dòng)歸檔模式。
當(dāng)然你也可以不做第5步,直接
SQL>archive log start
使數(shù)據(jù)庫啟用自動(dòng)歸檔,但是重啟后數(shù)據(jù)庫仍然處于手工歸檔模式。
現(xiàn)在你可以用RMAN備份數(shù)據(jù)庫了
附:
1。如果要從歸檔模式變?yōu)榉菤w檔模式,使用alter database noarchivelog 命令
2。使用show parameter db_recovery_file_dest;查看備份文件的目錄及其大小
NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest??????????????? string????? C:\oracle\product\10.2.0/flash_recovery_area
db_recovery_file_dest_size?????????? big integer 2G
3。使用show parameter log_archive_start;查看數(shù)據(jù)庫是否出于自動(dòng)歸檔模式
總結(jié)
以上是生活随笔為你收集整理的【转】解决:ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【转】各进制转换
- 下一篇: Oracle 备份还原数据库练习.