oracle11gR2_64之rman異機恢復(FS->FS)完整案例

dbhelper發表於2015-03-01

=========================================================================================================================
                                               oracle11gR2_64之rman異機恢復(FS->FS)完整案例
=========================================================================================================================    
    Rman的異機恢復的作用很多,比如資料庫遷移,資料庫恢復,基於資料庫架構調整的還原恢復(比如從RAC--&gt>單例項,ASM--&gt>檔案系統),有時候搭建測試環境也會用到,不過,這種情況下相信選擇資料庫複製方式比較方便。

    這次做的是做基於ASM儲存的生產庫rman備份到普通檔案系統的還原恢復,我們原來有資料庫架構是基於普通檔案系統的單例項,後來改為基於ASM的單例項,所以這次的測試重要性不言而喻:一是測試備份的有效性,二是如果生產庫異常崩潰,且恢復時間不確定,又不希望影響業務太多時,可以將生產庫的備份還原恢復到以前的檔案系統庫上。

下面是檔案系統到檔案系統的普通異機還原恢復完整案例:

       異機遷移(ASM--&gt>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)主庫資訊及庫庫備份明細:

-----&gt>主庫資訊:

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.

------&gt>備份資訊:

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           ------------&gt>注意這裡備份日誌sequence最大為37,恢復時就應該是:set until sequence 38;

 

RMAN> 

--------------------------------------------------------------------------------------------------------------------&gt>

pfile是透過spfile生成,然後scp到目的地,沒有透過restore pfile from ‘’方式進行.

(3)還原恢復過程:

-------&gt>修改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'

---------------------------------&gt>建立相關目錄,並注意許可權(我這裡是用安裝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

----------------------------------&gt>還原恢復過程:

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

-------------------------------------------------------&gt>

[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

-----------------------------------&gt>

[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> 

-------&gt>修改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部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1444321/,如需轉載,請註明出處,否則將追究法律責任。

相關文章