本帖最后由 jieyancai 于 2016-9-29 12:39 编辑
这不就是可以不需要嘛,只是没那么方便而已。
[oracle@pri oradata]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Sep 29 11:12:45 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: JYC (not mounted)
RMAN> restore spfile to '/home/oracle/stb.bak' from '/home/oracle/rman/bk_37_1_923760236';
Starting restore at 29-SEP-16
using channel ORA_DISK_1
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/rman/bk_37_1_923760236
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 29-SEP-16
RMAN> restore controlfile from '/home/oracle/rman/bk_36_1_923760236';
Starting restore at 29-SEP-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/oracle/app/oradata/jyc/control01.ctl
output file name=/home/oracle/app/oradata/jyc/control02.ctl
Finished restore at 29-SEP-16
RMAN> alter database mount
2> ;
database mounted
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 29-SEP-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/app/oradata/jyc/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/app/oradata/jyc/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/rman/bk_35_1_923760221
channel ORA_DISK_1: piece handle=/home/oracle/rman/bk_35_1_923760221 tag=HOT_DB_BK_LEVEL0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /home/oracle/app/oradata/jyc/system01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/app/oradata/jyc/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/rman/bk_34_1_923760221
channel ORA_DISK_1: piece handle=/home/oracle/rman/bk_34_1_923760221 tag=HOT_DB_BK_LEVEL0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 29-SEP-16
RMAN> recover database ;
Starting recover at 29-SEP-16
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 17 is already on disk as file /home/oracle/archivelog/1_17_923746869.dbf
archived log file name=/home/oracle/archivelog/1_17_923746869.dbf thread=1 sequence=17
archived log file name=/home/oracle/archivelog/1_18_923746869.dbf thread=1 sequence=18
archived log file name=/home/oracle/archivelog/1_19_923746869.dbf thread=1 sequence=19
archived log file name=/home/oracle/archivelog/1_20_923746869.dbf thread=1 sequence=20
archived log file name=/home/oracle/archivelog/1_21_923746869.dbf thread=1 sequence=21
unable to find archived log
archived log thread=1 sequence=22
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/29/2016 11:14:22
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 22 and starting SCN of 977989
RMAN> alter database open;
database opened
RMAN> exit
SQL> conn /as sysdba
Connected.
SQL> select open_mode , database_role, flashback_on from v$database;
OPEN_MODE DATABASE_ROLE FLASHBACK_ON
-------------------- ---------------- ------------------
READ ONLY PHYSICAL STANDBY NO
SQL> alter database activate standby database;
alter database activate standby database
*
ERROR at line 1:
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '/home/oracle/app/oradata/jyc/sredo04.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> select * from v$standby_log;
select * from v$standby_log
*
ERROR at line 1:
ORA-00308: cannot open archived log '/home/oracle/app/oradata/jyc/sredo04.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> select * from v$Log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC
---------- ---------- ---------- ---------- ---------- ---------- ---
STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------------- ------------- ------------ ------------ ------------
1 1 16 52428800 512 1 YES
CLEARING 976822 28-SEP-16 975441 28-SEP-16
3 1 18 52428800 512 1 YES
CURRENT 977135 28-SEP-16 976822 28-SEP-16
2 1 17 52428800 512 1 YES
CLEARING 976845 28-SEP-16 977135 28-SEP-16
SQL> select * from v$standby_log;
select * from v$standby_log
*
ERROR at line 1:
ORA-00308: cannot open archived log '/home/oracle/app/oradata/jyc/sredo04.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> !ls -l /home/oracle/app/oradata/jyc/*
-rw-r-----. 1 oracle oinstall 9748480 Sep 29 12:29 /home/oracle/app/oradata/jyc/control01.ctl
-rw-r-----. 1 oracle oinstall 9748480 Sep 29 12:29 /home/oracle/app/oradata/jyc/control02.ctl
-rw-r-----. 1 oracle oinstall 534781952 Sep 29 11:15 /home/oracle/app/oradata/jyc/sysaux01.dbf
-rw-r-----. 1 oracle oinstall 775954432 Sep 29 11:15 /home/oracle/app/oradata/jyc/system01.dbf
-rw-r-----. 1 oracle oinstall 30416896 Sep 29 11:15 /home/oracle/app/oradata/jyc/temp01.dbf
-rw-r-----. 1 oracle oinstall 78651392 Sep 29 11:15 /home/oracle/app/oradata/jyc/undotbs01.dbf
-rw-r-----. 1 oracle oinstall 13115392 Sep 29 11:15 /home/oracle/app/oradata/jyc/users01.dbf
SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '/home/oracle/app/oradata/jyc/sredo04.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 4;
Database altered.
SQL> alter database drop logfile group 4;
Database altered.
SQL> alter database activate standby database;
Database altered.
SQL> select open_mode , database_role, flashback_on from v$database;
OPEN_MODE DATABASE_ROLE FLASHBACK_ON
-------------------- ---------------- ------------------
MOUNTED PRIMARY NO
SQL> alter database open;
Database altered.
SQL> select open_mode , database_role, flashback_on from v$database;
OPEN_MODE DATABASE_ROLE FLASHBACK_ON
-------------------- ---------------- ------------------
READ WRITE PRIMARY NO
SQL> select * from t1;
select * from t1
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select * from jyc.t1;
ID
----------
1
SQL> select * from v$Log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC
---------- ---------- ---------- ---------- ---------- ---------- ---
STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------------- ------------- ------------ ------------ ------------
1 1 1 52428800 512 1 YES
INACTIVE 977990 29-SEP-16 977993 29-SEP-16
2 1 2 52428800 512 1 YES
ACTIVE 977993 29-SEP-16 978274 29-SEP-16
3 1 3 52428800 512 1 NO
CURRENT 978274 29-SEP-16 2.8147E+14
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/archivelog
Oldest online log sequence 1
Next log sequence to archive 3
Current log sequence 3
SQL>