ITPub博客

首页 > 数据库 > Oracle > oracle11gR2_64之rman异机恢复(FS->FS)完整案例

oracle11gR2_64之rman异机恢复(FS->FS)完整案例

Oracle 作者:cvBertie 时间:2014-09-23 16:49:41 0 删除 编辑

=========================================================================================================================
                                               oracle11gR2_64之rman异机恢复(FS->FS)完整案例
=========================================================================================================================    
    Rman的异机恢复的作用很多,比如数据库迁移,数据库恢复,基于数据库架构调整的还原恢复(比如从RAC-->>单实例,ASM-->>文件系统),有时候搭建测试环境也会用到,不过,这种情况下相信选择数据库复制方式比较方便。

    这次做的是做基于ASM存储的生产库rman备份到普通文件系统的还原恢复,我们原来有数据库架构是基于普通文件系统的单实例,后来改为基于ASM的单实例,所以这次的测试重要性不言而喻:一是测试备份的有效性,二是如果生产库异常崩溃,且恢复时间不确定,又不希望影响业务太多时,可以将生产库的备份还原恢复到以前的文件系统库上。

下面是文件系统到文件系统的普通异机还原恢复完整案例:

       异机迁移(ASM-->>FS)请参见我的另外一篇博文:http://blog.itpub.net/29119536/viewspace-1171236/

(1)环境明细:

 

源库

目标库

操作系统

Redhat5 64位

Redhat5 64位

主机名

dg.com

rman.com

IP

192.168.11.112

192.168.11.114

数据库版本

oracle 11.2.0.1.0

oracle 11.2.0.1.0

存储方式

文件系统

文件系统

ORACLE_HOME 

/u01/app/oracle/product/11.2.0/db_1

/u01/app/oracle/product/11.2.0/db_1

ORACLE_SID

standby

standby

(2)主库信息及库库备份明细:

----->>主库信息:

SQL> select file_id,file_name from dba_data_files order by 1;

 

   FILE_ID FILE_NAME

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

         1 /u01/app/oracle/oradata/standby/system01.dbf

         2 /u01/app/oracle/oradata/standby/sysaux01.dbf

         3 /u01/app/oracle/oradata/standby/undotbs01.dbf

         4 /u01/app/oracle/oradata/standby/users01.dbf

         5 /u01/app/oracle/oradata/standby/example01.dbf

 

SQL> show user;

USER is "SYS"
--创建新表空间并在其中建表对db进行更新

SQL> create tablespace recover  datafile '/u01/app/oracle/oradata/standby/recover.dbf' size 50m  autoextend on maxsize 500m;

 

Tablespace created.

 

SQL> select file_id,file_name from dba_data_files order by 1;

 

   FILE_ID FILE_NAME

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

         1 /u01/app/oracle/oradata/standby/system01.dbf

         2 /u01/app/oracle/oradata/standby/sysaux01.dbf

         3 /u01/app/oracle/oradata/standby/undotbs01.dbf

         4 /u01/app/oracle/oradata/standby/users01.dbf

         5 /u01/app/oracle/oradata/standby/example01.dbf

         6 /u01/app/oracle/oradata/standby/recover.dbf

 

6 rows selected.

 

SQL> create table recover(id number,ename varchar2(50)) tablespace recover;

 

Table created.

 

SQL> begin

  2  for i in 1..9 loop   

  3  insert into recover values(i,'recover'||i);

  4  end loop;

  5  commit;

  6  end;

  7  /

 

PL/SQL procedure successfully completed.

 

SQL> select * from recover;

 

        ID ENAME

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

         1 recover1

         2 recover2

         3 recover3

         4 recover4

         5 recover5

         6 recover6

         7 recover7

         8 recover8

         9 recover9

 

9 rows selected.

 

SQL> select group#,thread#,sequence#,status from v$log;

 

    GROUP#    THREAD#  SEQUENCE# STATUS

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

         1          1         33 INACTIVE

         2          1         34 CURRENT

         3          1         32 INACTIVE

SQL> select group#,status,member from v$logfile;

 

    GROUP# STATUS  MEMBER

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

         3         /u01/app/oracle/oradata/standby/redo03.log

         2         /u01/app/oracle/oradata/standby/redo02.log

         1         /u01/app/oracle/oradata/standby/redo01.log

         4         /u01/app/oracle/oradata/standby/stdbyredo01.log

         5         /u01/app/oracle/oradata/standby/stdbyredo02.log

         6         /u01/app/oracle/oradata/standby/stdbyredo03.log

 

6 rows selected.

------>>备份信息:

RMAN> list backup summary;

 

specification does not match any backup in the repository

 

RMAN> 

RMAN> RUN { 

2> allocate channel c1 type disk;

3> allocate channel c2 type disk;

4>  

5> backup  DATABASE FORMAT '/home/oracle/back_dest/db_%U_%T'     TAG='standby_db'; 

6> 

7> sql 'alter system archive log current';

8>  

9> backup FORMAT '/home/oracle/back_dest/arch_%U_%T'   ARCHIVELOG ALL tag='standby_arch';  

10> backup current controlfile tag='standby_ctl' format='/home/oracle/back_dest/ctl_%U_%T';

11> backup spfile tag='standby_spfile' format='/home/oracle/back_dest/spfile_%U_%T';

12>  

13> release channel c2;

14> release channel c1;

15> }

 

released channel: ORA_DISK_1

released channel: ORA_DISK_2

allocated channel: c1

channel c1: SID=31 device type=DISK

 

allocated channel: c2

channel c2: SID=37 device type=DISK

 

Starting backup at 28-MAY-14

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/standby/system01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/standby/users01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/standby/example01.dbf

channel c1: starting piece 1 at 28-MAY-14

channel c2: starting full datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00002 name=/u01/app/oracle/oradata/standby/sysaux01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/standby/undotbs01.dbf

input datafile file number=00006 name=/u01/app/oracle/oradata/standby/recover.dbf

channel c2: starting piece 1 at 28-MAY-14

channel c2: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/db_0op9e3aj_1_1_20140528 tag=STANDBY_DB comment=NONE

channel c2: backup set complete, elapsed time: 00:00:57

channel c1: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/db_0np9e3aj_1_1_20140528 tag=STANDBY_DB comment=NONE

channel c1: backup set complete, elapsed time: 00:00:57

Finished backup at 28-MAY-14

 

Starting Control File and SPFILE Autobackup at 28-MAY-14

piece handle=/u01/app/oracle/flash_recovery_area/STANDBY/autobackup/2014_05_28/o1_mf_s_848760205_9rc1dhhg_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 28-MAY-14

 

sql statement: alter system archive log current

 

Starting backup at 28-MAY-14

current log archived

channel c1: starting archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=13 RECID=2 STAMP=848160475

input archived log thread=1 sequence=14 RECID=10 STAMP=848160536

input archived log thread=1 sequence=15 RECID=9 STAMP=848160535

input archived log thread=1 sequence=16 RECID=3 STAMP=848160529

channel c1: starting piece 1 at 28-MAY-14

channel c2: starting archived log backup set

channel c2: specifying archived log(s) in backup set

input archived log thread=1 sequence=17 RECID=4 STAMP=848160529

input archived log thread=1 sequence=18 RECID=5 STAMP=848160530

input archived log thread=1 sequence=19 RECID=6 STAMP=848160531

input archived log thread=1 sequence=20 RECID=7 STAMP=848160531

input archived log thread=1 sequence=21 RECID=8 STAMP=848160532

input archived log thread=1 sequence=22 RECID=1 STAMP=848160433

input archived log thread=1 sequence=23 RECID=11 STAMP=848161711

input archived log thread=1 sequence=24 RECID=12 STAMP=848162217

input archived log thread=1 sequence=25 RECID=13 STAMP=848162239

input archived log thread=1 sequence=26 RECID=14 STAMP=848162286

input archived log thread=1 sequence=27 RECID=15 STAMP=848162424

input archived log thread=1 sequence=28 RECID=16 STAMP=848162650

input archived log thread=1 sequence=29 RECID=17 STAMP=848162673

channel c2: starting piece 1 at 28-MAY-14

channel c2: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/arch_0rp9e3ci_1_1_20140528 tag=STANDBY_ARCH comment=NONE

channel c2: backup set complete, elapsed time: 00:00:03

channel c2: starting archived log backup set

channel c2: specifying archived log(s) in backup set

input archived log thread=1 sequence=30 RECID=18 STAMP=848163054

input archived log thread=1 sequence=31 RECID=19 STAMP=848181840

input archived log thread=1 sequence=32 RECID=20 STAMP=848185207

input archived log thread=1 sequence=33 RECID=21 STAMP=848239214

input archived log thread=1 sequence=34 RECID=22 STAMP=848759021

input archived log thread=1 sequence=35 RECID=23 STAMP=848759022

input archived log thread=1 sequence=36 RECID=24 STAMP=848760209

input archived log thread=1 sequence=37 RECID=25 STAMP=848760209

channel c2: starting piece 1 at 28-MAY-14

channel c1: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/arch_0qp9e3ci_1_1_20140528 tag=STANDBY_ARCH comment=NONE

channel c1: backup set complete, elapsed time: 00:00:29

channel c2: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/arch_0sp9e3cm_1_1_20140528 tag=STANDBY_ARCH comment=NONE

channel c2: backup set complete, elapsed time: 00:00:25

Finished backup at 28-MAY-14

 

Starting backup at 28-MAY-14

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

including current control file in backup set

channel c1: starting piece 1 at 28-MAY-14

channel c1: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/ctl_0tp9e3dg_1_1_20140528 tag=STANDBY_CTL comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 28-MAY-14

 

Starting backup at 28-MAY-14

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

including current SPFILE in backup set

channel c1: starting piece 1 at 28-MAY-14

channel c1: finished piece 1 at 28-MAY-14

piece handle=/home/oracle/back_dest/spfile_0up9e3dj_1_1_20140528 tag=STANDBY_SPFILE comment=NONE ----spfile备份此次恢复未用到

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 28-MAY-14

 

Starting Control File and SPFILE Autobackup at 28-MAY-14

piece handle=/u01/app/oracle/flash_recovery_area/STANDBY/autobackup/2014_05_28/o1_mf_s_848760244_9rc1fnkv_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 28-MAY-14

 

released channel: c2

 

released channel: c1

 

RMAN> 

 

RMAN> list backup of archivelog all;

List of Backup Sets

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

BS Key  Size       Device Type Elapsed Time Completion Time

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

24      13.53M     DISK        00:00:01     28-MAY-14      

        BP Key: 24   Status: AVAILABLE  Compressed: NO  Tag: STANDBY_ARCH

        Piece Name: /home/oracle/back_dest/arch_0rp9e3ci_1_1_20140528

 

  List of Archived Logs in backup set 24

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

  1    17      1147411    21-MAY-14 1147529    21-MAY-14

  1    18      1147529    21-MAY-14 1149470    21-MAY-14

  1    19      1149470    21-MAY-14 1150928    21-MAY-14

  1    20      1150928    21-MAY-14 1150939    21-MAY-14

  1    21      1150939    21-MAY-14 1151979    21-MAY-14

  1    22      1151979    21-MAY-14 1152164    21-MAY-14

  1    23      1152164    21-MAY-14 1154270    21-MAY-14

  1    24      1154270    21-MAY-14 1155049    21-MAY-14

  1    25      1155049    21-MAY-14 1155074    21-MAY-14

  1    26      1155074    21-MAY-14 1155118    21-MAY-14

  1    27      1155118    21-MAY-14 1155193    21-MAY-14

  1    28      1155193    21-MAY-14 1155437    21-MAY-14

  1    29      1155437    21-MAY-14 1155474    21-MAY-14

 

BS Key  Size       Device Type Elapsed Time Completion Time

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

25      172.23M    DISK        00:00:23     28-MAY-14      

        BP Key: 25   Status: AVAILABLE  Compressed: NO  Tag: STANDBY_ARCH

        Piece Name: /home/oracle/back_dest/arch_0qp9e3ci_1_1_20140528

 

  List of Archived Logs in backup set 25

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

  1    13      1053102    20-MAY-14 1074252    20-MAY-14

  1    14      1074252    20-MAY-14 1089437    20-MAY-14

  1    15      1089437    20-MAY-14 1122193    21-MAY-14

  1    16      1122193    21-MAY-14 1147411    21-MAY-14

 

BS Key  Size       Device Type Elapsed Time Completion Time

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

26      140.96M    DISK        00:00:20     28-MAY-14      

        BP Key: 26   Status: AVAILABLE  Compressed: NO  Tag: STANDBY_ARCH

        Piece Name: /home/oracle/back_dest/arch_0sp9e3cm_1_1_20140528

 

  List of Archived Logs in backup set 26

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

  1    30      1155474    21-MAY-14 1155477    21-MAY-14

  1    31      1155477    21-MAY-14 1175447    21-MAY-14

  1    32      1175447    21-MAY-14 1179630    21-MAY-14

  1    33      1179630    21-MAY-14 1216098    22-MAY-14

  1    34      1216098    22-MAY-14 1226119    28-MAY-14

  1    35      1226119    28-MAY-14 1226127    28-MAY-14

  1    36      1226127    28-MAY-14 1227537    28-MAY-14

  1    37      1227537    28-MAY-14 1227545    28-MAY-14           ------------>>注意这里备份日志sequence最大为37,恢复时就应该是:set until sequence 38;

 

RMAN> 

-------------------------------------------------------------------------------------------------------------------->>

pfile是通过spfile生成,然后scp到目的地,没有通过restore pfile from ‘’方式进行.

(3)还原恢复过程:

------->>修改scp过来的pfile文件(这里应该注意,源库可能空间较大,关于sga,pga等酌情根据目标库修改)然后startup 到nomount状态,restorecontrolfile,然后restore database,最后recover database

[oracle@rman dbs]$ cat initstandby.ora

standby.__db_cache_size=276824064

standby.__java_pool_size=4194304

standby.__large_pool_size=4194304

standby.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

standby.__pga_aggregate_target=339738624

standby.__sga_target=503316480

standby.__shared_io_pool_size=0

standby.__shared_pool_size=209715200

standby.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/standby/adump'

*.audit_trail='db'

*.compatible='11.2.0.1.0'

*.control_files='/u01/app/oracle/oradata/standby/control01.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='primary'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=4070572032

*.db_unique_name='standby'

*.diagnostic_dest='/u01/app/oracle'

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

*.log_archive_dest_1='location=/u01/app/oracle/oradata/arch'

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

*.memory_target=842006528

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.standby_file_management='auto'

*.undo_tablespace='UNDOTBS1'

--------------------------------->>创建相关目录,并注意权限(我这里是用安装oracle软件有oracle用户创建,就不需要考虑目录权限问题):

mkdir -p /u01/app/oracle/oradata/standby

mkdir -p /u01/app/oracle/oradata/arch

mkdir -p /u01/app/oracle/product/11.2.0/db_1/dbs

mkdir -p /u01/app/oracle/product/11.2.0/db_1/network/admin

mkdir -p /u01/app/oracle/flash_recovery_area

mkdir -p  /u01/app/oracle/admin/standby/adump

---------------------------------->>还原恢复过程:

SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initstandby.ora';

ORACLE instance started.

Total System Global Area  839282688 bytes

Fixed Size                  2217992 bytes

Variable Size             557844472 bytes

Database Buffers          276824064 bytes

Redo Buffers                2396160 bytes

SQL> 

SQL> 

SQL> select instance_name,status from v$instance;

 

INSTANCE_NAME    STATUS

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

standby          STARTED

------------------------------------------------------->>

[oracle@rman admin]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 28 16:04:47 2014

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: STANDBY (not mounted)

 

RMAN> set DBID 1685534234;

 

executing command: SET DBID

 ---restore controlfile

RMAN> restore controlfile from '/home/oracle/back_dest/ctl_0tp9e3dg_1_1_20140528';

 

Starting restore at 28-MAY-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=20 device type=DISK

 

channel ORA_DISK_1: restoring control file

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

output file name=/u01/app/oracle/oradata/standby/control01.ctl

Finished restore at 28-MAY-14

 

RMAN> alter database mount;
------restore database+recover database

RMAN> run {

2>  set until sequence 38;

3>  restore database; 

4>  recover database;}

 

executing command: SET until clause

 

Starting restore at 28-MAY-14

Starting implicit crosscheck backup at 28-MAY-14

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=19 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=21 device type=DISK

Crosschecked 5 objects

Crosschecked 1 objects

Finished implicit crosscheck backup at 28-MAY-14

 

Starting implicit crosscheck copy at 28-MAY-14

using channel ORA_DISK_1

using channel ORA_DISK_2

Finished implicit crosscheck copy at 28-MAY-14

 

searching for all files in the recovery area

cataloging files...

no files cataloged

 

using channel ORA_DISK_1

using channel ORA_DISK_2

 

channel ORA_DISK_1: starting datafile backup set restore

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

channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/standby/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/standby/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/standby/recover.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/back_dest/db_0op9e3aj_1_1_20140528

channel ORA_DISK_2: starting datafile backup set restore

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

channel ORA_DISK_2: restoring datafile 00001 to /u01/app/oracle/oradata/standby/system01.dbf

channel ORA_DISK_2: restoring datafile 00004 to /u01/app/oracle/oradata/standby/users01.dbf

channel ORA_DISK_2: restoring datafile 00005 to /u01/app/oracle/oradata/standby/example01.dbf

channel ORA_DISK_2: reading from backup piece /home/oracle/back_dest/db_0np9e3aj_1_1_20140528

channel ORA_DISK_1: piece handle=/home/oracle/back_dest/db_0op9e3aj_1_1_20140528 tag=STANDBY_DB

channel ORA_DISK_1: restored backup piece 1

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

channel ORA_DISK_2: piece handle=/home/oracle/back_dest/db_0np9e3aj_1_1_20140528 tag=STANDBY_DB

channel ORA_DISK_2: restored backup piece 1

channel ORA_DISK_2: restore complete, elapsed time: 00:01:07

Finished restore at 28-MAY-14

 

Starting recover at 28-MAY-14

using channel ORA_DISK_1

using channel ORA_DISK_2

 

starting media recovery

 

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=36

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=37

channel ORA_DISK_1: reading from backup piece /home/oracle/back_dest/arch_0sp9e3cm_1_1_20140528

channel ORA_DISK_1: piece handle=/home/oracle/back_dest/arch_0sp9e3cm_1_1_20140528 tag=STANDBY_ARCH

channel ORA_DISK_1: restored backup piece 1

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

archived log file name=/u01/app/oracle/oradata/arch/1_36_848051550.dbf thread=1 sequence=36

archived log file name=/u01/app/oracle/oradata/arch/1_37_848051550.dbf thread=1 sequence=37

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

Finished recover at 28-MAY-14

 

RMAN> alter database open resetlogs;

 

database opened

----------------------------------->>

[oracle@rman dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 28 16:13:21 2014

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> select instance_name,status from v$instance;

 

INSTANCE_NAME    STATUS

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

standby          OPEN

 ---验证数据有效性

SQL> select * from recover;

 

        ID ENAME

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

         1 recover1

         2 recover2

         3 recover3

         4 recover4

         5 recover5

         6 recover6

         7 recover7

         8 recover8

         9 recover9

 

9 rows selected.

 ---日志序列归零

SQL> select group#,thread#,sequence#,status from v$log;

 

    GROUP#    THREAD#  SEQUENCE# STATUS

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

         1          1          1 CURRENT

         2          1          0 UNUSED

         3          1          0 UNUSED

 

SQL> col member for a50;
--验证logfile和standbylog

SQL> select group#,status,member from v$logfile;

 

    GROUP# STATUS  MEMBER

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

         3         /u01/app/oracle/oradata/standby/redo03.log

         2         /u01/app/oracle/oradata/standby/redo02.log

         1         /u01/app/oracle/oradata/standby/redo01.log

         4         /u01/app/oracle/oradata/standby/stdbyredo01.log

         5         /u01/app/oracle/oradata/standby/stdbyredo02.log

         6         /u01/app/oracle/oradata/standby/stdbyredo03.log

 

6 rows selected.

 

SQL> select tablespace_name,status from dba_tablespaces;

 

TABLESPACE_NAME                STATUS

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

SYSTEM                         ONLINE

SYSAUX                         ONLINE

UNDOTBS1                       ONLINE

TEMP                           ONLINE

USERS                          ONLINE

EXAMPLE                        ONLINE

RECOVER                        ONLINE

 

7 rows selected.

--创建spfile 

SQL> create spfile from pfile;

 

File created.

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup;

ORACLE instance started.

 

Total System Global Area  839282688 bytes

Fixed Size                  2217992 bytes

Variable Size             557844472 bytes

Database Buffers          276824064 bytes

Redo Buffers                2396160 bytes

Database mounted.

Database opened.
--确定此时目标库为spfile启动

SQL> select decode(count(*),1,'spfile','pfile') from v$spparameter where rownum=1 and isspecified = 'TRUE';

 

DECODE

------

spfile

 

SQL> 

------->>修改listener.ora,tnsnames.ora

[oracle@recover admin]$ more listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.114)(PORT = 1521))

    )

  )

 

ADR_BASE_LISTENER = /u01/app/oracle

 

[oracle@recover admin]$ more tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

standby =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.114)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = bus)

    )

  )


 ----------------------OVER GAME

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29598413/viewspace-1278383/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: ORACLE坏块总结
请登录后发表评论 登录
全部评论

注册时间:2014-04-09

  • 博文量
    27
  • 访问量
    93552