Chinaunix首页 | 论坛 | 博客
  • 博客访问: 160326
  • 博文数量: 126
  • 博客积分: 1073
  • 博客等级: 上尉
  • 技术积分: 1175
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-12 00:32
文章分类

全部博文(126)

文章存档

2018年(56)

2013年(1)

2012年(8)

2011年(61)

分类: Oracle

2011-07-16 18:20:59

自动备份controlfile

 

[oracle@station23 ~]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Jul 10 17:15:17 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: ORCL (DBID=1267524952)

 

RMAN> show all;

 

using target database control file instead of recovery catalog

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_orcl.f'; # default

 

RMAN> configure controlfile autobackup on;

 

new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters are successfully stored

 

RMAN> show all;

 

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_orcl.f'; # default

 

口令文件丢失

orapwd file=orapwsid password=pass entries=5

[oracle@station23 ~]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs/

[oracle@station23 dbs]$ ls

hc_orcl.dat  init.ora      lkORCL     snapcf_orcl.f

initdw.ora   initorcl.ora  orapworcl  spfileorcl.ora

[oracle@station23 dbs]$ cp orapworcl orapworcl.bak

[oracle@station23 dbs]$ rm orapworcl

[oracle@station23 dbs]$ ls

hc_orcl.dat  init.ora      lkORCL         snapcf_orcl.f

initdw.ora   initorcl.ora  orapworcl.bak  spfileorcl.ora

[oracle@station23 dbs]$ orapwd file=orapworcl password=oracle entries=5

 

spfile丢失

l  startup nomount;

l  set dbid 1267524952

l  restore spfile from autobackup;

l  shutdown immediate;

l  set dbid 1267524952;

l  startup

[oracle@station23 dbs]$ pwd

/u01/app/oracle/product/10.2.0/db_1/dbs

[oracle@station23 dbs]$ ls

hc_orcl.dat  init.ora      lkORCL     orapworcl.bak  spfileorcl.ora

initdw.ora   initorcl.ora  orapworcl  snapcf_orcl.f

[oracle@station23 dbs]$ mv spfileorcl.ora spfileorcl.ora.orig

[oracle@station23 dbs]$ ls

hc_orcl.dat  init.ora      lkORCL     orapworcl.bak  spfileorcl.ora.orig

initdw.ora   initorcl.ora  orapworcl  snapcf_orcl.f

[oracle@station23 dbs]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 11 22:46:12 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: ORCL (DBID=1267524952)

 

RMAN> shutdown immediate;

 

using target database control file instead of recovery catalog

database closed

database dismounted

Oracle instance shut down

 

RMAN> startup nomount;

 

connected to target database (not started)

Oracle instance started

 

Total System Global Area     683671552 bytes

 

Fixed Size                     1221276 bytes

Variable Size                192941412 bytes

Database Buffers             486539264 bytes

Redo Buffers                   2969600 bytes

 

RMAN> set dbid 1267524952

 

executing command: SET DBID

 

RMAN> restore spfile from autobackup;

 

Starting restore at 11-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

 

recovery area destination: /u01/app/oracle/flash_recovery_area

database name (or database unique name) used for search: ORCL

channel ORA_DISK_1: autobackup found in the recovery area

channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_07_10/o1_mf_s_756150698_71lxkf57_.bkp

channel ORA_DISK_1: SPFILE restore from autobackup complete

Finished restore at 11-JUL-11

 

RMAN> quit

 

 

Recovery Manager complete.

[oracle@station23 dbs]$ ls

hc_orcl.dat  init.ora      lkORCL     orapworcl.bak  spfileorcl.ora

initdw.ora   initorcl.ora  orapworcl  snapcf_orcl.f  spfileorcl.ora.orig

[oracle@station23 dbs]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 11 22:57:00 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: orcl (not mounted)

 

RMAN> shutdown immediate;

 

using target database control file instead of recovery catalog

Oracle instance shut down

 

RMAN> startup;

 

connected to target database (not started)

Oracle instance started

database mounted

database opened

 

Total System Global Area     683671552 bytes

 

Fixed Size                     1221276 bytes

Variable Size                201330020 bytes

Database Buffers             478150656 bytes

Redo Buffers                   2969600 bytes

 

RMAN>

 

controlfile丢失

l  startup nomount;

l  restore controlfile from autobackup;

l  alter database mount;

l  recover database;

l  alter database open resetlogs;

[oracle@station23 ~]$ cd /u01/app/oracle/oradata/orcl/

[oracle@station23 orcl]$ ll

total 1056964

-rw-r----- 1 oracle oinstall   7061504 Jul 11 23:08 control01.ctl

-rw-r----- 1 oracle oinstall   7061504 Jul 11 23:08 control02.ctl

-rw-r----- 1 oracle oinstall   7061504 Jul 11 23:08 control03.ctl

-rw-r----- 1 oracle oinstall 104865792 Jul 11 22:57 example01.dbf

-rw-r----- 1 oracle oinstall  52429312 Jul 11 23:08 redo01.log

-rw-r----- 1 oracle oinstall  52429312 Jul 11 22:57 redo02.log

-rw-r----- 1 oracle oinstall  52429312 Jul 11 22:57 redo03.log

-rw-r----- 1 oracle oinstall 262152192 Jul 11 23:08 sysaux01.dbf

-rw-r----- 1 oracle oinstall 503324672 Jul 11 23:07 system01.dbf

-rw-r----- 1 oracle oinstall  20979712 Jul 11 22:06 temp01.dbf

-rw-r----- 1 oracle oinstall  26222592 Jul 11 23:08 undotbs01.dbf

-rw-r----- 1 oracle oinstall   5251072 Jul 11 22:57 users01.dbf

[oracle@station23 orcl]$ rm *.ctl

[oracle@station23 orcl]$ ls

example01.dbf  redo02.log  sysaux01.dbf  temp01.dbf     users01.dbf

redo01.log     redo03.log  system01.dbf  undotbs01.dbf

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 11 23:09:54 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00554: initialization of internal recovery manager package failed

RMAN-06003: ORACLE error from target database:

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control01.ctl'

ORA-27041: unable to open file

Linux Error: 2: No such file or directory

Additional information: 3

[oracle@station23 orcl]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 11 23:10:26 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected.

SQL> shutdown immediate;

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control01.ctl'

ORA-27041: unable to open file

Linux Error: 2: No such file or directory

Additional information: 3

SQL> shutdown abort;

ORACLE instance shut down.

SQL> quit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 11 23:12:20 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database (not started)

 

RMAN> startup nomount;

 

Oracle instance started

 

Total System Global Area     683671552 bytes

 

Fixed Size                     1221276 bytes

Variable Size                205524324 bytes

Database Buffers             473956352 bytes

Redo Buffers                   2969600 bytes

 

RMAN> restore controlfile from autobackup;

 

Starting restore at 11-JUL-11

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

 

recovery area destination: /u01/app/oracle/flash_recovery_area

database name (or database unique name) used for search: ORCL

channel ORA_DISK_1: autobackup found in the recovery area

channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_07_10/o1_mf_s_756150698_71lxkf57_.bkp

channel ORA_DISK_1: control file restore from autobackup complete

output filename=/u01/app/oracle/oradata/orcl/control01.ctl

output filename=/u01/app/oracle/oradata/orcl/control02.ctl

output filename=/u01/app/oracle/oradata/orcl/control03.ctl

Finished restore at 11-JUL-11

 

RMAN> quit

 

 

Recovery Manager complete.

[oracle@station23 orcl]$ ls

control01.ctl  control03.ctl  redo01.log  redo03.log    system01.dbf  undotbs01.dbf

control02.ctl  example01.dbf  redo02.log  sysaux01.dbf  temp01.dbf    users01.dbf

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 11 23:13:44 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: orcl (not mounted)

 

RMAN> alter database mount;

 

using target database control file instead of recovery catalog

database mounted

 

RMAN> recover database;

 

Starting recover at 11-JUL-11

Starting implicit crosscheck backup at 11-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=160 devtype=DISK

Crosschecked 3 objects

Finished implicit crosscheck backup at 11-JUL-11

 

Starting implicit crosscheck copy at 11-JUL-11

using channel ORA_DISK_1

Crosschecked 1 objects

Finished implicit crosscheck copy at 11-JUL-11

 

searching for all files in the recovery area

cataloging files...

cataloging done

 

List of Cataloged Files

=======================

File Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_07_10/o1_mf_s_756150698_71lxkf57_.bkp

 

using channel ORA_DISK_1

 

starting media recovery

 

archive log thread 1 sequence 8 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log

archive log filename=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=8

media recovery complete, elapsed time: 00:00:10

Finished recover at 11-JUL-11

 

RMAN> alter database open resetlogs;

 

database opened

 

RMAN> quit

 

 

Recovery Manager complete.

[oracle@station23 orcl]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 11 23:20:31 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected.

SQL> select * from dual;

 

D

-

X

 

SQL>

 

redolog file丢失

l  shutdown immediate;

l  startup mount;

l  recover database until cancel;

l  alter database open resetlogs;

[oracle@station23 orcl]$ ls

control01.ctl  control03.ctl  redo01.log  redo03.log    system01.dbf  undotbs01.dbf

control02.ctl  example01.dbf  redo02.log  sysaux01.dbf  temp01.dbf    users01.dbf

[oracle@station23 orcl]$ rm *.log

[oracle@station23 orcl]$ ls

control01.ctl  control03.ctl  sysaux01.dbf  temp01.dbf     users01.dbf

control02.ctl  example01.dbf  system01.dbf  undotbs01.dbf

[oracle@station23 orcl]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 11 23:31:09 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected.

SQL> shutdown immediate;

ORA-01109: database not open

 

 

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area  683671552 bytes

Fixed Size                  1221276 bytes

Variable Size             209718628 bytes

Database Buffers          469762048 bytes

Redo Buffers                2969600 bytes

Database mounted.

SQL> recover database until cancel;

Media recovery complete.

SQL> alter database open resetlogs;

 

Database altered.

 

SQL> select * from dual;

 

D

-

X

 

SQL>

 

datafile丢失

l  sql “alter database datafile 3 offline”;

l  restore datafile 3

l  recover datafile 3

l  sql “alter database datafile 3 online”;

 

[oracle@station23 u01]$ cd /u01/app/oracle/oradata/orcl/

[oracle@station23 orcl]$ ls

control01.ctl  example01.dbf  redo03.log    temp01.dbf

control02.ctl  redo01.log     sysaux01.dbf  undotbs01.dbf

control03.ctl  redo02.log     system01.dbf  users01.dbf

[oracle@station23 orcl]$ mv example01.dbf example01.dbf.orig

[oracle@station23 orcl]$ ls

control01.ctl  example01.dbf.orig  redo03.log    temp01.dbf

control02.ctl  redo01.log          sysaux01.dbf  undotbs01.dbf

control03.ctl  redo02.log          system01.dbf  users01.dbf

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jul 13 00:58:03 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: ORCL (DBID=1267524952)

 

RMAN> sql "alter database datafile 5 offline";

 

using target database control file instead of recovery catalog

sql statement: alter database datafile 5 offline

 

RMAN> report schema;

 

Report of database schema

 

List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

---- -------- -------------------- ------- ------------------------

1    480      SYSTEM               ***     /u01/app/oracle/oradata/orcl/system01.dbf

2    25       UNDOTBS1             ***     /u01/app/oracle/oradata/orcl/undotbs01.dbf

3    230      SYSAUX               ***     /u01/app/oracle/oradata/orcl/sysaux01.dbf

4    5        USERS                ***     /u01/app/oracle/oradata/orcl/users01.dbf

5    0        EXAMPLE              ***     /u01/app/oracle/oradata/orcl/example01.dbf

 

List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

---- -------- -------------------- ----------- --------------------

1    20       TEMP                 32767       /u01/app/oracle/oradata/orcl/temp01.dbf

 

RMAN> restore datafile 5;

 

Starting restore at 13-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=144 devtype=DISK

 

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_13/o1_mf_nnndf_TAG20110713T005521_71rz3sd8_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_13/o1_mf_nnndf_TAG20110713T005521_71rz3sd8_.bkp tag=TAG20110713T005521

channel ORA_DISK_1: restore complete, elapsed time: 00:00:07

Finished restore at 13-JUL-11

 

RMAN> recover datafile 5;

 

Starting recover at 13-JUL-11

using channel ORA_DISK_1

 

starting media recovery

media recovery complete, elapsed time: 00:00:00

 

Finished recover at 13-JUL-11

 

RMAN> sql "alter database datafile 5 online";

 

sql statement: alter database datafile 5 online

 

RMAN>

 

 

表空间恢复

l  sql “alter tablespace users offline”;

l  restore tablespace users;

l  recover tablespace users;

l  sql “alter tablespace users online”;

 

SQL> select tablespace_name from dba_tablespaces;

 

TABLESPACE_NAME

------------------------------

SYSTEM

UNDOTBS1

SYSAUX

TEMP

USERS

EXAMPLE

 

6 rows selected.

 

SQL>

 

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 14 23:29:42 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: ORCL (DBID=1267524952)

 

RMAN> sql "alter tablespace example offline";

 

using target database control file instead of recovery catalog

sql statement: alter tablespace example offline

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03009: failure of sql command on default channel at 07/14/2011 23:30:55

RMAN-11003: failure during parse/execution of SQL statement: alter tablespace example offline

ORA-01116: error in opening database file 5

ORA-01110: data file 5: '/u01/app/oracle/oradata/orcl/example01.dbf'

ORA-27041: unable to open file

Linux Error: 2: No such file or directory

Additional information: 3

 

RMAN> sql "alter tablespace example offline immediate";

 

sql statement: alter tablespace example offline immediate

 

RMAN> restore tablespace example;

 

Starting restore at 14-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=146 devtype=DISK

 

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_13/o1_mf_nnndf_TAG20110713T005521_71rz3sd8_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_13/o1_mf_nnndf_TAG20110713T005521_71rz3sd8_.bkp tag=TAG20110713T005521

channel ORA_DISK_1: restore complete, elapsed time: 00:00:57

Finished restore at 14-JUL-11

 

RMAN> recover tablespace example;

 

Starting recover at 14-JUL-11

using channel ORA_DISK_1

 

starting media recovery

media recovery complete, elapsed time: 00:00:08

 

Finished recover at 14-JUL-11

 

RMAN> sql "alter tablespace example online";

 

sql statement: alter tablespace example online

 

RMAN> quit

 

catalog方式完全恢复

l  数据库出现问题

l  startup nomount;

l  restore controlfile from autobackup;

l  alter database mount;

l  restore database;

l  recover database;

l  alter database open resetlogs;

 

[oracle@station23 ~]$ cd /u01/app/oracle/oradata/orcl/

[oracle@station23 orcl]$ ls

control01.ctl  example01.dbf  redo03.log    temp01.dbf

control02.ctl  redo01.log     sysaux01.dbf  undotbs01.dbf

control03.ctl  redo02.log     system01.dbf  users01.dbf

[oracle@station23 orcl]$ rm *

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Sat Jul 16 11:56:59 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00554: initialization of internal recovery manager package failed

RMAN-06003: ORACLE error from target database:

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control01.ctl'

ORA-27041: unable to open file

Linux Error: 2: No such file or directory

Additional information: 3

[oracle@station23 orcl]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 16 11:57:15 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> shutdown abort;

ORA-01031: insufficient privileges

SQL> conn /as sysdba

Connected.

SQL> shutdown abort;

ORACLE instance shut down.

SQL> quit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

[oracle@station23 orcl]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Sat Jul 16 11:58:10 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database (not started)

 

RMAN> startup nomount;

 

Oracle instance started

 

Total System Global Area     683671552 bytes

 

Fixed Size                     1221276 bytes

Variable Size                197135716 bytes

Database Buffers             482344960 bytes

Redo Buffers                   2969600 bytes

 

RMAN> restore controlfile from autobackup;

 

Starting restore at 16-JUL-11

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

 

recovery area destination: /u01/app/oracle/flash_recovery_area

database name (or database unique name) used for search: ORCL

channel ORA_DISK_1: autobackup found in the recovery area

channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_07_16/o1_mf_s_756647088_72229k32_.bkp

channel ORA_DISK_1: control file restore from autobackup complete

output filename=/u01/app/oracle/oradata/orcl/control01.ctl

output filename=/u01/app/oracle/oradata/orcl/control02.ctl

output filename=/u01/app/oracle/oradata/orcl/control03.ctl

Finished restore at 16-JUL-11

 

RMAN> alter database mount;

 

database mounted

released channel: ORA_DISK_1

 

RMAN> restore database;

 

Starting restore at 16-JUL-11

Starting implicit crosscheck backup at 16-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

Crosschecked 7 objects

Finished implicit crosscheck backup at 16-JUL-11

 

Starting implicit crosscheck copy at 16-JUL-11

using channel ORA_DISK_1

Finished implicit crosscheck copy at 16-JUL-11

 

searching for all files in the recovery area

cataloging files...

cataloging done

 

List of Cataloged Files

=======================

File Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_07_16/o1_mf_s_756647088_72229k32_.bkp

 

using channel ORA_DISK_1

 

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf

restoring datafile 00002 to /u01/app/oracle/oradata/orcl/undotbs01.dbf

restoring datafile 00003 to /u01/app/oracle/oradata/orcl/sysaux01.dbf

restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf

restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_15/o1_mf_nnndf_TAG20110715T002701_71y66p25_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_15/o1_mf_nnndf_TAG20110715T002701_71y66p25_.bkp tag=TAG20110715T002701

channel ORA_DISK_1: restore complete, elapsed time: 00:05:22

Finished restore at 16-JUL-11

 

RMAN> recover database;

 

Starting recover at 16-JUL-11

using channel ORA_DISK_1

 

starting media recovery

 

archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_3_72225txy_.arc

archive log thread 1 sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_4_722296my_.arc

archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_3_72225txy_.arc thread=1 sequence=3

archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_4_722296my_.arc thread=1 sequence=4

unable to find archive log

archive log thread=1 sequence=5

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 07/16/2011 12:06:47

RMAN-06054: media recovery requesting unknown log: thread 1 seq 5 lowscn 505294

 

RMAN>

[oracle@station23 orcl]$ vim /u01/app/oracle/product/10.2.0/db_1/dbs/

hc_orcl.dat     init.ora        lkORCL          snapcf_orcl.f

initdw.ora      initorcl.ora    orapworcl       spfileorcl.ora

[oracle@station23 orcl]$ vim /u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora

末尾加上一行

*._allow_resetlogs_corruption='TRUE'

[oracle@station23 orcl]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 16 12:17:13 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected.

SQL> shutdown immediate;

ORA-01109: database not open

 

 

Database dismounted.

ORACLE instance shut down.

SQL> startup pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora mount

ORACLE instance started.

 

Total System Global Area  683671552 bytes

Fixed Size                  1221276 bytes

Variable Size             197135716 bytes

Database Buffers          482344960 bytes

Redo Buffers                2969600 bytes

Database mounted.

SQL> alter database open resetlogs;

 

Database altered.

 

SQL> quit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

[oracle@station23 orcl]$ ls

control01.ctl  example01.dbf  redo03.log    temp01.dbf

control02.ctl  redo01.log     sysaux01.dbf  undotbs01.dbf

control03.ctl  redo02.log     system01.dbf  users01.dbf

[oracle@station23 orcl]$

这样做会有数据的丢失。

 

基于SCN的恢复

l  startup mount;

l  restore database UNTIL SCN

l  recover database UNTIL SCN

l  alter database open resetlogs;

 

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     683671552 bytes

 

Fixed Size                     1221276 bytes

Variable Size                197135716 bytes

Database Buffers             482344960 bytes

Redo Buffers                   2969600 bytes

 

RMAN> restore database until scn 505306;

 

Starting restore at 16-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=157 devtype=DISK

 

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf

restoring datafile 00002 to /u01/app/oracle/oradata/orcl/undotbs01.dbf

restoring datafile 00003 to /u01/app/oracle/oradata/orcl/sysaux01.dbf

restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf

restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_15/o1_mf_nnndf_TAG20110715T002701_71y66p25_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_07_15/o1_mf_nnndf_TAG20110715T002701_71y66p25_.bkp tag=TAG20110715T002701

channel ORA_DISK_1: restore complete, elapsed time: 00:03:39

Finished restore at 16-JUL-11

 

RMAN> recover database until scn 505306;

 

Starting recover at 16-JUL-11

using channel ORA_DISK_1

 

starting media recovery

 

archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_3_72225txy_.arc

archive log thread 1 sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_4_722296my_.arc

archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_3_72225txy_.arc thread=1 sequence=3

archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_16/o1_mf_1_4_722296my_.arc thread=1 sequence=4

media recovery complete, elapsed time: 00:00:16

Finished recover at 16-JUL-11

 

RMAN> alter database open resetlogs;

 

database opened

 

RMAN>

 

catalog mode

l  创建catalog所用表空间

  SQL>create tablespace rman_ts datafile ‘’ size 20M;

l  创建RMAN用户并授权

     SQL>create user rman identified by rman default tablespace rman_ts t quota unlimited on rman_ts;

     SQL>grant recovery_catalog_owner to rman;

l  创建恢复目录

       rman catalog rman/rman

 RMAN>create catalog tablespace rman_ts;

     RMAN>register database;

 

[oracle@station23 orcl]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 16 17:30:39 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected.

SQL> create tablespace rman_ts datafile '/u01/app/oracle/rmants.dbf' size 20M;

 

Tablespace created.

 

SQL> create user rman identified by rman default tablespace rman_ts quota unlimited on rman_ts;

 

User created.

 

SQL> grant recovery_catalog_owner to rman;

 

Grant succeeded.

 

SQL> select * from dba_sys_privs where grantee='RECOVERY_CATALOG_OWNER';

 

GRANTEE                        PRIVILEGE                                ADM

------------------------------ ---------------------------------------- ---

RECOVERY_CATALOG_OWNER         CREATE SYNONYM                           NO

RECOVERY_CATALOG_OWNER         CREATE CLUSTER                           NO

RECOVERY_CATALOG_OWNER         ALTER SESSION                            NO

RECOVERY_CATALOG_OWNER         CREATE DATABASE LINK                     NO

RECOVERY_CATALOG_OWNER         CREATE PROCEDURE                         NO

RECOVERY_CATALOG_OWNER         CREATE SEQUENCE                          NO

RECOVERY_CATALOG_OWNER         CREATE TABLE                             NO

RECOVERY_CATALOG_OWNER         CREATE SESSION                           NO

RECOVERY_CATALOG_OWNER         CREATE TYPE                              NO

RECOVERY_CATALOG_OWNER         CREATE VIEW                              NO

RECOVERY_CATALOG_OWNER         CREATE TRIGGER                           NO

 

11 rows selected.

grant RECOVERY_CATALOG_OWNER所具有的权限

 

SQL> quit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

[oracle@station23 orcl]$ rman catalog rman/rman

 

Recovery Manager: Release 10.2.0.1.0 - Production on Sat Jul 16 17:45:13 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to recovery catalog database

 

RMAN> create catalog tablespace rman_ts;

 

recovery catalog created

 

RMAN> register database;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of register command at 07/16/2011 17:47:34

RMAN-06171: not connected to target database

 

RMAN> connect target /

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

 

RMAN> register database;

 

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

 

RMAN> quit

[oracle@station23 orcl]$ mkdir /u01/app/rmanbak/

[oracle@station23 orcl]$ rman target / catalog rman/rman

 

Recovery Manager: Release 10.2.0.1.0 - Production on Sat Jul 16 17:59:46 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: ORCL (DBID=1267524952)

connected to recovery catalog database

 

RMAN> backup format '/u01/app/rmanbak/full_%T_%t.bak' database;

 

Starting backup at 16-JUL-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=144 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf

input datafile fno=00003 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf

input datafile fno=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf

input datafile fno=00002 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf

input datafile fno=00006 name=/u01/app/oracle/rmants.dbf

input datafile fno=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf

channel ORA_DISK_1: starting piece 1 at 16-JUL-11

channel ORA_DISK_1: finished piece 1 at 16-JUL-11

piece handle=/u01/app/rmanbak/full_20110716_756669643.bak tag=TAG20110716T180042 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:09:51

Finished backup at 16-JUL-11

 

Starting Control File and SPFILE Autobackup at 16-JUL-11

piece handle=/u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_07_16/o1_mf_s_756670240_722rx1t2_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 16-JUL-11

starting full resync of recovery catalog

full resync complete

 

RMAN>

 

阅读(801) | 评论(0) | 转发(0) |
0

上一篇:随感~~

下一篇:一次端口扫描任务

给主人留下些什么吧!~~