Oracle9i中RMAN实验(windows下)

本文演示了如何使用RMAN在Oracle数据库中进行数据库备份,并通过指定SCN还原到先前的状态。包括删除测试表中的数据、备份整个数据库(包括当前控制文件)、关闭数据库、从备份中恢复数据文件并重置日志。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SQL> select * from test.t;

       IDX CNAME
---------- ------------------------------
         1 aaaa
        
2 bbbb
        
3 cccc

RMAN
> backup database include current controlfile;

Starting
backup at 23-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting
full datafile backupset
channel ORA_DISK_1: specifying datafile(s)
in backupset
including
current controlfile in backupset
input datafile fno
=00001 name=C:/ORACLE/ORADATA/ORCL/SYSTEM01.DBF
input datafile fno
=00015 name=C:/ORACLE/ORADATA/ORCL/UNDOTBS.DBF
input datafile fno=00011 name=C:/ORACLE/ORADATA/ORCL/ORA_BACKUP.DBF
.
.
.   
input datafile fno=00009 name=C:/ORACLE/ORADATA/AUT/USERS01.DBF
input datafile fno
=00003 name=C:/ORACLE/ORADATA/ORCL/CWMLITE01.DBF
input datafile fno=00008 name=C:/ORACLE/ORADATA/ORCL/TOOLS01.DBF
channel ORA_DISK_1: starting piece
1 at 23-JUL-08
channel ORA_DISK_1: finished piece
1 at 23-JUL-08
piece handle
=C:/ORACLE/ORA92/DATABASE/2OJM7631_1_1 comment=NONE
channel ORA_DISK_1:
backup set complete, elapsed time: 00:01:06
Finished
backup at 23-JUL-08

Starting Control
File and SPFILE Autobackup at 23-JUL-08
piece handle
=C:/ORACLE/ORA92/DATABASE/C-1186183048-20080723-07 comment=NONE
Finished Control
File and SPFILE Autobackup at 23-JUL-08

RMAN
> exit
Recovery Manager complete.

C:/
>set oracle_sid=orcl
C:/
>sqlplus "/ as sysdba"
SQL
*Plus: Release 9.2.0.1.0 - Production on Wed Jul 23 14:16:43 2008
Copyright (c)
1982, 2002, Oracle Corporation. All rights reserved.
Connected
to:
Oracle9i Enterprise Edition Release
9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release
9.2.0.1.0 - Production
SQL
> select * from test.t;

       IDX CNAME
---------- ------------------------------
         1 aaaa
        
2 bbbb
        
3 cccc
        
SQL
> delete from test.t;
3 rows deleted.
SQL
> commit;
Commit complete.

SQL
> select * from test.t;
no rows selected

SQL
> exit
Disconnected
from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release
9.2.0.1.0 - Production
C:/
>rman target /

Recovery Manager: Release
9.2.0.1.0 - Production

Copyright (c)
1995, 2002, Oracle Corporation. All rights reserved.

connected
to target database: ORCL (DBID=1186183048)

RMAN
> list backup;

using target
database controlfile instead of recovery catalog

List
of Backup Sets
===================

BS
Key Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
81      Full    660M       DISK        00:01:06     23-JUL-08
        BP
Key: 81   Status: AVAILABLE   Tag: TAG20080723T141457
        Piece Name: C:/ORACLE/ORA92/
DATABASE/2OJM7631_1_1
Controlfile Included: Ckp SCN:
2407868      Ckp time: 23-JUL-08
List
of Datafiles in backup set 81
File LV Type Ckp SCN    Ckp Time Name
---- -- ---- ---------- --------- ----
1       Full 2407869    23-JUL-08 C:/ORACLE/ORADATA/ORCL/SYSTEM01.DBF
3       Full 2407869    23-JUL-08 C:/ORACLE/ORADATA/ORCL/CWMLITE01.DBF
4       Full 2407869    23-JUL-08 C:/ORACLE/ORADATA/ORCL/DRSYS01.DBF
  
.
.
.
11      Full 2407869    23-JUL-08 C:/ORACLE/ORADATA/ORCL/ORA_BACKUP.DBF
15      Full 2407869    23-JUL-08 C:/ORACLE/ORADATA/ORCL/UNDOTBS.DBF

BS
Key Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
82      Full    1M         DISK        00:00:01     23-JUL-08
        BP
Key: 82   Status: AVAILABLE   Tag:
        Piece Name: C:/ORACLE/ORA92/
DATABASE/C-1186183048-20080723-07
SPFILE Included: Modification time:
10-JUL-08

RMAN
> shutdown immediate;

database closed
database dismounted
Oracle instance shut down

RMAN
> startup mount;

connected
to target database (not started)
Oracle instance started
database mounted

Total System Global Area    
135338868 bytes

Fixed Size                     
453492 bytes
Variable Size               
109051904 bytes
Database Buffers              25165824 bytes
Redo Buffers                   
667648 bytes

RMAN
> run{
2> allocate channel t1 type disk;
3> set until scn 2407869;
4> restore database;
5> recover database;
6> alter database open resetlogs;
7> release channel t1;
8> }

allocated channel: t1
channel t1: sid
=11 devtype=DISK

executing command:
SET until clause

Starting
restore at 23-JUL-08

channel t1: starting datafile backupset
restore
channel t1: specifying datafile(s)
to restore from backup set
restoring datafile
00001 to C:/ORACLE/ORADATA/ORCL/SYSTEM01.DBF
restoring datafile
00003 to C:/ORACLE/ORADATA/ORCL/CWMLITE01.DBF
restoring datafile
00004 to C:/ORACLE/ORADATA/ORCL/DRSYS01.DBF
restoring datafile
00005 to C:/ORACLE/ORADATA/ORCL/EXAMPLE01.DBF
restoring datafile
00006 to C:/ORACLE/ORADATA/ORCL/INDX01.DBF
restoring datafile
00007 to C:/ORACLE/ORADATA/ORCL/ODM01.DBF
restoring datafile
00008 to C:/ORACLE/ORADATA/ORCL/TOOLS01.DBF
restoring datafile
00009 to C:/ORACLE/ORADATA/AUT/USERS01.DBF
restoring datafile
00010 to C:/ORACLE/ORADATA/ORCL/XDB01.DBF
restoring datafile
00011 to C:/ORACLE/ORADATA/ORCL/ORA_BACKUP.DBF
restoring datafile
00015 to C:/ORACLE/ORADATA/ORCL/UNDOTBS.DBF
channel t1: restored
backup piece 1
piece handle
=C:/ORACLE/ORA92/DATABASE/2OJM7631_1_1 tag=TAG20080723T141457 params=NULL
channel t1:
restore complete
Finished
restore at 23-JUL-08

Starting recover at
23-JUL-08

starting media recovery
media recovery complete

Finished recover at
23-JUL-08

database opened

released channel: t1

RMAN
> exit


Recovery Manager complete.

C:/
>sqlplus "/ as sysdba"

SQL
*Plus: Release 9.2.0.1.0 - Production on Wed Jul 23 14:23:48 2008

Copyright (c)
1982, 2002, Oracle Corporation. All rights reserved.


Connected
to:
Oracle9i Enterprise Edition Release
9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release
9.2.0.1.0 - Production

SQL
> select * from test.t;

       IDX CNAME
---------- ------------------------------
         1 aaaa
        
2 bbbb
        
3 cccc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值