您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

【undo表空间的丢失-恢复-1】

2024/4/17 4:07:19发布6次查看
使用rman进行恢复--undo丢失 restore 把文件还原回去; recover 利用日志文件重做; 关键性的文件丢失和非关键性的文件丢失(system/undo之外的丢失) 1 删除undo文件: [oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/undotbs01.dbf [oracle@oracle ~]$ s
使用rman进行恢复--undo丢失
restore 把文件还原回去;
recover 利用日志文件重做;
关键性的文件丢失和非关键性的文件丢失(system/undo之外的丢失)
1>
删除undo文件:
[oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/undotbs01.dbf
[oracle@oracle ~]$ sqlplus / as sysdba
sql*plus: release 10.2.0.5.0 - production on thu nov 6 14:41:40 2014
copyright (c) 1982, 2010, oracle. all rights reserved.
connected to:
oracle database 10g enterprise edition release 10.2.0.5.0 - 64bit production
with the partitioning, oracle label security, olap, data mining scoring engine
and real application testing options
sql> conn scott/tiger ---此时连接没有报错,是由于undo已经缓存了,清除缓存;
connected.
sql> conn / as sysdba
connected.
sql> alter system flush shared_pool;
system altered.
sql> alter system flush buffer_cache;
system altered.
sql> alter system flush global context;
system altered.
sql> conn scott/tiger ----连接scott用户出错,提示undo丢失
error:
ora-00604: error occurred at recursive sql level 1
ora-01116: error in opening database file 2
ora-01110: data file 2: '/u01/oracle/oradata/jadl10g/undotbs01.dbf'
ora-27041: unable to open file
linux-x86_64 error: 2: no such file or directory
additional information: 3
warning: you are no longer connected to oracle.
sql> conn / as sysdba
connected.
sql> exit
disconnected from oracle database 10g enterprise edition release 10.2.0.5.0 - 64bit production
with the partitioning, oracle label security, olap, data mining scoring engine
and real application testing options
[oracle@oracle ~]$ rman target /
recovery manager: release 10.2.0.5.0 - production on thu nov 6 14:45:54 2014
copyright (c) 1982, 2007, oracle. all rights reserved.
connected to target database: jadl10g (dbid=2011530396)
rman> shutdown abort
using target database control file instead of recovery catalog
oracle instance shut down
rman> startup mount
connected to target database (not started)
oracle instance started
database mounted
total system global area 599785472 bytes
fixed size 2098112 bytes
variable size 163580992 bytes
database buffers 427819008 bytes
redo buffers 6287360 bytes
rman> restore datafile 2;
starting restore at 06-nov-14
allocated channel: ora_disk_1
channel ora_disk_1: sid=157 devtype=disk
channel ora_disk_1: starting datafile backupset restore
channel ora_disk_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/oracle/oradata/jadl10g/undotbs01.dbf
channel ora_disk_1: reading from backup piece /u01/oracle/flash_recovery_area/jadl10g/backupset/2014_11_06/o1_mf_nnndf_tag20141106t135107_b5p32dhf_.bkp
channel ora_disk_1: restored backup piece 1
piece handle=/u01/oracle/flash_recovery_area/jadl10g/backupset/2014_11_06/o1_mf_nnndf_tag20141106t135107_b5p32dhf_.bkp tag=tag20141106t135107
channel ora_disk_1: restore complete, elapsed time: 00:00:07
finished restore at 06-nov-14
rman> recover database;
starting recover at 06-nov-14
using channel ora_disk_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
finished recover at 06-nov-14
rman> alter database open;
database opened
*****采用此种恢复方法之后不需要重新备份数据库,该方法可用于undo丢失或者系统表空间丢失。****
2>建立新的undo表空间,更改为新建的表空间,前提是能正确执行新建undo表空间的命令;
[oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/undotbs01.dbf
[oracle@oracle ~]$ sqlplus / as sysdba
sql*plus: release 10.2.0.5.0 - production on thu nov 6 14:52:24 2014
copyright (c) 1982, 2010, oracle. all rights reserved.
connected to:
oracle database 10g enterprise edition release 10.2.0.5.0 - 64bit production
with the partitioning, oracle label security, olap, data mining scoring engine
and real application testing options
sql> select name from v$datafile;
name
--------------------------------------------------------------------------------
/u01/oracle/oradata/jadl10g/system01.dbf
/u01/oracle/oradata/jadl10g/undotbs01.dbf
/u01/oracle/oradata/jadl10g/sysaux01.dbf
/u01/oracle/oradata/jadl10g/users01.dbf
/u01/oracle/oradata/jadl10g/example01.dbf
sql> ho ls /u01/oracle/oradata/jadl10g/undotbs01.dbf
ls: cannot access /u01/oracle/oradata/jadl10g/undotbs01.dbf: no such file or directory
sql> create undo tablespace undotbs2 datafile '/u01/oracle/oradata/jadl10g/undotbs02.dbf' size 10m autoextend on;
create undo tablespace undotbs2 datafile '/u01/oracle/oradata/jadl10g/undotbs02.dbf' size 10m autoextend on
*
error at line 1:
ora-00604: error occurred at recursive sql level 1
ora-01116: error in opening database file 2
ora-01110: data file 2: '/u01/oracle/oradata/jadl10g/undotbs01.dbf'
ora-27041: unable to open file
linux-x86_64 error: 2: no such file or directory
additional information: 3
create undo tablespace 命令不能正常执行的话,只能采用上面的方法恢复;如果能创建成功,可以不关闭数据库;
alter system set undo_tablespace=undotbs2;
执行以下命令会错:
drop tablespace undotbs01;
alter tablespace undotbs01 offline;
可以执行以下命令脱机不在使用的文件:
alter database datafile 2 offline;
也可以将原来的文件还原回来:
进入rman:
restore datafile 2;
recover datafile 2;
进入sqlplus:
alter database datafile 【本文来自鸿网互联 (http://www.68idc.cn)】2 online;
alter system set undo_tablespace=undotbs1;
****此时需要重新备份数据库;需要注意正在使用的undo是不能脱机的额。
****不清空缓存的话是可以建立的。还有就是建立两个undo,以防止丢失一个,可以切换到另外一个上面。
****system表空间是必须关闭数据库的噢噢
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录