仅自己可见rman异机数据库恢复实例一则

来源:互联网 发布:软件复杂度度量方法 编辑:程序博客网 时间:2024/05/16 15:39

1.还原spfile文件

[oracle@server118 rmanbak122]/opt/dbbak/rmanbak122

[oracle@server118 rmanbak122]$ ls -l

总用量2134052

-rw-r-----  1 oracle oinstall 2029035520  7月29 13:04 CUSDB_81.datafile_20110729

-rw-r-----  1 oracle oinstall    9240576  7月29 13:04 CUSDB_82.datafile_20110729

-rw-r-----  1 oracle oinstall   90955776  7月29 13:04 CUSDB_83.datafile_20110729

-rw-r-----  1 oracle oinstall   32768000  7月29 13:05 CUSDB_84.datafile_20110729

-rw-r-----  1 oracle oinstall    7405568  7月29 13:05 CUSDB_87.controlfile_20110729

-rw-r-----  1 oracle oinstall      98304  7月29 13:05 CUSDB_88.spfile_20110729

-rw-r-----  1 oracle oinstall    3984384  7月29 13:05 CUSDB_89.datafile_20110729

-rw-r-----  1 oracle oinstall    9598464  7月29 13:05 CUSDB_90.archivelog_20110729

-rw-r--r--  1 oracle oinstall       6879  7月29 13:05 rmanlog_122.log

[oracle@server118 rmanbak122]$ cp CUSDB_88.spfile_20110729 $ORACLE_HOME/dbs

[oracle@server118 rmanbak122]$ cd $ORACLE_HOME/dbs

[oracle@server118 dbs]$ cat CUSDB_88.spfile_20110729

cusdb.__java_pool_size=16777216

cusdb.__large_pool_size=16777216

cusdb.__shared_pool_size=2617245696

cusdb.__streams_pool_size=33554432

*.audit_file_dest='/u01/app/ora10g/admin/cusdb/adump'

*.background_dump_dest='/u01/app/ora10g/admin/cusdb/bdump'

*.compatible='10.2.0.5.0'

*.control_files='+DATA/cusdb/controlfile/current.261.757427029','+FRA/cusdb/controlfile/current.256.757427029'

*.core_dump_dest='/u01/app/ora10g/admin/cusdb/cdump'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='cusdb'

*.db_recovery_file_dest_size=209379655680

*.db_recovery_file_dest='+FRA'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=cusdbXDB)'

*.job_queue_processes=10

*.log_archive_dest_1='LOCATION=/u01/archivelog'

*.log_archive_format='%t_%s_%r.dbf'

*.nls_language='SIMPLIFIED CHINESE'

*.nls_territory='CHINA'

*.open_cursors=1000

*.pga_aggregate_target=5052039168

*.processes=800

*.remote_login_passwordfile='EXCLUSIVE'

*.sessions=885

*.sga_max_size=25769803776

*.sga_target=25769803776

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u01/app/ora10g/admin/cusdb/udump'

 

--把spfile文件的内容复制到生成到initcusdb.ora文件里

[oracle@server118 dbs]ls initcusdb.ora

initcusdb.ora

[oracle@server118 dbs]$ export ORACLE_SID=cusdb

 

2.还原数据文件

[oracle@server118 dbs]$ rman target /

RMAN> startup nomount pfile='initcusdb.ora';

RMAN> restore controlfile from '/opt/dbbak/rmanbak122/CUSDB_87.controlfile_20110729';

RMAN> Alter database mount;

RMAN> catalog start with '/opt/oradbak/122bak/';

RMAN> restore database;

RMAN> exit

 

 

3.还原归档日志

RMAN> list backup of archivelog all;

 

using target database control file instead of recovery catalog

 

List of Backup Sets

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

 

BS Key  Size       Device Type Elapsed Time Completion Time

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

85      9.15M      DISK        00:00:00     29-7月-11     

        BP Key: 88   Status: AVAILABLE  Compressed: YES  Tag: TAG20110729T114534

        Piece Name: /opt/dbbak/rmanbak122/CUSDB_90.archivelog_20110729

 

  List of Archived Logs in backup set 85

  Thrd Seq     Low SCN    Low Time   Next SCN   Next Time

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

  1    112     45061959717 29-7月-11 45061982967 29-7月-11

 

BS Key  Size       Device Type Elapsed Time Completion Time

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

88      3.80M      DISK        00:00:00     29-7月-11     

        BP Key: 92   Status: AVAILABLE  Compressed: YES  Tag: TAG20110729T112410

        Piece Name: /opt/dbbak/rmanbak122/CUSDB_89.datafile_20110729

 

  List of Archived Logs in backup set 88

  Thrd Seq     Low SCN    Low Time   Next SCN   Next Time

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

  1    111     45061950002 29-7月-11 45061959717 29-7月-11

 

RMAN> restore archivelog from sequence 111 until sequence 112;

 

4.恢复数据库

RMAN> recover database;

Starting recover at 29-7月-11

using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 111 is already on disk as file /u01/archivelog/1_111_757427030.dbf

archive log thread 1 sequence 112 is already on disk as file /u01/archivelog/1_112_757427030.dbf

archive log filename=/u01/archivelog/1_111_757427030.dbf thread=1 sequence=111

archive log filename=/u01/archivelog/1_112_757427030.dbf thread=1 sequence=112

creating datafile fno=11 name=+DATA/cusdb/datafile/utravel.278.757769199

archive log filename=/u01/archivelog/1_112_757427030.dbf thread=1 sequence=112

unable to find archive log

archive log thread=1 sequence=113

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

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

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

RMAN-03002: failure of recover command at 07/29/2011 13:53:55

RMAN-06054: media recovery requesting unknown log: thread 1 seq 113 lowscn 45061982967

 

或是用恢复:

SQL> recover database using backup controlfile until cancel;

 

 

5.打开数据库

[oracle@server118 dbs]$ sqlplus "/as sysdba"

SQL> alter database open resetlogs;

Database altered.

 

6.修改参数文件initcusdb.ora

当前数据库状态:

SQL> select open_mode from v$database;

 

OPEN_MODE

----------

READ WRITE

 

SQL> select name from v$controlfile;

 

NAME

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

+DATA/cusdb/controlfile/current.349.762278747

+FRA/cusdb/controlfile/current.320.762278747

 

修改参数文件

control_files='+DATA/cusdb/controlfile/current.349.762278747','+FRA/cusdb/controlfile/current.320.762278747'

 

 

7.重启监听注册数据库

 

[oracle@server118 admin]$ lsnrctl start LISTENER

 

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 29-7月-2011 14:10:00

 

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

 

Starting /u01/oracle/10.2.0.4/db_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 10.2.0.5.0 - Production

System parameter file is /u01/oracle/10.2.0.4/db_1/network/admin/listener.ora

Log messages written to /u01/oracle/10.2.0.4/db_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server118)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server118)(PORT=1521)))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production

Start Date                29-7月-2011 14:10:00

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/oracle/10.2.0.4/db_1/network/admin/listener.ora

Listener Log File         /u01/oracle/10.2.0.4/db_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server118)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

[oracle@server118 admin]$ lsnrctl status

 

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 29-7月-2011 14:10:11

 

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server118)(PORT=1521)))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production

Start Date                29-7月-2011 14:10:00

Uptime                    0 days 0 hr. 0 min. 11 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/oracle/10.2.0.4/db_1/network/admin/listener.ora

Listener Log File         /u01/oracle/10.2.0.4/db_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server118)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...

Service "+ASM_XPT" has 1 instance(s).

  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "cusdb" has 1 instance(s).

  Instance "cusdb", status READY, has 1 handler(s) for this service...

Service "cusdbXDB" has 1 instance(s).

  Instance "cusdb", status READY, has 1 handler(s) for this service...

Service "cusdb_XPT" has 1 instance(s).

  Instance "cusdb", status READY, has 1 handler(s) for this service...

The command completed successfully

原创粉丝点击