ORACLE使用RMAN对SYSTEM表空间进行介质恢复
ORACLE使用RMAN对SYSTEM表空间进行介质恢复注意:数据库应该支持在归档模式。1.对SYSTEMG表空间做一个备份[oracle@bys001 ~]$ rman target /Recovery Manager: Release 11.2.0.1.0 - Production on Tue Sep 17 10:42:18 2013Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.connected to target database: BYS1 (DBID=3957527513)RMAN> list backup;using target database control file instead of recovery catalogspecification does not match any backup in the repositoryRMAN> backup tablespace system;Starting backup at 17-SEP-13allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=45 device type=DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/u01/oradata/bys1/system01.dbfchannel ORA_DISK_1: starting piece 1 at 17-SEP-13channel ORA_DISK_1: finished piece 1 at 17-SEP-13piece handle=/u01/flash_recovery_area/BYS1/backupset/2013_09_17/o1_mf_nnndf_TAG20130917T104438_93hjjqph_.bkp tag=TAG20130917T104438 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:02:26channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 17-SEP-13channel ORA_DISK_1: finished piece 1 at 17-SEP-13piece handle=/u01/flash_recovery_area/BYS1/backupset/2013_09_17/o1_mf_ncsnf_TAG20130917T104438_93hjok2q_.bkp tag=TAG20130917T104438 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03Finished backup at 17-SEP-13RMAN> exit##################################################################################################2.创建一个表空间,并在此表空间上建表BYS@bys1>select log_mode from v$database;LOG_MODE------------ARCHIVELOGBYS@bys1>select * from user_role_privs;USERNAME GRANTED_ROLE ADM DEF OS_------------------------------ ------------------------------ --- --- ---BYS DBA NO YES NO建表空间和表BYS@bys1>create tablespace rmantest datafile '/u01/oradata/bys1/rmantest.dbf' size 10m;BYS@bys1>create table test5 tablespace rmantest as select * from dba_objects where 1=0;col file_name for a40BYS@bys1>select file_name,tablespace_name,bytes/1024/1024 m from dba_data_files union select file_name,tablespace_name,bytes/1024/1024 m from dba_temp_files;FILE_NAME TABLESPACE_NAME M---------------------------------------- ------------------------------ ----------/u01/oradata/bys1/example01.dbf EXAMPLE 100/u01/oradata/bys1/rmantest.dbf RMANTEST 10/u01/oradata/bys1/sysaux01.dbf SYSAUX 620/u01/oradata/bys1/system01.dbf SYSTEM 690/u01/oradata/bys1/temp01.dbf TEMP 771/u01/oradata/bys1/undotbs01.dbf UNDOTBS1 125/u01/oradata/bys1/users01.dbf USERS 1703.75BYS@bys1>select table_name,tablespace_name from user_tables where table_name='TEST5';TABLE_NAME TABLESPACE_NAME------------------------------ ------------------------------TEST5 RMANTESTBYS@bys1>select df.tablespace_name,df.sum_df_m as space_m,df.sum_df_m-fs.sum_fs_m as used_m,fs.sum_fs_m as free_space,to_char(trunc((df.sum_df_m-fs.sum_fs_m)/df.sum_df_m,2)*100) as "used_%" from (select tablespace_name,sum(bytes/1024/1024) as sum_df_m from dba_data_files group by tablespace_name) df,(select tablespace_name,sum(bytes/1024/1024) as sum_fs_m from dba_free_space group by tablespace_name) fs where df.tablespace_name=fs.tablespace_name and df.tablespace_name='RMANTEST';TABLESPACE_NAME SPACE_M USED_M FREE_SPACE used_%------------------------------ ---------- ---------- ---------- ----------RMANTEST 10 1.0625 8.9375 10BYS@bys1>exit################################################################3.模拟SYSTEM表空间故障--这里是把SYSTEM表空间的数据文件改名发现此时数据库还是正常运行,并且可以做DML操作。但是DDL或涉及数据字典表的操作会报错。--也验证了删除系统表空间的数据文件数据库并不会SHUTDOWN.使用shutdown immediate;关闭数据库时因为需要向数据文件中写入CHECKPOING相关信息,所以报错。使用ABORT选项关闭数据库。此时打开数据库会报错,无法锁定数据文件。此时数据库是MOUNT状态[oracle@bys001 bys1]$ pwd/u01/oradata/bys1[oracle@bys001 bys1]$ lscontrol01.ctl redo01.log redo03.log sysaux01.dbf temp01.dbf users01.dbfexample01.dbf redo02.log rmantest.dbf system01.dbf undotbs01.dbf[oracle@bys001 bys1]$ mv system01.dbf system01.dbfa[oracle@bys001 bys1]$ lscontrol01.ctl redo01.log redo03.log sysaux01.dbf temp01.dbf users01.dbfexample01.dbf redo02.log rmantest.dbf system01.dbfa undotbs01.dbf[oracle@bys001 bys1]$ sqlplus / as sysdbaSYS@bys1>select open_mode from v$database;OPEN_MODE--------------------READ WRITESYS@bys1>conn bys/bysConnected.BYS@bys1>select * from test5;no rows selectedBYS@bys1>insert into test5 select * from dba_objects where rownum<5;4上一个:Oracle中tnsping命令解析
下一个:DataGuard环境搭建
- 更多Oracle疑问解答:
- 运行exp备份oracle数据库提示oracle-12154错误
- 有没有,生产Oracle Rman 备份脚本的工具啊!
- 初学orcle,希望有大大帮忙解说一下详细步骤,从登录oracle到创建表的过程
- oracle语句问题:一张user表,三个字段,id,name,time,插入记录比如:张三2007,李四2008,张三2011
- 如何写一个ORACLE触发器同步两个表中的数据?
- oracle 如何查看一个服务器上有多少个数据库.
- oracle 创建包的时候错误 求解
- oracle 重复列的问题
- oracle 中如何查处2星期前的数据
- 请教oracle数据库安装中的问题
- 请问谁能提供给我标准的oracle ERP的数据库表结构并详细说明各表主要的作用?
- 安装oracle遇到的问题 invalid entry CRC (expected 0x3e12e795 but got 0x9db0e9fd)
- 我的是ORACLE 10G,在RMAN中如何按指定的时间恢复数据文件啊?
- oracle为什么没有自动增长列
- oracle快捷键都有哪些啊?