ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oerr ORA-1145处理小记

Oerr ORA-1145处理小记

原创 Linux操作系统 作者:vongates 时间:2019-04-17 11:30:04 0 删除 编辑

在一个用于升级前测试的数据库的陈列上有一个HD挂掉了,因为用于测试的,没有做任何级别的RAID,还好最后确认都是index的数据文件,先把所有可以copy的数据文件全部copy出来,然后换了HD,又重新copy回来,在打开数据库之前把坏掉的索引文件先offline掉,打开数据库后重新rebuile相关的index.在offline文件时报了个1145的错,看了一下帮助原来需要数据库在archive log的模式下才能做offline的动作,下面是一个简单的过程,记录一下。


SQL> startup mount;
ORACLE instance started.

Total System Global Area 1058870496 bytes
Fixed Size 738528 bytes
Variable Size 788529152 bytes
Database Buffers 268435456 bytes
Redo Buffers 1167360 bytes
Database mounted.
SQL>
SQL> alter database datafile '/oradata/F3PROD/data/f3_hst_indx_08.dbf' offline;
alter database datafile '/oradata/F3PROD/data/f3_hst_indx_08.dbf' offline
*
ERROR at line 1:
ORA-01145: offline immediate disallowed unless media recovery enabled


SQL> !
$ oerr ora 1145
01145, 00000, "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.
$ exit

SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oradata/F3PROD/arch1
Oldest online log sequence 2285
Current log sequence 2289

SQL> alter database archivelog;

Database altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Disabled
Archive destination /oradata/F3PROD/arch1
Oldest online log sequence 2285
Next log sequence to archive 2289
Current log sequence 2289
SQL> archive log start;
Statement processed.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oradata/F3PROD/arch1
Oldest online log sequence 2285
Next log sequence to archive 2289
Current log sequence 2289
SQL> alter database datafile '/oradata/F3PROD/data/f3_hst_indx_08.dbf' offline;

Database altered.

SQL> alter database datafile '/oradata/F3PROD/data/f3_hst_indx_11.dbf' offline;

Database altered.

SQL> alter database datafile '/oradata/F3PROD/data/f3_hst_indx_12.dbf' offline;

Database altered.

SQL> alter database datafile '/oradata/F3PROD/data/f3_hst_indx_13.dbf' offline;

Database altered.

SQL> alter database datafile '/oradata/F3PROD/data/f3_hst_indx_15.dbf' offline;

Database altered.

SQL> alter database open;

Database altered.

SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1058870496 bytes
Fixed Size 738528 bytes
Variable Size 788529152 bytes
Database Buffers 268435456 bytes
Redo Buffers 1167360 bytes
Database mounted.
SQL> alter database noarchivelog;

Database altered.

SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oradata/F3PROD/arch1
Oldest online log sequence 2285
Current log sequence 2289
SQL> alter database open;

Database altered.

SQL>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51994/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-09-11

  • 博文量
    449
  • 访问量
    292680