熱備下的測試庫搭建

lhrbest發表於2015-01-17

熱備下的測試庫搭建

blog文件結構圖:

image

 

 

其實在某些情況下,測試庫的搭建也作為備份的一種方式,本節就來看在有熱備的情況下如何搭建測試庫。

 

 

冷備下的測試庫搭建http://blog.itpub.net/26736162/viewspace-1352243/

採用duplicate搭建測試庫(asm--》os檔案): http://blog.itpub.net/26736162/viewspace-1224861/

採用duplicate複製活動資料來搭建測試庫: http://blog.itpub.net/26736162/viewspace-1223247/

在只有rman備份的情況下如何搭建測試庫:http://blog.itpub.net/26736162/viewspace-1223253/

 

1  基礎知識

熱備份是當資料庫開啟並對使用者有效是的作業系統級的資料備份。熱備份只能用於ARCHIVELOG方式的資料庫。在資料檔案備份之前,對應的表空間必須透過使用ALTER TABLESPACE …… BEGIN BACKUP以備份方式放置。然後組成表空間的資料檔案可以使用類似冷備份的作業系統命令進行複製。在資料檔案用作業系統命令複製後,應使用ALTER TABLESPACE …… END BACKUP命令使表空間脫離熱備份方式。

 

2  本次實驗環境簡介

 

專案

source

target

IP地址

192.168.59.130

192.168.59.10

ORACLE_HOME

/u01/app/oracle/product/11.2.0/dbhome_1

/u01/app/oracle/product/11.2.0/dbhome_1

ORACLE_SID

utf8test

utf8test

是否歸檔

Y

Y

hostname

rhel6_lhr

testdb

 

3  源庫生成備份檔案

源庫執行熱備指令碼:

set feedback off

set heading off

set verify off

set trimspool off

set pagesize 0

set linesize 200

define dir = '/home/oracle/oracle_bk/hotbak'

define script = '/tmp/hotbak_tb.sql' 

spool &script

select 'alter tablespace '|| tablespace_name ||' begin backup ;' ||

chr(10)||'ho cp ' || file_name || ' &dir ' ||

chr(10)||'alter tablespace '|| tablespace_name || ' end backup;'

from dba_data_files order by tablespace_name;

spool off

alter system switch logfile;

start &script

alter system switch logfile;

alter database backup controlfile to '&dir/controlbak.ctl';

alter database backup controlfile to trace as '&dir/controlbak.sql';

create pfile = '&dir/initorcl.ora' from spfile;

 

[oracle@rhel6_lhr ~]$ echo $ORACLE_SID

utf8test

[oracle@rhel6_lhr ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jan 17 16:00:47 2015

 

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

 

 

Connected to:

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

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

 

SQL> select * from v$version;

 

BANNER

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

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

PL/SQL Release 11.2.0.3.0 - Production

CORE 11.2.0.3.0 Production

TNS for Linux: Version 11.2.0.3.0 - Production

NLSRTL Version 11.2.0.3.0 - Production

 

SQL> ho more /tmp/hotbak.sql

set feedback off

set heading off

set verify off

set trimspool off

set pagesize 0

set linesize 200

define dir = '/home/oracle/oracle_bk/hotbak'

define script = '/tmp/hotbak_tb.sql' 

spool &script

select 'alter tablespace '|| tablespace_name ||' begin backup ;' ||

chr(10)||'ho cp ' || file_name || ' &dir ' ||

chr(10)||'alter tablespace '|| tablespace_name || ' end backup;'

from dba_data_files order by tablespace_name;

spool off

alter system switch logfile;

start &script

alter system switch logfile;

alter database backup controlfile to '&dir/controlbak.ctl';

alter database backup controlfile to trace as '&dir/controlbak.sql';

create pfile = '&dir/initorcl.ora' from spfile;

 

SQL> @/tmp/hotbak.sql;

alter tablespace SYSAUX begin backup ;

ho cp /u01/app/oracle/oradata/utf8test/sysaux01.dbf /home/oracle/oracle_bk/hotbak

alter tablespace SYSAUX end backup;

 

alter tablespace SYSTEM begin backup ;

ho cp /u01/app/oracle/oradata/utf8test/system01.dbf /home/oracle/oracle_bk/hotbak

alter tablespace SYSTEM end backup;

 

alter tablespace UNDOTBS1 begin backup ;

ho cp /u01/app/oracle/oradata/utf8test/undotbs01.dbf /home/oracle/oracle_bk/hotbak

alter tablespace UNDOTBS1 end backup;

 

alter tablespace USERS begin backup ;

ho cp /u01/app/oracle/oradata/utf8test/users01.dbf /home/oracle/oracle_bk/hotbak

alter tablespace USERS end backup;

 

 

 

 

 

SQL> ho ls -l /home/oracle/oracle_bk/hotbak

total 1391972

-rw-r----- 1 oracle asmadmin   9748480 Jan 17 16:03 controlbak.ctl

-rw-r--r-- 1 oracle asmadmin      6810 Jan 17 16:03 controlbak.sql

-rw-r--r-- 1 oracle asmadmin       889 Jan 17 16:03 initorcl.ora

-rw-r----- 1 oracle oinstall 608182272 Jan 17 16:02 sysaux01.dbf

-rw-r----- 1 oracle oinstall 744497152 Jan 17 16:03 system01.dbf

-rw-r----- 1 oracle oinstall  52436992 Jan 17 16:03 undotbs01.dbf

-rw-r----- 1 oracle oinstall  10493952 Jan 17 16:03 users01.dbf

 

SQL> archive log list;

Database log mode        Archive Mode

Automatic archival        Enabled

Archive destination        /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch

Oldest online log sequence     8

Next log sequence to archive   10

Current log sequence        10

SQL>

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

 

Session altered.

 

SQL> select * from v$log;

GROUP#   THREAD#  SEQUENCE# BYTES  BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME

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

1     1       10   52428800    512 1 NO  CURRENT      1705635 2015-01-17 17:27:28   2.8147E+14

2     1        8   52428800    512 1 YES INACTIVE      1705446 2015-01-17 17:21:27      1705565 2015-01-17 17:26:31

3     1        9   52428800    512 1 YES INACTIVE      1705565 2015-01-17 17:26:31      1705635 2015-01-17 17:27:28

SQL> select SEQUENCE#,NAME,RESETLOGS_CHANGE#,FIRST_CHANGE# from v$archived_log order by SEQUENCE#;

 

SEQUENCE# NAME RESETLOGS_CHANGE# FIRST_CHANGE#

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

1 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_1_869231211.dbf   1658549 1658549

2 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_2_869231211.dbf   1658549 1678937

3 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_3_869231211.dbf   1658549 1679206

4 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_4_869231211.dbf   1658549 1679279

4 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_4_869137332.dbf   1591683 1638296

5 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_5_869231211.dbf   1658549 1700469

5 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_5_869137332.dbf   1591683 1654983

5 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_5_869137332.dbf   1591683 1654983

6 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_6_869137332.dbf   1591683 1656602

6 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_6_869231211.dbf   1658549 1702565

7 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_7_869137332.dbf   1591683 1656674

7 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_7_869231211.dbf   1658549 1702640

8 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_8_869231211.dbf   1658549 1705446

 9 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_9_869231211.dbf   1658549 1705565

 

14 rows selected.

 

SQL>

 

SQL> exit

 

 

4  傳輸備份檔案到target

4.1  傳輸資料檔案

[oracle@rhel6_lhr hotbak]$ pwd

/home/oracle/oracle_bk/hotbak

[oracle@rhel6_lhr hotbak]$ scp -r /home/oracle/oracle_bk/hotbak oracle@192.168.59.10:/home/oracle/oracle_bk/

oracle@192.168.59.10's password:

undotbs01.dbf                                                                                                                                              100%   50MB  50.0MB/s   00:00   

controlbak.ctl                                                                                                                                             100% 9520KB   9.3MB/s   00:00   

initorcl.ora                                                                                                                                               100%  889     0.9KB/s   00:00   

sysaux01.dbf                                                                                                                                               100%  580MB  24.2MB/s   00:24   

users01.dbf                                                                                                                                                100%   10MB  10.0MB/s   00:00   

controlbak.sql                                                                                                                                             100% 6810     6.7KB/s   00:00   

system01.dbf                                                                                                                                               100%  710MB  25.4MB/s   00:28   

You have new mail in /var/spool/mail/oracle

[oracle@rhel6_lhr hotbak]$

 

wps5AA8.tmp 

 

4.2  傳輸歸檔檔案

[oracle@rhel6_lhr dbs]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/

[oracle@rhel6_lhr dbs]$ ll *.dbf

-rw-r----- 1 oracle asmadmin    82432 Jan 17 13:50 arch1_1_869231211.dbf

-rw-r----- 1 oracle asmadmin    61440 Jan 17 13:51 arch1_2_869231211.dbf

-rw-r----- 1 oracle asmadmin    32768 Jan 17 15:22 arch1_3_869231211.dbf

-rw-r----- 1 oracle asmadmin 34149888 Jan 17 11:08 arch1_4_869137332.dbf

-rw-r----- 1 oracle asmadmin  1465856 Jan 17 15:22 arch1_4_869231211.dbf

-rw-r----- 1 oracle asmadmin  1265152 Jan 17 13:06 arch1_5_869137332.dbf

-rw-r----- 1 oracle asmadmin   416256 Jan 17 16:02 arch1_5_869231211.dbf

-rw-r----- 1 oracle asmadmin    32256 Jan 17 13:06 arch1_6_869137332.dbf

-rw-r----- 1 oracle asmadmin    36864 Jan 17 16:03 arch1_6_869231211.dbf

-rw-r----- 1 oracle asmadmin  1580544 Jan 17 13:06 arch1_7_869137332.dbf

-rw-r----- 1 oracle asmadmin  2521088 Jan 17 17:21 arch1_7_869231211.dbf

-rw-r----- 1 oracle asmadmin    14336 Jan 17 17:26 arch1_8_869231211.dbf

-rw-r----- 1 oracle asmadmin    32768 Jan 17 17:27 arch1_9_869231211.dbf

[oracle@rhel6_lhr dbs]$ scp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_7_869* oracle@192.168.59.10:/home/oracle/oracle_bk/

oracle@192.168.59.10's password:

arch1_7_869137332.dbf                                                                                                                                      100% 1544KB   1.5MB/s   00:00   

arch1_7_869231211.dbf                                                                                                                                      100% 2462KB   2.4MB/s   00:00   

[oracle@rhel6_lhr dbs]$ scp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_8_869* oracle@192.168.59.10:/home/oracle/oracle_bk/

oracle@192.168.59.10's password:

arch1_8_869231211.dbf                                                                                                                                      100%   14KB  14.0KB/s   00:00   

[oracle@rhel6_lhr dbs]$ scp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_9_869* oracle@192.168.59.10:/home/oracle/oracle_bk/

oracle@192.168.59.10's password:

arch1_9_869231211.dbf                                                                                                                                      100%   32KB  32.0KB/s   00:00   

[oracle@rhel6_lhr dbs]$

wps5AB9.tmp 

 

5  修改target庫的pfile檔案並生成pfile檔案中的路徑

熱備檔案中包含了pfile檔案,修改後:

 

[oracle@testdb hotbak]$ mkdir -p /u01/app/oracle/admin/utf8test/adump

[oracle@testdb hotbak]$ mkdir -p /u01/app/oracle/oradata/utf8test/

[oracle@testdb hotbak]$ vi initutf8test.ora

[oracle@testdb hotbak]$ more initutf8test.ora

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

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/u01/app/oracle/oradata/utf8test/control01.ctl','/u01/app/oracle/oradata/utf8test/control02.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='utf8test'

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

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

*.memory_target=500956224

*.open_cursors=300

*.processes=300

*.remote_login_passwordfile='EXCLUSIVE'

*.sessions=335

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

[oracle@testdb hotbak]$

 

 

6  啟動target資料庫到nomount狀態

[oracle@testdb hotbak]$ ORACLE_SID=utf8test

[oracle@testdb hotbak]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jan 17 16:20:06 2015

 

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

 

Connected to an idle instance.

 

SQL> startup pfile='/home/oracle/oracle_bk/hotbak/initutf8test.ora' nomount;

ORACLE instance started.

 

Total System Global Area  501059584 bytes

Fixed Size     2229744 bytes

Variable Size   327158288 bytes

Database Buffers   163577856 bytes

Redo Buffers     8093696 bytes

SQL> create spfile from pfile='/home/oracle/oracle_bk/hotbak/initutf8test.ora';

 

File created.

 

SQL>

 

wps5ABA.tmp 

 

 

7  開始建立控制檔案

從熱備的控制檔案文字中得到如下控制檔案的建立指令碼:

 

 

CREATE CONTROLFILE REUSE DATABASE "UTF8TEST" RESETLOGS  ARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 '/u01/app/oracle/oradata/utf8test/redo01.log'  SIZE 50M BLOCKSIZE 512,

  GROUP 2 '/u01/app/oracle/oradata/utf8test/redo02.log'  SIZE 50M BLOCKSIZE 512,

  GROUP 3 '/u01/app/oracle/oradata/utf8test/redo03.log'  SIZE 50M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  '/u01/app/oracle/oradata/utf8test/system01.dbf',

  '/u01/app/oracle/oradata/utf8test/sysaux01.dbf',

  '/u01/app/oracle/oradata/utf8test/undotbs01.dbf',

  '/u01/app/oracle/oradata/utf8test/users01.dbf'

CHARACTER SET AL32UTF8

;

 

 

7.1  第一步,首先移動相應的資料檔案到相應的控制檔案記錄的目錄中

 

[oracle@testdb hotbak]$ ll

total 1391976

-rw-r-----. 1 oracle oinstall   9748480 Jan 17 16:06 controlbak.ctl

-rw-r--r--. 1 oracle oinstall      6810 Jan 17 16:06 controlbak.sql

-rw-r--r--. 1 oracle oinstall       889 Jan 17 16:06 initorcl.ora

-rw-r--r--. 1 oracle oinstall       532 Jan 17 16:19 initutf8test.ora

-rw-r-----. 1 oracle oinstall 608182272 Jan 17 16:06 sysaux01.dbf

-rw-r-----. 1 oracle oinstall 744497152 Jan 17 16:07 system01.dbf

-rw-r-----. 1 oracle oinstall  52436992 Jan 17 16:06 undotbs01.dbf

-rw-r-----. 1 oracle oinstall  10493952 Jan 17 16:06 users01.dbf

[oracle@testdb hotbak]$ cp *.dbf  /u01/app/oracle/oradata/utf8test/

[oracle@testdb hotbak]$

 

7.2  第二步,重新建立控制檔案,控制檔案建立完成後自動mount

[oracle@testdb hotbak]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jan 17 16:29:24 2015

 

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

 

 

Connected to:

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

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

 

CREATE CONTROLFILE REUSE DATABASE "UTF8TEST" RESETLOGS  ARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 '/u01/app/oracle/oradata/utf8test/redo01.log'  SIZE 50M BLOCKSIZE 512,

  GROUP 2 '/u01/app/oracle/oradata/utf8test/redo02.log'  SIZE 50M BLOCKSIZE 512,

  GROUP 3 '/u01/app/oracle/oradata/utf8test/redo03.log'  SIZE 50M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  '/u01/app/oracle/oradata/utf8test/system01.dbf',

  '/u01/app/oracle/oradata/utf8test/sysaux01.dbf',

  '/u01/app/oracle/oradata/utf8test/undotbs01.dbf',

  '/u01/app/oracle/oradata/utf8test/users01.dbf'

CHARACTER SET AL32UTF8

18  ;

 

Control file created.

 

SQL> ho ls -l /u01/app/oracle/oradata/utf8test/cont*

-rw-r-----. 1 oracle oinstall 10076160 Jan 17 17:37 /u01/app/oracle/oradata/utf8test/control01.ctl

-rw-r-----. 1 oracle oinstall 10076160 Jan 17 17:37 /u01/app/oracle/oradata/utf8test/control02.ctl

 

SQL>

 

SQL> select status from v$instance;

 

STATUS

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

MOUNTED

 

SQL>

 

 

8  rman註冊一下

[oracle@testdb hotbak]$ rman target /

 

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jan 17 17:39:53 2015

 

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

 

connected to target database: UTF8TEST (DBID=2518944702, not open)

 

RMAN> catalog start with '/home/oracle/oracle_bk/';

 

using target database control file instead of recovery catalog

searching for all files that match the pattern /home/oracle/oracle_bk/

 

List of Files Unknown to the Database

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

File Name: /home/oracle/oracle_bk/arch1_9_869231211.dbf

File Name: /home/oracle/oracle_bk/hotbak/undotbs01.dbf

File Name: /home/oracle/oracle_bk/hotbak/controlbak.ctl

File Name: /home/oracle/oracle_bk/hotbak/initutf8test.ora

File Name: /home/oracle/oracle_bk/hotbak/initorcl.ora

File Name: /home/oracle/oracle_bk/hotbak/sysaux01.dbf

File Name: /home/oracle/oracle_bk/hotbak/users01.dbf

File Name: /home/oracle/oracle_bk/hotbak/controlbak.sql

File Name: /home/oracle/oracle_bk/hotbak/system01.dbf

File Name: /home/oracle/oracle_bk/arch1_7_869137332.dbf

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869892_2.bak

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853870080_5.bak

File Name: /home/oracle/oracle_bk/orcl/control_c-1381650135-20140801-01.bak

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869894_4.bak

File Name: /home/oracle/oracle_bk/orcl/control_c-1381650135-20140801-00.bak

File Name: /home/oracle/oracle_bk/orcl/control_c-1381650135-20140725-00.bak

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869894_3.bak

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869892_1.bak

File Name: /home/oracle/oracle_bk/arch1_7_869231211.dbf

File Name: /home/oracle/oracle_bk/arch1_8_869231211.dbf

 

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

 

List of Cataloged Files

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

File Name: /home/oracle/oracle_bk/arch1_9_869231211.dbf

File Name: /home/oracle/oracle_bk/hotbak/undotbs01.dbf

File Name: /home/oracle/oracle_bk/hotbak/controlbak.ctl

File Name: /home/oracle/oracle_bk/hotbak/sysaux01.dbf

File Name: /home/oracle/oracle_bk/hotbak/users01.dbf

File Name: /home/oracle/oracle_bk/hotbak/system01.dbf

File Name: /home/oracle/oracle_bk/arch1_7_869137332.dbf

File Name: /home/oracle/oracle_bk/arch1_7_869231211.dbf

File Name: /home/oracle/oracle_bk/arch1_8_869231211.dbf

 

List of Files Which Where Not Cataloged

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

File Name: /home/oracle/oracle_bk/hotbak/initutf8test.ora

  RMAN-07517: Reason: The file header is corrupted

File Name: /home/oracle/oracle_bk/hotbak/initorcl.ora

  RMAN-07517: Reason: The file header is corrupted

File Name: /home/oracle/oracle_bk/hotbak/controlbak.sql

  RMAN-07517: Reason: The file header is corrupted

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869892_2.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853870080_5.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/control_c-1381650135-20140801-01.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869894_4.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/control_c-1381650135-20140801-00.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/control_c-1381650135-20140725-00.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869894_3.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

File Name: /home/oracle/oracle_bk/orcl/full_ORCLxxxx_20140725_853869892_1.bak

  RMAN-07518: Reason: Foreign database file DBID: 1381650135  Database Name: ORCL

 

 

RMAN> list copy;

 

using target database control file instead of recovery catalog

List of Datafile Copies

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

 

Key     File S Completion Time Ckp SCN    Ckp Time      

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

5       1    A 17-JAN-15       1705586    17-JAN-15     

        Name: /home/oracle/oracle_bk/hotbak/system01.dbf

 

3       2    A 17-JAN-15       1705566    17-JAN-15     

        Name: /home/oracle/oracle_bk/hotbak/sysaux01.dbf

 

1       3    A 17-JAN-15       1705607    17-JAN-15     

        Name: /home/oracle/oracle_bk/hotbak/undotbs01.dbf

 

4       4    A 17-JAN-15       1705620    17-JAN-15     

        Name: /home/oracle/oracle_bk/hotbak/users01.dbf

 

List of Control File Copies

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

 

Key     S Completion Time Ckp SCN    Ckp Time      

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

2       A 17-JAN-15       1705635    17-JAN-15     

        Name: /home/oracle/oracle_bk/hotbak/controlbak.ctl

        Tag: TAG20150117T172728

 

List of Archived Log Copies for database with db_unique_name UTF8TEST

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

 

Key     Thrd Seq     S Low Time

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

2       1    8       A 17-JAN-15

        Name: /home/oracle/oracle_bk/arch1_8_869231211.dbf

 

1       1    9       A 17-JAN-15

        Name: /home/oracle/oracle_bk/arch1_9_869231211.dbf

 

 

RMAN>

RMAN> exit

 

 

Recovery Manager complete.

[oracle@testdb hotbak]$

 

 

9  recover到指定的scn

 

SQL> recover database until change 1705635 using backup controlfile;

Media recovery complete.

SQL> alter database open resetlogs;

 

Database altered.

 

 

10  重建臨時表空間並配置密碼檔案以及 TNS 和密碼檔案等

ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/utf8test/temp01.dbf'

     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

 

 

。。。。。。。。。。。。

 

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-1405324/,如需轉載,請註明出處,否則將追究法律責任。

相關文章