2014年12月1日星期一

pdb索引表空间dbf丢失后,如何修复

在pdb里面我手动删了一个索引表空dbf,12c里恢复方法如下

[oracle@orasrv ~]$ sqlplus / as sysdba;

SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 1 20:56:43 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> !rm /u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf

SQL> shutdown;
ORA-01116: error in opening database file 26
ORA-01110: data file 26: '/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> drop tablespace zyzidx including contents and datafiles;
drop tablespace zyzidx including contents and datafiles
*
ERROR at line 1:
ORA-00959: tablespace 'ZYZIDX' does not exist


SQL> alter session set container=pdborcl;

Session altered.

SQL> drop tablespace zyzidx including contents and datafiles;
drop tablespace zyzidx including contents and datafiles
*
ERROR at line 1:
ORA-01116: error in opening database file 26
ORA-01110: data file 26: '/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


SQL> alter session set container=cdb$root;

Session altered.

SQL> shutdown abort;
ORACLE instance shut down.
SQL>  startup  mount;
ORACLE instance started.

Total System Global Area 3206836224 bytes
Fixed Size                  2293496 bytes
Variable Size             771752200 bytes
Database Buffers         2415919104 bytes
Redo Buffers               16871424 bytes
Database mounted.
SQL> alter database datafile '/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf' offline drop;
alter database datafile '/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf' offline drop
*
ERROR at line 1:
ORA-01516: nonexistent log file, data file, or temporary file
"/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf"


SQL> alter session set container=pdborcl;

Session altered.

SQL> alter database datafile '/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf' offline drop;

Database altered.

SQL> alter session set container=cdb$root;

Session altered.

SQL> alter database open;

Database altered.

SQL>  alter session set container=pdborcl;

Session altered.

SQL> drop tablespace zyzidx including contents and datafiles;
drop tablespace zyzidx including contents and datafiles
*
ERROR at line 1:
ORA-01109: database not open


SQL> alter session set container=cdb$root;

Session altered.

SQL> alter pluggable database pdborcl open;

Pluggable database altered.

SQL>  alter session set container=pdborcl;

Session altered.

SQL> drop tablespace zyzidx including contents and datafiles;

Tablespace dropped.

SQL> create tablespace zyzidx datafile '/u01/app/oracle/oradata/orcl/pdborcl/zyzidx01.dbf' size 10m;   

Tablespace created.

没有评论:

发表评论