ORA-01145: offline immediate disallowed unless media recovery enabled
Cause: ALTER TABLESPACE … OFFLINE IMMEDIATE or ALTER DATABASE DATAFILE … OFFLINE is only allowed if database is in ARCHIVELOG mode.
Action: Take tablespace offline normally or shutdown abort. Reconsider your backup strategy. You could do this if you were archiving your logs.
Ora-01145 错误是一种媒体恢复错误,由于在数据库离线时禁用了媒体恢复选项,因此会出现这种错误。
据官方文档介绍,此错误表示您尝试立即从表空间离线,而此操作必须先启用媒体恢复可以才能执行。如果媒体恢复未启用,系统将显示以上错误消息。
1. 登陆到数据库实例:
$ sqlplus / as sysdba
2. 将数据库模式更改为恢复模式:
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP MOUNT
3. 启用媒体恢复
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE ‘/oracle/bin/ora_bct.ora’;
4. 重新打开数据库
SQL> ALTER DATABASE OPEN;
5. 将模式更改回正常
SQL> ALTER DATABASE NORMAL;