- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-6-6 20:36:13
ODM TEST:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 45
Next log sequence to archive 47
Current log sequence 47
SQL> create tablespace movetest datafile '/s01/move.dbf' size 10M;
Tablespace created.
SQL> create table mt tablespace movetest as select * from dba_tables;
Table created.
SQL> select count(*) from mt;
COUNT(*)
----------
1610
SQL> alter tablespace movetest offline;
Tablespace altered.
SQL> ! rm /s01/move.dbf
SQL> alter tablespace movetest online;
alter tablespace movetest online
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
ORA-01110: data file 9: '/s01/move.dbf'
[oracle@vrh8 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Wed Jun 6 20:31:36 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: G10R25 (DBID=2652277393)
RMAN>
RMAN>
RMAN> list backup of tablespace movetest;
using target database control file instead of recovery catalog
没有任何 数据文件备份
RMAN> restore tablespace movetest;
Starting restore at 06-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
creating datafile fno=9 name=/s01/move.dbf
restore not done; all files readonly, offline, or already restored
Finished restore at 06-JUN-12
[oracle@vrh8 ~]$ ls -lh /s01/move.dbf
-rw-r----- 1 oracle oinstall 11M Jun 6 20:32 /s01/move.dbf
[oracle@vrh8 ~]$
[oracle@vrh8 ~]$ strings /s01/move.dbf
}|{z
G10R25
.3K)
MOVETEST
RMAN> recover tablespace movetest;
Starting recover at 06-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 06-JUN-12
RMAN> sql ' alter tablespace movetest online';
using target database control file instead of recovery catalog
sql statement: alter tablespace movetest online
SQL> select count(*) from mt;
COUNT(*)
----------
1610
10g以后 在没有数据文件备份 但是有该数据文件从创建开始的所有的 archivelog归档日志的情况下, 可以直接restore datafile , RMAN会还原一个空的数据文件,之后recover 时 会利用archivelog 来做实现恢复。
10g之前需要使用 alter database create datafile as 命令。 |
|