RMAN異機恢復異作業系統(Linux到Windows)

abstractcyj發表於2016-06-23

1. Windows上建立Oracle例項,服務

  C:\Windows\system32>oradim -new -sid prod

  例項已建立。

2. 恢復spfile
 
啟動資料庫例項至nomount狀態

  pfile是從原資料庫例項拷貝而來

  # Oracle init.ora parameter file generated by instance prod on 06/22/2016 10:33:41

__db_cache_size=320M

__java_pool_size=4M

__large_pool_size=8M

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

__pga_aggregate_target=320M

__sga_target=480M

__shared_io_pool_size=0

__shared_pool_size=136M

__streams_pool_size=0

_aggregation_optimization_settings=0

_always_anti_join='CHOOSE'

_always_semi_join='CHOOSE'

_and_pruning_enabled=TRUE

_b_tree_bitmap_plans=TRUE

_bloom_filter_enabled=TRUE

_bloom_folding_enabled=TRUE

_bloom_pruning_enabled=TRUE

_complex_view_merging=TRUE

_compression_compatibility='11.2.0.4.0'

_connect_by_use_union_all='TRUE'

_convert_set_to_join=FALSE

_cost_equality_semi_join=TRUE

_cpu_to_io=0

_dimension_skip_null=TRUE

_eliminate_common_subexpr=TRUE

_enable_type_dep_selectivity=TRUE

_fast_full_scan_enabled=TRUE

_first_k_rows_dynamic_proration=TRUE

_gby_hash_aggregation_enabled=TRUE

_generalized_pruning_enabled=TRUE

_globalindex_pnum_filter_enabled=TRUE

_gs_anti_semi_join_allowed=TRUE

_improved_outerjoin_card=TRUE

_improved_row_length_enabled=TRUE

_index_join_enabled=TRUE

_ksb_restart_policy_times='0'

_ksb_restart_policy_times='60'

_ksb_restart_policy_times='120'

_ksb_restart_policy_times='240' # internal update to set default

_left_nested_loops_random=TRUE

_local_communication_costing_enabled=TRUE

_minimal_stats_aggregation=TRUE

_mmv_query_rewrite_enabled=TRUE

_new_initial_join_orders=TRUE

_new_sort_cost_estimate=TRUE

_nlj_batching_enabled=1

_optim_adjust_for_part_skews=TRUE

_optim_enhance_nnull_detection=TRUE

_optim_new_default_join_sel=TRUE

_optim_peek_user_binds=TRUE

_optimizer_adaptive_cursor_sharing=TRUE

_optimizer_better_inlist_costing='ALL'

_optimizer_cbqt_no_size_restriction=TRUE

_optimizer_coalesce_subqueries=TRUE

_optimizer_complex_pred_selectivity=TRUE

_optimizer_compute_index_stats=TRUE

_optimizer_connect_by_combine_sw=TRUE

_optimizer_connect_by_cost_based=TRUE

_optimizer_connect_by_elim_dups=TRUE

_optimizer_correct_sq_selectivity=TRUE

_optimizer_cost_based_transformation='LINEAR'

_optimizer_cost_hjsmj_multimatch=TRUE

_optimizer_cost_model='CHOOSE'

_optimizer_dim_subq_join_sel=TRUE

_optimizer_distinct_agg_transform=TRUE

_optimizer_distinct_elimination=TRUE

_optimizer_distinct_placement=TRUE

_optimizer_eliminate_filtering_join=TRUE

_optimizer_enable_density_improvements=TRUE

_optimizer_enable_extended_stats=TRUE

_optimizer_enable_table_lookup_by_nl=TRUE

_optimizer_enhanced_filter_push=TRUE

_optimizer_extend_jppd_view_types=TRUE

_optimizer_extended_cursor_sharing='UDO'

_optimizer_extended_cursor_sharing_rel='SIMPLE'

_optimizer_extended_stats_usage_control=192

_optimizer_false_filter_pred_pullup=TRUE

_optimizer_fast_access_pred_analysis=TRUE

_optimizer_fast_pred_transitivity=TRUE

_optimizer_filter_pred_pullup=TRUE

_optimizer_fkr_index_cost_bias=10

_optimizer_full_outer_join_to_outer=TRUE

_optimizer_group_by_placement=TRUE

_optimizer_improve_selectivity=TRUE

_optimizer_interleave_jppd=TRUE

_optimizer_join_elimination_enabled=TRUE

_optimizer_join_factorization=TRUE

_optimizer_join_order_control=3

_optimizer_join_sel_sanity_check=TRUE

_optimizer_max_permutations=2000

_optimizer_mode_force=TRUE

_optimizer_multi_level_push_pred=TRUE

_optimizer_native_full_outer_join='FORCE'

_optimizer_new_join_card_computation=TRUE

_optimizer_null_aware_antijoin=TRUE

_optimizer_or_expansion='DEPTH'

_optimizer_order_by_elimination_enabled=TRUE

_optimizer_outer_join_to_inner=TRUE

_optimizer_outer_to_anti_enabled=TRUE

_optimizer_push_down_distinct=0

_optimizer_push_pred_cost_based=TRUE

_optimizer_rownum_bind_default=10

_optimizer_rownum_pred_based_fkr=TRUE

_optimizer_skip_scan_enabled=TRUE

_optimizer_sortmerge_join_inequality=TRUE

_optimizer_squ_bottomup=TRUE

_optimizer_star_tran_in_with_clause=TRUE

_optimizer_system_stats_usage=TRUE

_optimizer_table_expansion=TRUE

_optimizer_transitivity_retain=TRUE

_optimizer_try_st_before_jppd=TRUE

_optimizer_undo_cost_change='11.2.0.4'

_optimizer_unnest_corr_set_subq=TRUE

_optimizer_unnest_disjunctive_subq=TRUE

_optimizer_use_cbqt_star_transformation=TRUE

_optimizer_use_feedback=TRUE

_or_expand_nvl_predicate=TRUE

_ordered_nested_loop=TRUE

_parallel_broadcast_enabled=TRUE

_partition_view_enabled=TRUE

_pivot_implementation_method='CHOOSE'

_pre_rewrite_push_pred=TRUE

_pred_move_around=TRUE

_push_join_predicate=TRUE

_push_join_union_view=TRUE

_push_join_union_view2=TRUE

_px_minus_intersect=TRUE

_px_partition_scan_enabled=TRUE

_px_pwg_enabled=TRUE

_px_ual_serial_input=TRUE

_query_rewrite_setopgrw_enable=TRUE

_remove_aggr_subquery=TRUE

_replace_virtual_columns=TRUE

_resource_manager_plan=''

_right_outer_hash_enable=TRUE

_selfjoin_mv_duplicates=TRUE

_sql_model_unfold_forloops='RUN_TIME'

_sqltune_category_parsed='DEFAULT' # parsed sqltune_category

_subquery_pruning_enabled=TRUE

_subquery_pruning_mv_enabled=FALSE

_table_scan_cost_plus_one=TRUE

_union_rewrite_for_gs='YES_GSET_MVS'

_unnest_subquery=TRUE

_use_column_stats_for_function=TRUE

audit_file_dest='/u01/app/oracle/admin/prod/adump'

audit_trail='DB'

background_dump_dest='/u01/app/oracle/diag/rdbms/prod/prod/trace' #Deprecate parameter

compatible='11.2.0.4.0'

control_files='/u01/app/oracle/oradata/prod/control01.ctl'

control_files='/u01/app/oracle/fast_recovery_area/prod/control02.ctl'

core_dump_dest='/u01/app/oracle/diag/rdbms/prod/prod/cdump'

db_block_size=8192

db_domain=''

db_name='prod'

db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'

db_recovery_file_dest_size=5182M

diagnostic_dest='/u01/app/oracle'

dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'

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

log_buffer=6266880 # log buffer update

memory_target=800M

open_cursors=300

optimizer_dynamic_sampling=2

optimizer_mode='ALL_ROWS'

plsql_warnings='DISABLE:ALL' # PL/SQL warnings at init.ora

processes=150

query_rewrite_enabled='TRUE'

remote_login_passwordfile='EXCLUSIVE'

resource_manager_plan=''

result_cache_max_size=2M

skip_unusable_indexes=TRUE

undo_tablespace='UNDOTBS1'

user_dump_dest='/u01/app/oracle/diag/rdbms/prod/prod/trace' #Deprecate parameter

 

修改pfile中對應的路徑, 修改後如下:
# Oracle init.ora parameter file generated by instance prod on 06\22\2016 10:33:41

__db_cache_size=320M

__java_pool_size=4M

__large_pool_size=8M

__oracle_base='E:\app\oracle' # ORACLE_BASE set from environment

__pga_aggregate_target=320M

__sga_target=480M

__shared_io_pool_size=0

__shared_pool_size=136M

__streams_pool_size=0

_aggregation_optimization_settings=0

_always_anti_join='CHOOSE'

_always_semi_join='CHOOSE'

_and_pruning_enabled=TRUE

_b_tree_bitmap_plans=TRUE

_bloom_filter_enabled=TRUE

_bloom_folding_enabled=TRUE

_bloom_pruning_enabled=TRUE

_complex_view_merging=TRUE

_compression_compatibility='11.2.0.4.0'

_connect_by_use_union_all='TRUE'

_convert_set_to_join=FALSE

_cost_equality_semi_join=TRUE

_cpu_to_io=0

_dimension_skip_null=TRUE

_eliminate_common_subexpr=TRUE

_enable_type_dep_selectivity=TRUE

_fast_full_scan_enabled=TRUE

_first_k_rows_dynamic_proration=TRUE

_gby_hash_aggregation_enabled=TRUE

_generalized_pruning_enabled=TRUE

_globalindex_pnum_filter_enabled=TRUE

_gs_anti_semi_join_allowed=TRUE

_improved_outerjoin_card=TRUE

_improved_row_length_enabled=TRUE

_index_join_enabled=TRUE

_ksb_restart_policy_times='0'

_ksb_restart_policy_times='60'

_ksb_restart_policy_times='120'

_ksb_restart_policy_times='240' # internal update to set default

_left_nested_loops_random=TRUE

_local_communication_costing_enabled=TRUE

_minimal_stats_aggregation=TRUE

_mmv_query_rewrite_enabled=TRUE

_new_initial_join_orders=TRUE

_new_sort_cost_estimate=TRUE

_nlj_batching_enabled=1

_optim_adjust_for_part_skews=TRUE

_optim_enhance_nnull_detection=TRUE

_optim_new_default_join_sel=TRUE

_optim_peek_user_binds=TRUE

_optimizer_adaptive_cursor_sharing=TRUE

_optimizer_better_inlist_costing='ALL'

_optimizer_cbqt_no_size_restriction=TRUE

_optimizer_coalesce_subqueries=TRUE

_optimizer_complex_pred_selectivity=TRUE

_optimizer_compute_index_stats=TRUE

_optimizer_connect_by_combine_sw=TRUE

_optimizer_connect_by_cost_based=TRUE

_optimizer_connect_by_elim_dups=TRUE

_optimizer_correct_sq_selectivity=TRUE

_optimizer_cost_based_transformation='LINEAR'

_optimizer_cost_hjsmj_multimatch=TRUE

_optimizer_cost_model='CHOOSE'

_optimizer_dim_subq_join_sel=TRUE

_optimizer_distinct_agg_transform=TRUE

_optimizer_distinct_elimination=TRUE

_optimizer_distinct_placement=TRUE

_optimizer_eliminate_filtering_join=TRUE

_optimizer_enable_density_improvements=TRUE

_optimizer_enable_extended_stats=TRUE

_optimizer_enable_table_lookup_by_nl=TRUE

_optimizer_enhanced_filter_push=TRUE

_optimizer_extend_jppd_view_types=TRUE

_optimizer_extended_cursor_sharing='UDO'

_optimizer_extended_cursor_sharing_rel='SIMPLE'

_optimizer_extended_stats_usage_control=192

_optimizer_false_filter_pred_pullup=TRUE

_optimizer_fast_access_pred_analysis=TRUE

_optimizer_fast_pred_transitivity=TRUE

_optimizer_filter_pred_pullup=TRUE

_optimizer_fkr_index_cost_bias=10

_optimizer_full_outer_join_to_outer=TRUE

_optimizer_group_by_placement=TRUE

_optimizer_improve_selectivity=TRUE

_optimizer_interleave_jppd=TRUE

_optimizer_join_elimination_enabled=TRUE

_optimizer_join_factorization=TRUE

_optimizer_join_order_control=3

_optimizer_join_sel_sanity_check=TRUE

_optimizer_max_permutations=2000

_optimizer_mode_force=TRUE

_optimizer_multi_level_push_pred=TRUE

_optimizer_native_full_outer_join='FORCE'

_optimizer_new_join_card_computation=TRUE

_optimizer_null_aware_antijoin=TRUE

_optimizer_or_expansion='DEPTH'

_optimizer_order_by_elimination_enabled=TRUE

_optimizer_outer_join_to_inner=TRUE

_optimizer_outer_to_anti_enabled=TRUE

_optimizer_push_down_distinct=0

_optimizer_push_pred_cost_based=TRUE

_optimizer_rownum_bind_default=10

_optimizer_rownum_pred_based_fkr=TRUE

_optimizer_skip_scan_enabled=TRUE

_optimizer_sortmerge_join_inequality=TRUE

_optimizer_squ_bottomup=TRUE

_optimizer_star_tran_in_with_clause=TRUE

_optimizer_system_stats_usage=TRUE

_optimizer_table_expansion=TRUE

_optimizer_transitivity_retain=TRUE

_optimizer_try_st_before_jppd=TRUE

_optimizer_undo_cost_change='11.2.0.4'

_optimizer_unnest_corr_set_subq=TRUE

_optimizer_unnest_disjunctive_subq=TRUE

_optimizer_use_cbqt_star_transformation=TRUE

_optimizer_use_feedback=TRUE

_or_expand_nvl_predicate=TRUE

_ordered_nested_loop=TRUE

_parallel_broadcast_enabled=TRUE

_partition_view_enabled=TRUE

_pivot_implementation_method='CHOOSE'

_pre_rewrite_push_pred=TRUE

_pred_move_around=TRUE

_push_join_predicate=TRUE

_push_join_union_view=TRUE

_push_join_union_view2=TRUE

_px_minus_intersect=TRUE

_px_partition_scan_enabled=TRUE

_px_pwg_enabled=TRUE

_px_ual_serial_input=TRUE

_query_rewrite_setopgrw_enable=TRUE

_remove_aggr_subquery=TRUE

_replace_virtual_columns=TRUE

_resource_manager_plan=''

_right_outer_hash_enable=TRUE

_selfjoin_mv_duplicates=TRUE

_sql_model_unfold_forloops='RUN_TIME'

_sqltune_category_parsed='DEFAULT' # parsed sqltune_category

_subquery_pruning_enabled=TRUE

_subquery_pruning_mv_enabled=FALSE

_table_scan_cost_plus_one=TRUE

_union_rewrite_for_gs='YES_GSET_MVS'

_unnest_subquery=TRUE

_use_column_stats_for_function=TRUE

audit_file_dest='E:\app\oracle\admin\prod\adump'

audit_trail='DB'

background_dump_dest='E:\app\oracle\diag\rdbms\prod\prod\trace' #Deprecate parameter

compatible='11.2.0.4.0'

control_files='E:\app\oracle\oradata\prod\control01.ctl'

control_files='E:\app\oracle\fast_recovery_area\prod\control02.ctl'

core_dump_dest='E:\app\oracle\diag\rdbms\prod\prod\cdump'

db_block_size=8192

db_domain=''

db_name='prod'

db_recovery_file_dest='E:\app\oracle\fast_recovery_area'

db_recovery_file_dest_size=5182M

diagnostic_dest='E:\app\oracle'

dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'

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

log_buffer=6266880 # log buffer update

memory_target=800M

open_cursors=300

optimizer_dynamic_sampling=2

optimizer_mode='ALL_ROWS'

plsql_warnings='DISABLE:ALL' # PL\SQL warnings at init.ora

processes=150

query_rewrite_enabled='TRUE'

remote_login_passwordfile='EXCLUSIVE'

resource_manager_plan=''

result_cache_max_size=2M

skip_unusable_indexes=TRUE

undo_tablespace='UNDOTBS1'

user_dump_dest='E:\app\oracle\diag\rdbms\prod\prod\trace' #Deprecate parameter

 

 

C:\Windows\system32>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on 星期四 6 23 11:02:14 2016

 

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

 

已連線到空閒例程。

 

SQL> startup nomount

ORA-01078: failure in processing system parameters

LRM-00109: ???????????????? 'E:\APP\ORACLE\PRODUCT\11.2.0\DBHOME_1\DATABASE\INIT

PROD.ORA'

SQL> startup nomount pfile='E:\app\oracle\product\11.2.0\dbhome_1\database\initp

rod.ora'

ORA-32006: BACKGROUND_DUMP_DEST initialization parameter has been deprecated

ORA-32006: USER_DUMP_DEST initialization parameter has been deprecated

ORA-48108: invalid value given for the diagnostic_dest init.ora parameter

ORA-48140: the specified ADR Base directory does not exist [e:\u01\app\oracle]

ORA-48187: specified directory does not exist

OSD-00002: ????????????

O/S-Error: (OS 3) ??????????????????????

SQL> create spfile from pfile;

 

檔案已建立。

 

SQL> startup nomount

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

ORACLE 例程已經啟動。

 

Total System Global Area  835104768 bytes

Fixed Size                  2285832 bytes

Variable Size             541069048 bytes

Database Buffers          281018368 bytes

Redo Buffers               10731520 bytes

SQL>

 

3. 恢復控制檔案

 C:\Windows\system32>rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jun 23 11:13:04 2016

 

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

 

connected to target database: PROD (not mounted)

 

RMAN>  catalog start with 'e:\dmp';

 

using target database control file instead of recovery catalog

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

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

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

RMAN-03002: failure of catalog command at 06/23/2016 11:13:11

ORA-01507: database not mounted

 

RMAN> restore controlfile from 'e:\dmp\o1_mf_s_915186191_cpmxnhj4_.bkp';

 

Starting restore at 23-JUN-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=189 device type=DISK

 

channel ORA_DISK_1: restoring control file

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

output file name=E:\APP\ORACLE\ORADATA\PROD\CONTROL01.CTL

output file name=E:\APP\ORACLE\FAST_RECOVERY_AREA\PROD\CONTROL02.CTL

Finished restore at 23-JUN-16

 

RMAN>

 

4. 在引數檔案中增加如下內容:
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/prod','E:\app\oracle\oradata\PROD'

*.LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/prod','E:\app\oracle\oradata\PROD'

 

5. 關閉資料庫並啟動至nomount
  SQL> startup nomount

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

ORACLE 例程已經啟動。

 

Total System Global Area  835104768 bytes

Fixed Size                  2285832 bytes

Variable Size             541069048 bytes

Database Buffers          281018368 bytes

Redo Buffers               10731520 bytes

SQL> shutdown immediate

ORA-01507: ??????

 

 

ORACLE 例程已經關閉。

SQL> create spfile from pfile;

 

檔案已建立。

 

SQL> startup nomount

ORACLE 例程已經啟動。

 

Total System Global Area  835104768 bytes

Fixed Size                  2285832 bytes

Variable Size             541069048 bytes

Database Buffers          281018368 bytes

Redo Buffers               10731520 bytes

 

6. C:\Windows\system32>set ORACLE_SID=prod

 

C:\Windows\system32>rman target /

 

恢復管理器: Release 11.2.0.4.0 - Production on 星期四 6 23 11:23:45 2016

 

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

 

已連線到目標資料庫: PROD (DBID=326977200, 未開啟)

 

RMAN> catalog start with 'e:\dmp';

 

啟動 implicit crosscheck backup 23-6 -16

使用目標資料庫控制檔案替代恢復目錄

分配的通道: ORA_DISK_1

通道 ORA_DISK_1: SID=189 裝置型別=DISK

已交叉檢驗的 3 物件

完成 implicit crosscheck backup 23-6 -16

 

啟動 implicit crosscheck copy 23-6 -16

使用通道 ORA_DISK_1

完成 implicit crosscheck copy 23-6 -16

 

搜尋恢復區中的所有檔案

正在編制檔案目錄...

目錄編制完畢

 

已列入目錄的檔案的列表

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

檔名: E:\APP\ORACLE\FAST_RECOVERY_AREA\PROD\AUTOBACKUP\2016_06_23\O1_MF_S_9152

72523_CPPKYJ5D_.BKP

 

搜尋與樣式 e:\dmp 匹配的所有檔案

 

資料庫未知檔案的列表

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

檔名: E:\dmp\export.log

檔名: E:\dmp\import.log

檔名: E:\dmp\initprod.ora

檔名: E:\dmp\o1_mf_annnn_TAG20160622T102157_cpmxl5fw_.bkp

檔名: E:\dmp\o1_mf_annnn_TAG20160622T102309_cpmxnfw8_.bkp

檔名: E:\dmp\o1_mf_nnndf_TAG20160622T102204_cpmxldq9_.bkp

檔名: E:\dmp\o1_mf_s_915186191_cpmxnhj4_.bkp

檔名: E:\dmp\prod_ora_4632.trc

檔名: E:\dmp\TTS.DMP

 

是否確實要將上述檔案列入目錄 (輸入 YES NO)? yes

正在編制檔案目錄...

目錄編制完畢

 

已列入目錄的檔案的列表

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

檔名: E:\dmp\o1_mf_annnn_TAG20160622T102157_cpmxl5fw_.bkp

檔名: E:\dmp\o1_mf_annnn_TAG20160622T102309_cpmxnfw8_.bkp

檔名: E:\dmp\o1_mf_nnndf_TAG20160622T102204_cpmxldq9_.bkp

檔名: E:\dmp\o1_mf_s_915186191_cpmxnhj4_.bkp

 

未列入目錄的檔案的列表

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

檔名: E:\dmp\export.log

  RMAN-07517: 原因: 檔案標頭已損壞

檔名: E:\dmp\import.log

  RMAN-07517: 原因: 檔案標頭已損壞

檔名: E:\dmp\initprod.ora

  RMAN-07517: 原因: 檔案標頭已損壞

檔名: E:\dmp\prod_ora_4632.trc

  RMAN-07517: 原因: 檔案標頭已損壞

檔名: E:\dmp\TTS.DMP

  RMAN-07520: 原因: 資料泵轉儲檔案

 

RMAN>

 

7. restore database
 
遇到如下錯誤:

  RMAN> run{

2> set newname for datafile '/u01/app/oracle/oradata/prod/system01.dbf' to 'E:\A

PP\ORACLE\ORADATA\PROD\SYSTEM01.DBF';

3> set newname for datafile '/u01/app/oracle/oradata/prod/sysaux01.dbf' to 'E:\A

PP\ORACLE\ORADATA\PROD\SYSAUX01.DBF';

4> set newname for datafile '/u01/app/oracle/oradata/prod/undotbs01.dbf' to 'E:\

APP\ORACLE\ORADATA\PROD\UNDOTBS01.DBF';

5> set newname for datafile '/u01/app/oracle/oradata/prod/users01.dbf' to 'E:\AP

P\ORACLE\ORADATA\PROD\USERS01.DBF';

6> set newname for datafile '/u01/app/oracle/oradata/prod/example01.dbf' to 'E:\

APP\ORACLE\ORADATA\PROD\EXAMPLE01.DBF';

7> restore database;

8> }

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

啟動 restore 23-6 -16

使用通道 ORA_DISK_1

 

通道 ORA_DISK_1: 正在開始還原資料檔案備份集

通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案

通道 ORA_DISK_1: 將資料檔案 00001 還原到 /u01/app/oracle/oradata/prod/system01.d

bf

通道 ORA_DISK_1: 將資料檔案 00002 還原到 /u01/app/oracle/oradata/prod/sysaux01.d

bf

通道 ORA_DISK_1: 將資料檔案 00003 還原到 /u01/app/oracle/oradata/prod/undotbs01.

dbf

通道 ORA_DISK_1: 將資料檔案 00004 還原到 /u01/app/oracle/oradata/prod/users01.db

f

通道 ORA_DISK_1: 將資料檔案 00005 還原到 /u01/app/oracle/oradata/prod/example01.

dbf

通道 ORA_DISK_1: 正在讀取備份片段 E:\DMP\O1_MF_NNNDF_TAG20160622T102204_CPMXLDQ9

_.BKP

通道 ORA_DISK_1: ORA-19870: 還原備份片段 E:\DMP\O1_MF_NNNDF_TAG20160622T102204_C

PMXLDQ9_.BKP 時出錯

ORA-19504: 無法建立檔案"E:\U01\APP\ORACLE\ORADATA\PROD\SYSTEM01.DBF"

ORA-27040: 檔案建立錯誤, 無法建立檔案

OSD-04002: 無法開啟檔案

O/S-Error: (OS 3) 系統找不到指定的路徑。

 

故障轉移到上一個備份

 

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

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

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

RMAN-03002: restore 命令 ( 06/23/2016 11:25:19 ) 失敗

RMAN-06026: 有些目標沒有找到 - 終止還原

RMAN-06023: 沒有找到資料檔案5的副本來還原

RMAN-06023: 沒有找到資料檔案4的副本來還原

RMAN-06023: 沒有找到資料檔案3的副本來還原

RMAN-06023: 沒有找到資料檔案2的副本來還原

RMAN-06023: 沒有找到資料檔案1的副本來還原

 

RMAN>

 

根據file#來進行恢復:

run{

set newname for datafile 1 to 'E:\APP\ORACLE\ORADATA\PROD\SYSTEM01.DBF';

set newname for datafile 2 to 'E:\APP\ORACLE\ORADATA\PROD\SYSAUX01.DBF';

set newname for datafile 3 to 'E:\APP\ORACLE\ORADATA\PROD\UNDOTBS01.DBF';

set newname for datafile 4 to 'E:\APP\ORACLE\ORADATA\PROD\USERS01.DBF';

set newname for datafile 5 to 'E:\APP\ORACLE\ORADATA\PROD\EXAMPLE01.DBF';

restore database;

}

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

正在執行命令: SET NEWNAME

 

啟動 restore 23-6 -16

使用通道 ORA_DISK_1

 

通道 ORA_DISK_1: 正在開始還原資料檔案備份集

通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案

通道 ORA_DISK_1: 將資料檔案 00001 還原到 E:\APP\ORACLE\ORADATA\PROD\SYSTEM01.DBF

 

通道 ORA_DISK_1: 將資料檔案 00002 還原到 E:\APP\ORACLE\ORADATA\PROD\SYSAUX01.DBF

 

通道 ORA_DISK_1: 將資料檔案 00003 還原到 E:\APP\ORACLE\ORADATA\PROD\UNDOTBS01.DB

F

通道 ORA_DISK_1: 將資料檔案 00004 還原到 E:\APP\ORACLE\ORADATA\PROD\USERS01.DBF

通道 ORA_DISK_1: 將資料檔案 00005 還原到 E:\APP\ORACLE\ORADATA\PROD\EXAMPLE01.DB

F

通道 ORA_DISK_1: 正在讀取備份片段 E:\DMP\O1_MF_NNNDF_TAG20160622T102204_CPMXLDQ9

_.BKP

通道 ORA_DISK_1: 段控制程式碼 = E:\DMP\O1_MF_NNNDF_TAG20160622T102204_CPMXLDQ9_.BKP

= TAG20160622T102204

通道 ORA_DISK_1: 已還原備份片段 1

通道 ORA_DISK_1: 還原完成, 用時: 00:01:05

完成 restore 23-6 -16

 

此時開啟資料庫時報錯:

SQL> alter database open resetlogs;

alter database open resetlogs

*

1 行出現錯誤:

ORA-01157: 無法標識/鎖定資料檔案 1 - 請參閱 DBWR 跟蹤檔案

ORA-01110: 資料檔案 1: '/u01/app/oracle/oradata/prod/system01.dbf'

 

因為restore的控制檔案記錄的資料檔案位置還是linux資料庫下的資料檔案路徑:
SQL> select file#,name from v$datafile;

 

     FILE#

----------

NAME

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

 

         1

/u01/app/oracle/oradata/prod/system01.dbf

 

         2

/u01/app/oracle/oradata/prod/sysaux01.dbf

 

         3

/u01/app/oracle/oradata/prod/undotbs01.dbf

 

 

     FILE#

----------

NAME

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

 

         4

/u01/app/oracle/oradata/prod/users01.dbf

 

         5

/u01/app/oracle/oradata/prod/example01.dbf

 

 

此時需要重建控制檔案:

CREATE CONTROLFILE reuse DATABASE "PROD" RESETLOGS  NOARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 'E:\APP\ORACLE\ORADATA\PROD\REDO01.LOG'  SIZE 50M BLOCKSIZE 512,

  GROUP 2 'E:\APP\ORACLE\ORADATA\PROD\REDO02.LOG'  SIZE 50M BLOCKSIZE 512,

  GROUP 3 'E:\APP\ORACLE\ORADATA\PROD\REDO03.LOG'  SIZE 50M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  'E:\APP\ORACLE\ORADATA\PROD\SYSTEM01.DBF',

  'E:\APP\ORACLE\ORADATA\PROD\SYSAUX01.DBF',

  'E:\APP\ORACLE\ORADATA\PROD\UNDOTBS01.DBF',

  'E:\APP\ORACLE\ORADATA\PROD\USERS01.DBF',

  'E:\APP\ORACLE\ORADATA\PROD\EXAMPLE01.DBF'

 CHARACTER SET ZHS16GBK

 

SQL> CREATE CONTROLFILE reuse DATABASE "PROD" RESETLOGS  NOARCHIVELOG

  2      MAXLOGFILES 16

  3      MAXLOGMEMBERS 3

  4      MAXDATAFILES 100

  5      MAXINSTANCES 8

  6      MAXLOGHISTORY 292

  7  LOGFILE

  8    GROUP 1 'E:\APP\ORACLE\ORADATA\PROD\REDO01.LOG'  SIZE 50M BLOCKSIZE 512,

  9    GROUP 2 'E:\APP\ORACLE\ORADATA\PROD\REDO02.LOG'  SIZE 50M BLOCKSIZE 512,

 10    GROUP 3 'E:\APP\ORACLE\ORADATA\PROD\REDO03.LOG'  SIZE 50M BLOCKSIZE 512

 11  -- STANDBY LOGFILE

 12  DATAFILE

 13    'E:\APP\ORACLE\ORADATA\PROD\SYSTEM01.DBF',

 14    'E:\APP\ORACLE\ORADATA\PROD\SYSAUX01.DBF',

 15    'E:\APP\ORACLE\ORADATA\PROD\UNDOTBS01.DBF',

 16    'E:\APP\ORACLE\ORADATA\PROD\USERS01.DBF',

 17    'E:\APP\ORACLE\ORADATA\PROD\EXAMPLE01.DBF'

 18   CHARACTER SET ZHS16GBK

 19  /

 

控制檔案已建立。

 

SQL> alter database open resetlogs;

 

資料庫已更改。

 

SQL>

 

至此,資料庫已經可以開啟。但是這裡並沒有進行recover database

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

相關文章