日期:2014-05-16 浏览次数:20483 次
环境:
rhel 5.5,oracle10.2.0.1
xmanager4.0
通过备份控制文件后,对数据库进行一系列的操作,关闭数据库;恢复控制文件,启动到mount阶段在使用resetlogs重新创建控制文件,找回我们的数据。
备份控制文件
backupdatafile 1;
RMAN>backup datafile 1;
RMAN>backup datafile 1;
Startingbackup at 26-JUN-12
usingchannel ORA_DISK_1
channelORA_DISK_1: starting compressed full datafile backupset
channelORA_DISK_1: specifying datafile(s) in backupset
inputdatafile fno=00001 name=/opt/oracle/product/10.2.0/oradata/cuug/system01.dbf
channelORA_DISK_1: starting piece 1 at 26-JUN-12
channelORA_DISK_1: finished piece 1 at 26-JUN-12
piecehandle=/opt/oracle/product/10.2.0/flash_recovery_area/CUUG/backupset/2012_06_26/o1_mf_nnndf_TAG20120626T114501_7yld1y1q_.bkptag=TAG20120626T114501 comment=NONE
channelORA_DISK_1: backup set complete, elapsed time: 00:08:06
channelORA_DISK_1: throttle time: 0:06:39
Finishedbackup at 26-JUN-12
StartingControl File Autobackup at 26-JUN-12
piecehandle=/opt/oracle/product/10.2.0/flash_recovery_area/CUUG/autobackup/2012_06_26/o1_mf_n_786973989_7yldk6mm_.bkpcomment=NONE
FinishedControl File Autobackup at 26-JUN-12
做一些操作和日志切换
SQL>select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
-------------------- ----------------
1 9 INACTIVE
2 10 CURRENT
3 7 INACTIVE
4 8 INACTIVE
[oracle@rhel5cuug]$ cp cuug01.dbf cuug01.dbf_bak
SQL>select username,default_tablespace from dba_users where username='SCOTT';
USERNAME DEFAULT_TABLESPACE
------------------------
SCOTT CUUG
SQL>create table scott.a as select * from tab;
Tablecreated.
SQL>create table scott.aa as select * fromtab;
SQL>select count(*) from scott.a;
COUNT(*)
----------
3642
SQL>create tablespace test datafile'/opt/oracle/product/10.2.0/oradata/cuug/test01.dbf' size 100m;
Tablespacecreated.
Tablespacecreated.
SQL>alter system switch logfile;
Systemaltered.
SQL>select file_name from dba_data_files;
FILE_NAME
--------------------------------------------
/opt/oracle/product/10.2.0/oradata/cuug/cuug01.dbf
/opt/oracle/product/10.2.0/oradata/cuug/rmans01.dbf
/opt/oracle/product/10.2.0/oradata/cuug/users01.dbf
/opt/oracle/product/10.2.0/oradata/cuug/sysaux01.dbf
/opt/oracle/product/10.2.0/oradata/cuug/undotbs01.dbf
/opt/oracle/product/10.2.0/oradata/cuug/system01.dbf
/opt/oracle/product/10.2.0/oradata/cuug/test01.dbf
SQL>select group#,status,sequence# from v$log;
GROUP#STATUS SEQUENCE#
-------------------------- ----------
1INACTIVE 9
<