Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2737309
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: Oracle

2012-06-24 21:22:05

一、前提开启归档日志
SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /u01/Oracle/oradata/ora9i/arch
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence           1
SQL>

1、冷备数据库
SQL> !date
24 20:56:34 CST 2012

SQL> select count(*) from t;

  COUNT(*)
----------
     9

SQL>
SQL> conn / as sysdba;
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

[oracle@test cold]$ cp  /u01/Oracle/oradata/ora9i/*.dbf .

SQL> conn / as sysdba;
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  235999648 bytes
Fixed Size             450976 bytes
Variable Size          201326592 bytes
Database Buffers       33554432 bytes
Redo Buffers             667648 bytes
Database mounted.
Database opened.


SQL> !date
24 21:03:44 CST 2012

SQL> select count(*) from t;

  COUNT(*)
----------
    15

SQL>

SQL> delete from t;

15 rows deleted.

SQL> date
SP2-0042: unknown command "date" - rest of line ignored.
SQL> !date
24 21:07:31 CST 2012

SQL> select count(*) from t;

  COUNT(*)
----------
     0

SQL>

SQL> conn / as sysdba;
Connected.
SQL> shutdow abort;
ORACLE instance shut down.
SQL> exit


[oracle@test ora9i]$ ll
drwxr-xr-x  2 oracle oinstall      4096  624 20:51 arch
-rw-r-----  1 oracle oinstall   2285568  624 21:07 control01.ctl
-rw-r-----  1 oracle oinstall   2285568  6 24 21:07 control02.ctl
-rw-r-----  1 oracle oinstall   2285568  624 21:07 control03.ctl
-rw-r-----  1 oracle oinstall      1536  623 12:06 orapwora9i
-rw-r-----  1 oracle oinstall 104858112  6 24 21:02 redo01.log
-rw-r-----  1 oracle oinstall 104858112  6 24 21:07 redo02.log
-rw-r-----  1 oracle oinstall 104858112  6 24 21:02 redo03.log
[oracle@test ora9i]$

cp *.dbf /u01/Oracle/oradata/ora9i/
SQL> conn / as sysdba;
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  235999648 bytes
Fixed Size             450976 bytes
Variable Size          201326592 bytes
Database Buffers       33554432 bytes
Redo Buffers             667648 bytes
Database mounted.
SQL> recover database until time '2012-06-24:21:03:44';
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

SQL>

SQL> select * from usr1.t;

    ID NAME
---------- --------------------
      1234 tank
      1234 tank
      1234 tank
      1234 tank
      1234 tank
      1234 tank
       122 jjjao
       122 jjjao
       122 jjjao
       122 jjjao
       122 jjjao

    ID NAME
---------- --------------------
       122 jjjao
       122 jjjao
       122 jjjao
       122 jjjao

15 rows selected.

SQL> select count(*) from usr1.t;

  COUNT(*)
----------
    15

SQL>


完成。
阅读(1210) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~