ORA-01150: cannot prevent writes – file string has online backup set
Cause: An attempt to make a tablespace read only or offline normal found that an online backup is still in progress. It will be necessary to write the file header to end the backup, but that would not be allowed if this command succeeded.
Action: End the backup of the offending tablespace and retry this command.
ORA-01150错误是Oracle数据库在执行alter database open resetlogs或者alter database open migrate的时候抛出的错误,这通常会发生在将一个数据文件从磁带或者镜像还原到数据库之后,说明这个文件在还原之前,已经被设置为了在线备份,而ORA-01150不允许从该文件中进行写操作。
当您尝试从一个已设置在线备份的文件中执行写操作时,Oracle 会抛出ORA-01150:“cannot prevent writes – 文件string 已设置在线备份”。
在归档模式下,由于数据库的备份,数据文件被设置为ONLINE BACKUP,然而在归档模式下,ALTER DATABASE OPEN会被拒绝,并抛出ORA-01150错误。
1. 在sqlplus环境中,输入“alter database datafile ‘文件名’ offline;”,将这个文件从online状态设置为offline;
2. 重新尝试ALTER DATABASE OPEN;
3. 在sqlplus环境中,输入“alter database datafile ‘文件名’ online”,将文件还原到online状态;
4. 重新尝试ALTER DATABASE OPEN,如果报错,重复步骤1-3直到没有报错为止。