[oracle@standby oracle]$ sqlplus
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle
With the Partitioning option
JServer Release
SQL> select name from v$datafile;
NAME
/opt/oracle/oradata/primary/system
/opt/oracle/oradata/primary/undotbs
/opt/oracle/oradata/primary/users
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/oracle/oradata/primary/archive
Oldest online log sequence
Next log sequence to archive
Current log sequence
SQL> select name from v$archived_log;
NAME
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
NAME
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
/opt/oracle/oradata/primary/archive/
SQL> select name from v$controlfile;
NAME
/opt/oracle/oradata/primary/control
/opt/oracle/oradata/primary/control
/opt/oracle/oradata/primary/control
SQL> exit
Disconnected from Oracle
With the Partitioning option
JServer Release
[oracle@standby oracle]$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database: PRIMARY (DBID=
RMAN> configure controlfile autobackup on;
using target database controlfile instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> exit
Recovery Manager complete
[oracle@standby oracle]$ ls
[oracle@standby oracle]$ mkdir orabak
[oracle@standby oracle]$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database: PRIMARY (DBID=
RMAN> run {
Starting backup at
current log archived
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
input archive log thread=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/opt/oracle/orabak/arch_PRIMARY_
channel ORA_DISK_
channel ORA_DISK_
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
archive log filename=/opt/oracle/oradata/primary/archive/
Finished backup at
Starting backup at
using channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input datafile fno=
input datafile fno=
input datafile fno=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/opt/oracle/orabak/full_PRIMARY_
channel ORA_DISK_
Finished backup at
Starting backup at
current log archived
using channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input archive log thread=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/opt/oracle/orabak/arch_PRIMARY_
channel ORA_DISK_
channel ORA_DISK_
archive log filename=/opt/oracle/oradata/primary/archive/
Finished backup at
Starting Control File and SPFILE Autobackup at
piece handle=/opt/oracle/product/
Finished Control File and SPFILE Autobackup at
RMAN> exit
Recovery Manager complete
[oracle@standby oracle]$ sqlplus
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle
With the Partitioning option
JServer Release
SQL> shutdown immediate;
Database closed
Database dismounted
ORACLE instance shut down
SQL> exit
Disconnected from Oracle
With the Partitioning option
JServer Release
[oracle@standby oracle]$ cd oradata/
[oracle@standby oradata]$ ls
primary
[oracle@standby oradata]$ mv primary/ primarybak
[oracle@standby oradata]$ mkdir primary
[oracle@standby oradata]$ ls
primary primarybak
[oracle@standby oradata]$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
RMAN> restore controlfile to
Starting restore at
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_
channel ORA_DISK_
RMAN
RMAN
RMAN
RMAN
RMAN
RMAN> set DBID=
executing command: SET DBID
RMAN> restore controlfile to
Starting restore at
using channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
Finished restore at
RMAN> exit
Recovery Manager complete
當然如果文件位置等信息沒有變化就無需修改
[oracle@standby oradata]$ sqlplus
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle
With the Partitioning option
JServer Release
SQL> create pfile from spfile;
File created
SQL> !
[oracle@standby oradata]$ cd $ORACLE_HOME/dbs
[oracle@standby dbs]$ vi initprimary
*
*
patible=
ntrol_files=
re_dump_dest=
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
~
~
~
~
~
[oracle@standby dbs]$ exit
exit
SQL> shutdown immediate;
ORA
ORACLE instance shut down
SQL> create spfile from pfile;
File created
SQL> startup mount;
ORACLE instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted
SQL> exit
Disconnected from Oracle
With the Partitioning option
JServer Release
[oracle@standby oradata]$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database: PRIMARY (DBID=
RMAN> restore database;
Starting restore at
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
restoring datafile
restoring datafile
channel ORA_DISK_
piece handle=/opt/oracle/orabak/full_PRIMARY_
channel ORA_DISK_
Finished restore at
RMAN> recover database;
Starting recover at
using channel ORA_DISK_
starting media recovery
channel ORA_DISK_
channel ORA_DISK_
archive log thread=
channel ORA_DISK_
piece handle=/opt/oracle/orabak/arch_PRIMARY_
channel ORA_DISK_
archive log filename=/opt/oracle/oradata/primary/archive
unable to find archive log
archive log thread=
RMAN
RMAN
RMAN
RMAN
RMAN
RMAN> alter database open resetlogs;
database opened
RMAN>
至此恢復完成
From:http://tw.wingwit.com/Article/program/Oracle/201311/18221.html