情況:
1)從一個有叢集有dg的執行個體—>恢複到單執行個體
2)存儲路徑相同
3)資料量5T左右
1、配置/etc/hosts檔案
.xx.xx sznwk01 //帶庫備份伺服器ip
.xx.xx szcssjk01 //恢複庫ip
.xx.xx szcssjk01_nwk //恢複庫備份ip
.xx.xx sznsapora01_nwk //源庫的備份ip
2、在恢複機運作如下指令查找networker的備份記錄
$ nsrinfo -s sznwk01 -n oracle sznsapora01 |grep ^c|more
c---, date= Mon Apr :: AM CST
cntrl_228610_1_20180423, date= Mon Apr :: AM CST
以下為需要恢複的controlfile:
c---
//這裡我直接選擇了最新的歸檔,沒有認真篩選,直接造成recover database 恢複很久
3、恢複環境部署
從 源端 複制$ORACLE_HOME/dbs/pfile參數檔案到 恢複機 上
vi /oracle/pfile.ora 修改裡面的參數路徑(僅參考)
*.audit_file_dest='/oracle/app/oradba/admin/PMSSC/adump'//路徑要建好
*.audit_sys_operations=TRUE
*.audit_trail='OS'
*.compatible='11.2.0.4.0'
*.control_files='+DG_DATA01/pmssc/controlfile/current.256.880387951' //這個我忘記更改了
*.db_block_size=
*.db_create_file_dest='+DG_DATA01'
*.db_domain=''
*.db_name='PMSSC'
*.diagnostic_dest='/oracle/app'
*.dispatchers=''
*.local_listener=''
*.open_cursors=
*.pga_aggregate_target=
*.processes=
*.resource_limit=TRUE
*.sessions=
*.sga_max_size=
*.sga_target=
*.undo_retention=
*.undo_tablespace='UNDOTBS1'
*.db_files=
4、開啟庫startup nomount pfile=‘路徑’; 5、以下在恢複機上運作
$ rman target /
Recovery Manager: Release .. - Production on Mon Apr ::
Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
connected to target database: PMSSC (not mounted) --->nomount狀态
RMAN>run {
allocate channel t1 type 'sbt_tape';
send 'NSR_ENV=(NSR_SERVER=sznwk01,NSR_CLIENT=sznsapora01_nwk)';
restore controlfile from 'c-2208694315-20180423-04';
release channel t1;
}
RMAN> alter database mount;
RMAN> report schema;
RMAN> run {
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
send 'NSR_ENV=(NSR_SERVER=sznwk01,NSR_CLIENT=sznsapora01_nwk)';
RESTORE DATABASE;
switch datafile all;
switch tempfile all;
release channel t1;
release channel t2;
}
可以通過這個指令查還有幾個資料檔案在恢複
SQL> select name,bytes/// from v$datafile where bytes=;
no rows selected
//資料量大,從第一天9點半恢複到第二天的晚上八點30分
SQL> select fuzzy, status, error, recover, checkpoint_change#, checkpoint_time, count(*) from v$datafile_header group by fuzzy, status, error, recover, checkpoint_change#, checkpoint_time ;
FUZ STATUS ERROR REC CHECKPOINT_CHANGE# CHECKPOINT_TIME COUNT(*)
--- --------- ----------------------------------------------------------------- --- ------------------ ------------------- ----------
NO ONLINE E+ -- ::
NO ONLINE E+ -- ::
NO ONLINE E+ -- ::
6、建立一個spfile
SQL> create spfile from pfile='/oracle/pfile0926.ora';
File created.
SQL> shutdown immediate
ORA-: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
ORA-: error in identifying control file, check alert log for more info
發現控制檔案有問題
回去找/oracle/pfile.ora
*.control_files='+DG_DATA01/pmssc/controlfile/current.256.880387951'
這個控制檔案是源庫恢複過來的那個,沒有進行更改
ASMCMD> cd +DG_DATA01/pmssc/controlfile/
ASMCMD> ls
current
*.control_files='+DG_DATA01/pmssc/controlfile/current.268.974195339'
重新打開試試
[oradba@szcssjk01:/oracle]$ sqlplus / as sysdba
SQL*Plus: Release Production on Tue Apr ::
Copyright (c) , , Oracle. All rights reserved.
Connected to:
Oracle Database g Enterprise Edition Release - bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown immediate
ORA-: database not mounted
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
ORA-: error in identifying control file, check alert log for more info
已經是spfile打開了的,是以剛剛改pfile沒起作用,直接改control_files
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /home/oradba/app/oradba/produc
t//dbhome_1/dbs/spfilePM
SSC.ora
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer
control_files string +DG_DATA01/pmssc/controlfile/c
urrent
control_management_pack_access string DIAGNOSTIC+TUNING
SQL> alter system set control_files='+DG_DATA01/pmssc/controlfile/current.268.974195339';
alter system set control_files='+DG_DATA01/pmssc/controlfile/current.268.974195339'
*
ERROR at line :
ORA-: specified initialization parameter cannot be modified
SQL> alter system set control_files='+DG_DATA01/pmssc/controlfile/current.268.974195339' scope=spfile;
System altered.
SQL> shutdown immediate
ORA-: database not mounted
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted.
7、配置歸檔路徑
SQL> alter system set log_archive_dest_1='location=/data01/archivelog';
System altered.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /data01/archivelog
Oldest online log sequence
Next log sequence to archive
Current log sequence
8、選擇恢複時間點的思路
查詢備份的時間點
SQL> set linesize pages
SQL> COL STATUS FORMAT a9
SQL> COL hours FORMAT
SQL> col in_size for a15
SQL> col out_sec for a15
SQL> col in_sec for a15
SQL> col out_size for a15
SQL> SELECT SESSION_KEY, INPUT_TYPE, STATUS,
INPUT_BYTES_DISPLAY in_size,
OUTPUT_BYTES_DISPLAY out_size,
COMPRESSION_RATIO,
INPUT_BYTES_PER_SEC_DISPLAY in_sec,
OUTPUT_BYTES_PER_SEC_DISPLAY out_sec,
TO_CHAR(START_TIME,'yyyy-mm-dd hh24:mi') start_time,
TO_CHAR(END_TIME,'yyyy-mm-dd hh24:mi') end_time,
ELAPSED_SECONDS/ hours
FROM V$RMAN_BACKUP_JOB_DETAILS
ORDER BY SESSION_KEY;
SESSION_KEY INPUT_TYPE STATUS IN_SIZE OUT_SIZE COMPRESSION_RATIO IN_SEC OUT_SEC START_TIME END_TIME HOURS
----------- ------------- --------- --------------- --------------- ----------------- --------------- --------------- ---------------- ---------------- --------
CONTROLFILE COMPLETED 38M 75M 02M 05M -- : -- :
DB INCR COMPLETED 85T 89G 06M 44M -- : -- :
ARCHIVELOG COMPLETED 98G 99G 37M 37M -- : -- :
ARCHIVELOG COMPLETED 34G 34G 60M 61M -- : -- :
DB INCR COMPLETED 79T 13T 90M 55M -- : -- :
ARCHIVELOG COMPLETED 34G 34G 42M 43M -- : -- :
ARCHIVELOG COMPLETED 01G 02G 74M 74M -- : -- :
DB INCR COMPLETED 84T 20G 35M 60M -- : -- :
ARCHIVELOG COMPLETED 14G 14G 10M 10M -- : -- :
ARCHIVELOG COMPLETED 88G 88G 40M 40M -- : -- :
DB INCR COMPLETED 85T 31G 71M 70M -- : -- :
ARCHIVELOG COMPLETED 46G 47G 05M 05M -- : -- :
ARCHIVELOG COMPLETED 17G 18G 78M 78M -- : -- :
DB INCR COMPLETED 79T 14T 47M 63M -- : -- :
ARCHIVELOG COMPLETED 05G 05G 20M 20M -- : -- :
ARCHIVELOG COMPLETED 89G 89G 82M 83M -- : -- :
DB INCR COMPLETED 85T 06G 14M 90M -- : -- :
ARCHIVELOG COMPLETED 70G 71G 03M 04M -- : -- :
ARCHIVELOG COMPLETED 91G 92G 31M 32M -- : -- :
DB INCR COMPLETED 85T 41G 16M 20M -- : -- :
ARCHIVELOG COMPLETED 17G 17G 90M 90M -- : -- :
ARCHIVELOG COMPLETED 42G 42G 37M 38M -- : -- :
DB INCR COMPLETED 84T 16G 76M 87M -- : -- :
ARCHIVELOG COMPLETED 22G 22G 40M 40M -- : -- :
ARCHIVELOG COMPLETED 47G 47G 38M 38M -- : -- :
DB INCR COMPLETED 79T 15T 55M 09M -- : -- :
ARCHIVELOG COMPLETED 31G 31G 96M 96M -- : -- :
ARCHIVELOG COMPLETED 06G 06G 15M 15M -- : -- :
DB INCR COMPLETED 83T 32G 72M 09M -- : -- :
ARCHIVELOG COMPLETED 97G 97G 11M 11M -- : -- :
ARCHIVELOG COMPLETED 37G 38G 97M 97M -- : -- :
DB INCR COMPLETED 85T 52G 14M 98M -- : -- :
ARCHIVELOG COMPLETED 16G 16G 41M 41M -- : -- :
ARCHIVELOG COMPLETED 33G 33G 87M 87M -- : -- :
DB INCR COMPLETED 79T 15T 70M 90M -- : -- :
ARCHIVELOG COMPLETED 96G 96G 02M 02M -- : -- :
ARCHIVELOG COMPLETED 73G 73G 54M 55M -- : -- :
DB INCR COMPLETED 84T 45G 59M 10M -- : -- :
ARCHIVELOG COMPLETED 35G 35G 58M 58M -- : -- :
ARCHIVELOG COMPLETED 06G 07G 00M 01M -- : -- :
DB INCR COMPLETED 79T 16T 62M 15M -- : -- :
DB INCR COMPLETED 84T 34G 24M 48M -- : -- :
ARCHIVELOG COMPLETED 29G 29G 77M 77M -- : -- :
ARCHIVELOG COMPLETED 87G 87G 23M 23M -- : -- :
DB INCR COMPLETED 89T 36G 23M 42M -- : -- :
ARCHIVELOG COMPLETED 91G 92G 48M 49M -- : -- :
ARCHIVELOG COMPLETED 11G 11G 50M 50M -- : -- :
DB INCR COMPLETED 79T 17T 90M 48M -- : -- :
ARCHIVELOG COMPLETED 43G 43G 64M 64M -- : -- :
ARCHIVELOG COMPLETED 85G 86G 98M 99M -- : -- :
DB INCR COMPLETED 84T 38G 37M 48M -- : -- :
ARCHIVELOG COMPLETED 53G 53G 83M 83M -- : -- :
ARCHIVELOG COMPLETED 54G 54G 39M 40M -- : -- :
DB INCR COMPLETED 83T 63G 49M 30M -- : -- :
ARCHIVELOG COMPLETED 70G 70G 67M 67M -- : -- :
ARCHIVELOG COMPLETED 22G 22G 87M 87M -- : -- :
DB INCR COMPLETED 82T 17T 95M 61M -- : -- :
ARCHIVELOG COMPLETED 34G 34G 59M 59M -- : -- :
ARCHIVELOG COMPLETED 94G 94G 02M 03M -- : -- :
DB INCR COMPLETED 88T 33G 64M 27M -- : -- :
ARCHIVELOG COMPLETED 10G 10G 63M 63M -- : -- :
ARCHIVELOG COMPLETED 41G 41G 17M 17M -- : -- :
DB INCR COMPLETED 87T 41G 53M 87M -- : -- :
ARCHIVELOG COMPLETED 90G 90G 03M 03M -- : -- :
ARCHIVELOG COMPLETED 65G 65G 22M 22M -- : -- :
DB INCR COMPLETED 93T 37G 08M 19M -- : -- :
ARCHIVELOG COMPLETED 18G 19G 15M 16M -- : -- :
ARCHIVELOG COMPLETED 22G 22G 46M 46M -- : -- :
DB INCR COMPLETED 84T 20T 05M 67M -- : -- :
ARCHIVELOG COMPLETED 53G 53G 92M 93M -- : -- :
ARCHIVELOG COMPLETED 20G 20G 00M 00M -- : -- :
DB INCR COMPLETED 31T 29G 05M 88M -- : -- :
ARCHIVELOG COMPLETED 54G 54G 81M 81M -- : -- :
ARCHIVELOG COMPLETED 92G 92G 30M 30M -- : -- :
DB INCR COMPLETED 12T 53G 79M 66M -- : -- :
ARCHIVELOG COMPLETED 07G 07G 75M 75M -- : -- :
rows selected.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- --------- ------------- ------------------- ------------ -------------------
YES INACTIVE -- :: -- ::
YES INACTIVE -- :: -- ::
YES INACTIVE -- :: -- ::
NO CURRENT -- ::
YES INACTIVE -- :: -- ::
YES INACTIVE -- :: -- ::
YES INACTIVE -- :: -- ::
NO CURRENT -- ::
YES INACTIVE -- :: -- ::
YES INACTIVE -- :: -- ::
NO CURRENT -- ::
YES INACTIVE -- :: -- ::
rows selected.
恢複的時間點選的是 -- :: --->當時思路是選THREAD#=1(節點1)的
NO CURRENT -- ::
是以要在-- ::之後一點
同時又要在歸檔備份的時間之前
arch_228608_1_20180423, date= Mon Apr :: AM CST
是以要在Mon Apr ::之前一點
$ nsrinfo -s sznwk01 -n oracle sznsapora01_nwk |grep ^ar|more
arch_228608_1_20180423, date= Mon Apr :: AM CST
arch_228607_1_20180423, date= Mon Apr :: AM CST
arch_228606_1_20180423, date= Mon Apr :: AM CST
arch_228605_1_20180423, date= Mon Apr :: AM CST
arch_228604_1_20180423, date= Mon Apr :: AM CST
9、進行恢複database
[oradba@szcssjk01:/home/oradba]$ rman target /
Recovery Manager: Release .. - Production on Tue Apr ::
Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
connected to target database: PMSSC (DBID=, not open)
RMAN> run {
2> allocate channel t1 type 'SBT_TAPE';
3> allocate channel t2 type 'SBT_TAPE';
4> send 'NSR_ENV=(NSR_SERVER=sznwk01,NSR_CLIENT=sznsapora01_nwk)';
5> recover database until time "to_date('04/23/18 08:11:40','MM/DD/YY HH24:MI:SS')";
6> release channel t1;
7> release channel t2;
8> }
using target database control file instead of recovery catalog
allocated channel: t1
channel t1: SID= device type=SBT_TAPE
channel t1: NMDA Oracle v8.
allocated channel: t2
channel t2: SID= device type=SBT_TAPE
channel t2: NMDA Oracle v8.
sent command to channel: t1
sent command to channel: t2
Starting recover at -APR-
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_data_24.dbf
channel t1: reading from backup piece db_227014_1_20180418
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/other_data_18.dbf
channel t2: reading from backup piece db_227016_1_20180418
channel t2: piece handle=db_227016_1_20180418 tag=TAG20180418T011145
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/yd_indx_02.dbf
channel t2: reading from backup piece db_227015_1_20180418
channel t1: piece handle=db_227014_1_20180418 tag=TAG20180418T011145
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/undotbs3.
channel t1: reading from backup piece db_227017_1_20180418
channel t1: piece handle=db_227017_1_20180418 tag=TAG20180418T011145
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_data_24.dbf
channel t1: reading from backup piece db_227262_1_20180419
channel t1: piece handle=db_227262_1_20180419 tag=TAG20180419T011151
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_index_03.dbf
channel t1: reading from backup piece db_227020_1_20180418
channel t1: piece handle=db_227020_1_20180418 tag=TAG20180418T011145
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/other_data_18.dbf
channel t1: reading from backup piece db_227264_1_20180419
channel t1: piece handle=db_227264_1_20180419 tag=TAG20180419T011151
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_index_04.dbf
channel t1: reading from backup piece db_227021_1_20180418
channel t1: piece handle=db_227021_1_20180418 tag=TAG20180418T011145
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/undotbs3.
channel t1: reading from backup piece db_227265_1_20180419
channel t2: piece handle=db_227015_1_20180418 tag=TAG20180418T011145
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/yd_indx_02.dbf
channel t2: reading from backup piece db_227263_1_20180419
channel t2: piece handle=db_227263_1_20180419 tag=TAG20180419T011151
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_index_04.dbf
channel t2: reading from backup piece db_227269_1_20180419
channel t1: piece handle=db_227265_1_20180419 tag=TAG20180419T011151
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/yd_indx_02.dbf
channel t1: reading from backup piece db_227514_1_20180420
channel t2: piece handle=db_227269_1_20180419 tag=TAG20180419T011151
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_index_03.dbf
channel t2: reading from backup piece db_227268_1_20180419
channel t2: piece handle=db_227268_1_20180419 tag=TAG20180419T011151
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_data_24.dbf
channel t2: reading from backup piece db_227513_1_20180420
channel t2: piece handle=db_227513_1_20180420 tag=TAG20180420T011208
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/other_data_18.dbf
channel t2: reading from backup piece db_227515_1_20180420
channel t1: piece handle=db_227514_1_20180420 tag=TAG20180420T011208
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/undotbs3.
channel t1: reading from backup piece db_227516_1_20180420
channel t2: piece handle=db_227515_1_20180420 tag=TAG20180420T011208
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_index_04.dbf
channel t2: reading from backup piece db_227520_1_20180420
channel t1: piece handle=db_227516_1_20180420 tag=TAG20180420T011208
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/part_index_03.dbf
channel t1: reading from backup piece db_227519_1_20180420
channel t1: piece handle=db_227519_1_20180420 tag=TAG20180420T011208
channel t1: restored backup piece
channel t1: restore complete, elapsed time: ::
channel t1: starting incremental datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/undotbs1.
channel t1: reading from backup piece db_227958_1_20180422
channel t2: piece handle=db_227520_1_20180420 tag=TAG20180420T011208
channel t2: restored backup piece
channel t2: restore complete, elapsed time: ::
channel t2: starting incremental datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
destination for restore of datafile : +DG_DATA01/pmssc/datafile/yd_data_03.dbf
channel t2: reading from backup piece db_227960_1_20180422
^C
user interrupt received
released channel: t1
released channel: t2
RMAN-: ===========================================================
RMAN-: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-: ===========================================================
RMAN-: failure of recover command at // ::
RMAN-: job cancelled at user request
RMAN>
//覺得通道開少了,就開了個,重新跑
RMAN> run {
2> allocate channel t1 type 'SBT_TAPE';
3> allocate channel t2 type 'SBT_TAPE';
4> allocate channel t3 type 'SBT_TAPE';
5> allocate channel t4 type 'SBT_TAPE';
6> allocate channel t5 type 'SBT_TAPE';
7> allocate channel t6 type 'SBT_TAPE';
8> allocate channel t7 type 'SBT_TAPE';
9> allocate channel t8 type 'SBT_TAPE';
10> send 'NSR_ENV=(NSR_SERVER=sznwk01,NSR_CLIENT=sznsapora01_nwk)';
11> recover database until time "to_date('04/23/18 08:11:40','MM/DD/YY HH24:MI:SS')";
12> release channel t1;
13> release channel t2;
14> release channel t3;
15> release channel t4;
16> release channel t5;
17> release channel t6;
18> release channel t7;
19> release channel t8;
20> }
從晚上八點九恢複到淩晨三點多
為什麼恢複這麼久,原因是
SESSION_KEY INPUT_TYPE STATUS IN_SIZE OUT_SIZE COMPRESSION_RATIO IN_SEC OUT_SEC START_TIME END_TIME HOURS
----------- ------------- --------- --------------- --------------- ----------------- --------------- --------------- ---------------- ---------------- --------
41212 ARCHIVELOG COMPLETED 227.22G 227.22G 1 171.46M 171.46M 2018-04-20 19:41 2018-04-20 20:04 .377
41219 DB INCR COMPLETED 4.84T 4.20T 1.15303243 259.05M 224.67M 2018-04-21 01:12 2018-04-21 06:38 5.442
(這裡看出做了一個全備備份)
41225 ARCHIVELOG COMPLETED 340.53G 340.53G 1 117.92M 117.93M 2018-04-21 07:41 2018-04-21 08:31 .821
41232 ARCHIVELOG COMPLETED 511.20G 511.20G 1 101.00M 101.00M 2018-04-21 19:42 2018-04-21 21:08 1.440
41239 DB INCR COMPLETED 5.31T 564.29G 9.63882607 606.05M 62.88M 2018-04-22 01:12 2018-04-22 03:45 2.553
(這裡看出做了一個增量備份)
41248 ARCHIVELOG COMPLETED 469.54G 469.54G 1 119.81M 119.81M 2018-04-22 07:42 2018-04-22 08:48 1.115
41255 ARCHIVELOG COMPLETED 458.92G 458.92G 1 205.30M 205.30M 2018-04-22 19:42 2018-04-22 20:20 .636
41262 DB INCR COMPLETED 5.12T 351.53G 14.9225776 591.79M 39.66M 2018-04-23 01:12 2018-04-23 03:43 2.521
(這裡看出做了一個增量備份)
41271 ARCHIVELOG COMPLETED 178.07G 178.07G 1 86.75M 86.75M 2018-04-23 07:42 2018-04-23 08:17 .584
恢複的控制檔案是 2018-04-23 08:17:07
恢複的時間點選的是 2018-04-23 08:11:40
恢複的時候是無條件選擇全備的,是以它自動選擇從2018-04-21 06:38開始,因為我們選擇了2018-04-23 08:11:40,中間隔了兩個是增量備份,如果是從21号開始恢複的話,一直恢複下去,恢複完全備還要輪兩個增量備份的歸檔。
同步觀察恢複日志情況
select * from v$Log
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- --------- ------------- ------------------- ------------ -------------------
YES INACTIVE -- :: -- ::
YES UNUSED -- :: -- ::
YES UNUSED -- :: -- ::
NO CURRENT -- ::
YES INACTIVE -- :: -- ::
YES UNUSED -- :: -- ::
YES UNUSED -- :: -- ::
NO CURRENT -- ::
YES CLEARING -- :: -- ::
YES INACTIVE -- :: -- ::
NO CURRENT -- ::
YES UNUSED -- :: -- ::
rows selected.
SQL> /
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- --------- ------------- ------------------- ------------ -------------------
YES UNUSED
NO CURRENT -- ::
YES UNUSED
YES UNUSED
YES UNUSED
YES UNUSED
YES INACTIVE -- :: -- ::
YES UNUSED
YES UNUSED
YES UNUSED
YES INACTIVE -- :: -- ::
YES UNUSED
rows selected.
//直到SEQUENCE#=0,說明日志恢複完成
10、處理一下恢複的日志
HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node (Doc ID 415579.1)10) Once the database is opened successfully, you may remove the redolog groups for redo threads of other instances
SQL> select THREAD#, STATUS, ENABLED from v$thread;
THREAD# STATUS ENABLED
---------- --------- --------
OPEN PUBLIC
CLOSED PUBLIC
CLOSED PRIVATE
SQL> select group# from v$log where THREAD# = or THREAD#=;
GROUP#
----------
rows selected.
SQL> alter database disable thread ;
Database altered.
SQL> alter database disable thread ;
Database altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- --------- ------- -------------------------------------------------------------------------------- ---
ONLINE +DG_DATA01/pmssc/onlinelog/redo_01.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_11.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_02.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_04.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_14.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_05.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_15.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_07.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_17.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_08.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_18.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_09.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_19.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_06.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_20.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_30.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_21.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_31.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_12.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_43.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_33.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_16.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_22.log NO
ONLINE +DG_DATA01/pmssc/onlinelog/redo_32.log NO
rows selected.
SQL> select group# from v$log where THREAD# = or THREAD#=;
GROUP#
----------
rows selected.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> alter database drop logfile group ;
Database altered.
SQL> select THREAD#, STATUS, ENABLED from v$thread;
THREAD# STATUS ENABLED
---------- --------- --------
OPEN PUBLIC
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- --------- ------------- ------------------- ------------ -------------------
NO CURRENT -- ::
YES UNUSED
YES UNUSED
YES UNUSED
12、更改一下參數
SQL> show parameter paralle
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_degree_limit string CPU
parallel_degree_policy string MANUAL
parallel_execution_message_size integer
parallel_force_local boolean FALSE
parallel_instance_group string
parallel_io_cap_enabled boolean FALSE
parallel_max_servers integer
parallel_min_percent integer
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
parallel_min_servers integer
parallel_min_time_threshold string AUTO
parallel_server boolean FALSE
parallel_server_instances integer
parallel_servers_target integer
parallel_threads_per_cpu integer
recovery_parallelism integer
SQL> show parameter cpu
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cpu_count integer
parallel_threads_per_cpu integer
resource_manager_cpu_allocation integer
SQL> alter system set parallel_servers_target=;
System altered.
SQL> alter system set parallel_max_servers=;
System altered.
12、建立監聽
netca