备份与恢复:用user_command方式基于scn的不完全恢复
备份与恢复:用user_command方式基于scn的不完全恢复
SQL> select * from test;
ID
----------
1
2
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
备份cp 所有数据文件
SQL> startup
ORACLE instance started.
Total System Global Area 546382300 bytes
Fixed Size 455132 bytes
Variable Size 520093696 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from test;
ID
----------
1
2
SQL> insert into test values(3);
1 row created.
SQL> commit;
Commit complete.
SQL> select dbms_flashback.get_system_change_number from dual; --查出scn号
GET_SYSTEM_CHANGE_NUMBER
------------------------
1219138
SQL> drop table test;
Table dropped.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
恢复备份的所有数据文件
SQL> startup mount
ORACLE instance started.
Total System Global Area 546382300 bytes
Fixed Size 455132 bytes
Variable Size 520093696 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> recover database until change 1219138; --基于scn的不完全恢复
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test;
ID
----------
1
2
3
SQL>