Oracle ASM磁盘组迁移指导手册

Oracle ASM磁盘组迁移指导手册
zzt_2009 2020-04-13 16:25:02 37 收藏 1
展开

说明:本文为ASM磁盘组迁移指导手册
标签:迁移ASM磁盘组、ASM磁盘组迁移、更换数据库ASM磁盘组、RAC备份恢复、集群数据库迁移
温馨提示:如果您发现本文哪里写的有问题或者有更好的写法请留言或私信我进行修改优化


★ 创建测试目录
//////////////////////////////////////////
su - oracle
mkdir -p /home/oracle/zzt_backup/

★ 进行全库备份
//////////////////////////////////////////
SQL> shutdown immediate
SQL> startup mount

    RMAN> run{
    allocate channel zzt_disk01 device type disk;
    allocate channel zzt_disk02 device type disk;
    allocate channel zzt_disk03 device type disk;
    #数据文件
    backup incremental level 0 database tag zzt_lvl0_data
    format '/home/oracle/zzt_backup/zzt_lvl0_data_%d_%T_%u.dbf' ;             
    #归档文件
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    backup archivelog all delete input tag zzt_lvl0_arch
    format '/home/oracle/zzt_backup/zzt_lvl0_arch_%d_%T_%u_%e.arc' ;
    #控制文件
    backup current controlfile tag zzt_lvl0_ctlf
    format '/home/oracle/zzt_backup/zzt_lvl0_ctlf_%d_%T_%u.ctl' ;
    #参数文件
    backup spfile tag zzt_lvl0_spfi
    format '/home/oracle/zzt_backup/zzt_lvl0_spfi_%d_%T_%u.spf' ;
    release channel zzt_disk01;
    release channel zzt_disk02;
    release channel zzt_disk03;
    }

★ ASM磁盘组迁移指导
//////////////////////////////////////////
※ 新旧ASM磁盘组迁移方向
    +DATA → +NDATA
    +FRA  → +NFRA

★ 用RMAN迁移参数文件+控制文件到新ASM磁盘组
//////////////////////////////////////////
RMAN> run{
allocate channel zzt_disk01 device type disk;
restore spfile to '+NDATA/spfile.ora';
restore controlfile to '+NDATA/ctrl01.dbf';
restore controlfile to '+NFRA/ctrl02.dbf';
release channel zzt_disk01;
}

★ 查看当前数据库redo信息,以便后期完全恢复时参考
//////////////////////////////////////////
SQL> select * from v$log;
SQL> select * from v$logfile;
SQL> shutdown immediate

★ 修改RAC中DB的参数文件到新位置
//////////////////////////////////////////
[root  ]# su - oracle
[oracle]$ cd $ORACLE_HOME/dbs/
[oracle]$ vi initXXX.ora        【此处的XXX为数据库节点实例名】
          SPFILE='+NDATA/spfile.ora'

★ 修改RAC中DB的控制文件到新位置
//////////////////////////////////////////
SQL> startup mount
SQL> alter system set db_recovery_file_dest='+NFRA' scope=both sid='*';
SQL> alter system set control_files='+NDATA/ctrl01.dbf','+NFRA/ctrl02.dbf' scope=spfile sid='*';
SQL> startup mount force
SQL> show parameter spfile
SQL> show parameter control_files
SQL> show parameter db_recovery_file_dest

★ 使用RMAN备份将数据库恢复到到新ASM磁盘组
//////////////////////////////////////////
RMAN> run{
allocate channel zzt_disk01 device type disk;
allocate channel zzt_disk02 device type disk;
allocate channel zzt_disk03 device type disk;
set newname for database to '+NDATA';
restore database;
switch datafile all;
switch tempfile all;
release channel zzt_disk01;
release channel zzt_disk02;
release channel zzt_disk03;
}

SQL> select name from v$datafile;

★ 修改归档路径并使用RMAN备份进行数据库恢复
//////////////////////////////////////////
注意:如果RMAN检测到一个归档的重做日志已存在,就不会在磁盘上还原这个归档的重做日志,即使设置的还原位置不同与默认的归档日志位置,Oracle 也不会在这个新的位置上恢复归档的重做日志。
RMAN> run{
allocate channel zzt_disk01 device type disk;
allocate channel zzt_disk02 device type disk;
allocate channel zzt_disk03 device type disk;
set archivelog destination to '+NFRA';
#restore archivelog all;
recover database;
release channel zzt_disk01;
release channel zzt_disk02;
release channel zzt_disk03;
}    

※ 查看归档的相关信息

    SQL>
    select * from (select thread#,SEQUENCE#,name from v$archived_log order by thread#,SEQUENCE#) where thread#=1 and rownum<5
    union
    select * from (select thread#,SEQUENCE#,name from v$archived_log order by thread#,SEQUENCE#) where thread#=2 and rownum<5
    ;


★ 验证数据库完整性并起库
//////////////////////////////////////////
※ 根据之前的控制文件中记录的redo在线日志信息(v$log/v$logfile)来判断数据库是否可以并执行了完全恢复
※ 对比查看rman执行“recover database”恢复时,有没有恢复current组的在线日志

    ① 如果有恢复,则直接resetlogs起库即可;
        SQL> alter database open resetlogs;
    ② 如果没有恢复,则使用下面的方法手动指定相关在线日志文件进行恢复,然后起库
        SQL> recover database using backup controlfile until cancel;
            +DATA/{DB_NAME}/onlinelog/{group_1.261.952947745}        
            【输入没有备份的在线日志文件进行完全恢复】
            【如果选择的redo在线日志选择正确则输出:“Log applied.”】
            【如果选择的redo在线日志选择错误则输出:“ORA-00325”】
        SQL> alter database open resetlogs;

★ 修改redo日志相关信息
//////////////////////////////////////////
※ 具体执行步骤参考网文:https://www.cnblogs.com/xqzt/p/5034826.html
alter database add logfile thread 1 group 5 ('+NDATA','+NFRA') size 50M;
alter database add logfile thread 1 group 6 ('+NDATA','+NFRA') size 50M;
alter database add logfile thread 2 group 7 ('+NDATA','+NFRA') size 50M;
alter database add logfile thread 2 group 8 ('+NDATA','+NFRA') size 50M;
alter system switch logfile;
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;

 

★ 修改临时表空间相关信息
//////////////////////////////////////////
SQL> create temporary tablespace temp2 tempfile '+ndata' size 10m autoextend on;
SQL> alter database default temporary tablespace temp2;
SQL> drop tablespace temp including contents and datafiles;

 

    至此整个数据库操作执行完成,感谢您的观看。以下为相关日志输出,仅供参考

备份
☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀

    RMAN>
    run{
    allocate channel zzt_disk01 device type disk;
    allocate channel zzt_disk02 device type disk;
    allocate channel zzt_disk03 device type disk;
    #数据文件
    backup incremental level 0 database tag zzt_lvl0_data
    format '/home/oracle/zzt_backup/zzt_lvl0_data_%d_%T_%u.dbf' ;             
    #归档文件
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    backup archivelog all delete input tag zzt_lvl0_arch
    format '/home/oracle/zzt_backup/zzt_lvl0_arch_%d_%T_%u_%e.arc' ;
    #控制文件
    backup current controlfile tag zzt_lvl0_ctlf
    format '/home/oracle/zzt_backup/zzt_lvl0_ctlf_%d_%T_%u.ctl' ;
    #参数文件
    backup spfile tag zzt_lvl0_spfi
    format '/home/oracle/zzt_backup/zzt_lvl0_spfi_%d_%T_%u.spf' ;
    release channel zzt_disk01;
    release channel zzt_disk02;
    release channel zzt_disk03;
    }
    using target database control file instead of recovery catalog
    allocated channel: zzt_disk01
    channel zzt_disk01: SID=160 instance=racdb1 device type=DISK
    allocated channel: zzt_disk02
    channel zzt_disk02: SID=26 instance=racdb1 device type=DISK
    allocated channel: zzt_disk03
    channel zzt_disk03: SID=152 instance=racdb1 device type=DISK
    Starting backup at 13-APR-20
    channel zzt_disk01: starting incremental level 0 datafile backup set
    channel zzt_disk01: specifying datafile(s) in backup set
    input datafile file number=00001 name=+DATA/racdb/datafile/system.256.952947643
    input datafile file number=00006 name=+DATA/racdb/datafile/undotbs2.265.952947977
    channel zzt_disk01: starting piece 1 at 13-APR-20
    channel zzt_disk02: starting incremental level 0 datafile backup set
    channel zzt_disk02: specifying datafile(s) in backup set
    input datafile file number=00002 name=+DATA/racdb/datafile/sysaux.257.952947643
    input datafile file number=00004 name=+DATA/racdb/datafile/users.259.952947643
    channel zzt_disk02: starting piece 1 at 13-APR-20
    channel zzt_disk03: starting incremental level 0 datafile backup set
    channel zzt_disk03: specifying datafile(s) in backup set
    input datafile file number=00005 name=+DATA/racdb/datafile/example.264.952947763
    input datafile file number=00003 name=+DATA/racdb/datafile/undotbs1.258.952947643
    channel zzt_disk03: starting piece 1 at 13-APR-20
    channel zzt_disk01: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_01uthhoq.dbf tag=ZZT_LVL0_DATA comment=NONE
    channel zzt_disk01: backup set complete, elapsed time: 00:00:39
    channel zzt_disk01: starting incremental level 0 datafile backup set
    channel zzt_disk01: specifying datafile(s) in backup set
    channel zzt_disk02: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_02uthhoq.dbf tag=ZZT_LVL0_DATA comment=NONE
    channel zzt_disk02: backup set complete, elapsed time: 00:00:40
    channel zzt_disk02: starting incremental level 0 datafile backup set
    channel zzt_disk02: specifying datafile(s) in backup set
    including current SPFILE in backup set
    channel zzt_disk02: starting piece 1 at 13-APR-20
    channel zzt_disk03: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_03uthhot.dbf tag=ZZT_LVL0_DATA comment=NONE
    channel zzt_disk03: backup set complete, elapsed time: 00:00:28
    including current control file in backup set
    channel zzt_disk01: starting piece 1 at 13-APR-20
    channel zzt_disk02: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_05uthhq2.dbf tag=ZZT_LVL0_DATA comment=NONE
    channel zzt_disk02: backup set complete, elapsed time: 00:00:01
    channel zzt_disk01: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_04uthhq2.dbf tag=ZZT_LVL0_DATA comment=NONE
    channel zzt_disk01: backup set complete, elapsed time: 00:00:01
    Finished backup at 13-APR-20
    sql statement: alter system archive log current
    sql statement: alter system archive log current
    sql statement: alter system archive log current
    Starting backup at 13-APR-20
    current log archived
    channel zzt_disk01: starting archived log backup set
    channel zzt_disk01: specifying archived log(s) in backup set
    input archived log thread=1 sequence=6 RECID=3 STAMP=952950882
    channel zzt_disk01: starting piece 1 at 13-APR-20
    channel zzt_disk02: starting archived log backup set
    channel zzt_disk02: specifying archived log(s) in backup set
    input archived log thread=2 sequence=3 RECID=5 STAMP=960456622
    input archived log thread=1 sequence=7 RECID=4 STAMP=952950884
    input archived log thread=2 sequence=4 RECID=8 STAMP=960460146
    channel zzt_disk02: starting piece 1 at 13-APR-20
    channel zzt_disk03: starting archived log backup set
    channel zzt_disk03: specifying archived log(s) in backup set
    input archived log thread=1 sequence=8 RECID=6 STAMP=960460144
    input archived log thread=1 sequence=9 RECID=7 STAMP=960460145
    input archived log thread=2 sequence=5 RECID=9 STAMP=975340404
    input archived log thread=2 sequence=6 RECID=12 STAMP=975340462
    input archived log thread=1 sequence=10 RECID=10 STAMP=975340459
    input archived log thread=1 sequence=11 RECID=11 STAMP=975340460
    input archived log thread=2 sequence=7 RECID=13 STAMP=975341630
    input archived log thread=2 sequence=8 RECID=14 STAMP=975341631
    input archived log thread=1 sequence=12 RECID=17 STAMP=975341637
    input archived log thread=2 sequence=9 RECID=15 STAMP=975341633
    channel zzt_disk03: starting piece 1 at 13-APR-20
    channel zzt_disk01: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_06uthhqh_6.arc tag=ZZT_LVL0_ARCH comment=NONE
    channel zzt_disk01: backup set complete, elapsed time: 00:00:03
    channel zzt_disk01: deleting archived log(s)
    archived log file name=+FRA/racdb/archivelog/2017_08_25/thread_1_seq_6.263.952950881 RECID=3 STAMP=952950882
    channel zzt_disk01: starting archived log backup set
    channel zzt_disk01: specifying archived log(s) in backup set
    input archived log thread=2 sequence=10 RECID=16 STAMP=975341633
    input archived log thread=1 sequence=13 RECID=18 STAMP=975341776
    input archived log thread=1 sequence=14 RECID=19 STAMP=975341776
    input archived log thread=2 sequence=11 RECID=22 STAMP=975341781
    input archived log thread=1 sequence=15 RECID=20 STAMP=975341779
    input archived log thread=1 sequence=16 RECID=21 STAMP=975341781
    input archived log thread=2 sequence=12 RECID=24 STAMP=994929327
    input archived log thread=1 sequence=17 RECID=23 STAMP=994929324
    input archived log thread=2 sequence=13 RECID=25 STAMP=994929327
    input archived log thread=1 sequence=18 RECID=26 STAMP=1037616653
    channel zzt_disk01: starting piece 1 at 13-APR-20
    channel zzt_disk02: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_07uthhqi_4.arc tag=ZZT_LVL0_ARCH comment=NONE
    channel zzt_disk02: backup set complete, elapsed time: 00:00:02
    channel zzt_disk02: deleting archived log(s)
    archived log file name=+FRA/racdb/archivelog/2017_11_19/thread_2_seq_3.265.960456621 RECID=5 STAMP=960456622
    archived log file name=+FRA/racdb/archivelog/2017_08_25/thread_1_seq_7.264.952950883 RECID=4 STAMP=952950884
    archived log file name=+FRA/racdb/archivelog/2017_11_19/thread_2_seq_4.267.960460145 RECID=8 STAMP=960460146
    channel zzt_disk02: starting archived log backup set
    channel zzt_disk02: specifying archived log(s) in backup set
    input archived log thread=1 sequence=19 RECID=27 STAMP=1037616966
    input archived log thread=1 sequence=20 RECID=28 STAMP=1037616970
    input archived log thread=1 sequence=21 RECID=29 STAMP=1037616974
    input archived log thread=1 sequence=22 RECID=30 STAMP=1037616977
    channel zzt_disk02: starting piece 1 at 13-APR-20
    channel zzt_disk03: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_08uthhqj_9.arc tag=ZZT_LVL0_ARCH comment=NONE
    channel zzt_disk03: backup set complete, elapsed time: 00:00:02
    channel zzt_disk03: deleting archived log(s)
    archived log file name=+FRA/racdb/archivelog/2017_11_19/thread_1_seq_8.266.960460143 RECID=6 STAMP=960460144
    archived log file name=+FRA/racdb/archivelog/2017_11_19/thread_1_seq_9.268.960460145 RECID=7 STAMP=960460145
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_5.269.975340403 RECID=9 STAMP=975340404
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_6.272.975340461 RECID=12 STAMP=975340462
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_10.270.975340459 RECID=10 STAMP=975340459
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_11.271.975340461 RECID=11 STAMP=975340460
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_7.273.975341631 RECID=13 STAMP=975341630
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_8.274.975341631 RECID=14 STAMP=975341631
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_12.277.975341637 RECID=17 STAMP=975341637
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_9.275.975341633 RECID=15 STAMP=975341633
    channel zzt_disk01: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_09uthhql_18.arc tag=ZZT_LVL0_ARCH comment=NONE
    channel zzt_disk01: backup set complete, elapsed time: 00:00:01
    channel zzt_disk01: deleting archived log(s)
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_10.276.975341633 RECID=16 STAMP=975341633
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_13.278.975341777 RECID=18 STAMP=975341776
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_14.279.975341777 RECID=19 STAMP=975341776
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_2_seq_11.282.975341781 RECID=22 STAMP=975341781
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_15.280.975341779 RECID=20 STAMP=975341779
    archived log file name=+FRA/racdb/archivelog/2018_05_05/thread_1_seq_16.281.975341781 RECID=21 STAMP=975341781
    archived log file name=+FRA/racdb/archivelog/2018_12_15/thread_2_seq_12.284.994929327 RECID=24 STAMP=994929327
    archived log file name=+FRA/racdb/archivelog/2018_12_15/thread_1_seq_17.283.994929323 RECID=23 STAMP=994929324
    archived log file name=+FRA/racdb/archivelog/2018_12_15/thread_2_seq_13.285.994929327 RECID=25 STAMP=994929327
    archived log file name=+FRA/racdb/archivelog/2020_04_13/thread_1_seq_18.286.1037616653 RECID=26 STAMP=1037616653
    channel zzt_disk02: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_0authhql_22.arc tag=ZZT_LVL0_ARCH comment=NONE
    channel zzt_disk02: backup set complete, elapsed time: 00:00:01
    channel zzt_disk02: deleting archived log(s)
    archived log file name=+FRA/racdb/archivelog/2020_04_13/thread_1_seq_19.287.1037616967 RECID=27 STAMP=1037616966
    archived log file name=+FRA/racdb/archivelog/2020_04_13/thread_1_seq_20.288.1037616971 RECID=28 STAMP=1037616970
    archived log file name=+FRA/racdb/archivelog/2020_04_13/thread_1_seq_21.289.1037616975 RECID=29 STAMP=1037616974
    archived log file name=+FRA/racdb/archivelog/2020_04_13/thread_1_seq_22.261.1037616977 RECID=30 STAMP=1037616977
    Finished backup at 13-APR-20
    Starting backup at 13-APR-20
    channel zzt_disk01: starting full datafile backup set
    channel zzt_disk01: specifying datafile(s) in backup set
    including current control file in backup set
    channel zzt_disk01: starting piece 1 at 13-APR-20
    channel zzt_disk01: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_ctlf_RACDB_20200413_0buthhqo.ctl tag=ZZT_LVL0_CTLF comment=NONE
    channel zzt_disk01: backup set complete, elapsed time: 00:00:02
    Finished backup at 13-APR-20
    Starting backup at 13-APR-20
    channel zzt_disk01: starting full datafile backup set
    channel zzt_disk01: specifying datafile(s) in backup set
    including current SPFILE in backup set
    channel zzt_disk01: starting piece 1 at 13-APR-20
    channel zzt_disk01: finished piece 1 at 13-APR-20
    piece handle=/home/oracle/zzt_backup/zzt_lvl0_spfi_RACDB_20200413_0cuthhqr.spf tag=ZZT_LVL0_SPFI comment=NONE
    channel zzt_disk01: backup set complete, elapsed time: 00:00:01
    Finished backup at 13-APR-20
    released channel: zzt_disk01
    released channel: zzt_disk02
    released channel: zzt_disk03
    RMAN>



迁移参数文件和控制文件
☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀

    RMAN>
    run{
    allocate channel zzt_disk01 device type disk;
    restore spfile to '+NDATA/spfile.ora';
    restore controlfile to '+NDATA/ctrl01.dbf';
    restore controlfile to '+NFRA/ctrl02.dbf';
    release channel zzt_disk01;
    }
     
    allocated channel: zzt_disk01
    channel zzt_disk01: SID=160 instance=racdb1 device type=DISK
     
    Starting restore at 13-APR-20
     
    channel zzt_disk01: starting datafile backup set restore
    channel zzt_disk01: restoring SPFILE
    output file name=+NDATA/spfile.ora
    channel zzt_disk01: reading from backup piece /home/oracle/zzt_backup/zzt_lvl0_spfi_RACDB_20200413_0cuthhqr.spf
    channel zzt_disk01: piece handle=/home/oracle/zzt_backup/zzt_lvl0_spfi_RACDB_20200413_0cuthhqr.spf tag=ZZT_LVL0_SPFI
    channel zzt_disk01: restored backup piece 1
    channel zzt_disk01: restore complete, elapsed time: 00:00:01
    Finished restore at 13-APR-20
     
    Starting restore at 13-APR-20
     
    channel zzt_disk01: starting datafile backup set restore
    channel zzt_disk01: restoring control file
    output file name=+NDATA/ctrl01.dbf
    channel zzt_disk01: reading from backup piece /home/oracle/zzt_backup/zzt_lvl0_ctlf_RACDB_20200413_0buthhqo.ctl
    channel zzt_disk01: piece handle=/home/oracle/zzt_backup/zzt_lvl0_ctlf_RACDB_20200413_0buthhqo.ctl tag=ZZT_LVL0_CTLF
    channel zzt_disk01: restored backup piece 1
    channel zzt_disk01: restore complete, elapsed time: 00:00:01
    Finished restore at 13-APR-20
     
    Starting restore at 13-APR-20
     
    channel zzt_disk01: restoring control file
    output file name=+NFRA/ctrl02.dbf
    channel zzt_disk01: copied control file copy
    input file name=+NDATA/ctrl01.dbf
    output file name=+NFRA/ctrl02.dbf RECID=3 STAMP=1037617670
    Finished restore at 13-APR-20
     
    released channel: zzt_disk01
     
    RMAN>

 


redo日志信息
☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀

    SQL> select * from v$log;
     
        GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARCHIVED STATUS           FIRST_CHANGE# FIRST_TIME  NEXT_CHANGE# NEXT_TIME
    ---------- ---------- ---------- ---------- ---------- ---------- -------- ---------------- ------------- ----------- ------------ -----------
             1          1         23   52428800        512          2 NO       CURRENT                1350044 2020/4/13 1 281474976710
             2          1         22   52428800        512          2 YES      INACTIVE               1350036 2020/4/13 1      1350044 2020/4/13 1
             3          2         13   52428800        512          2 YES      INACTIVE               1328235 2018/12/15       1328243 2018/12/15
             4          2         12   52428800        512          2 YES      INACTIVE               1300861 2018/5/5 16      1328235 2018/12/15
     
    SQL> select * from v$logfile;
     
        GROUP# STATUS  TYPE    MEMBER                                                                           IS_RECOVERY_DEST_FILE
    ---------- ------- ------- -------------------------------------------------------------------------------- ---------------------
             2         ONLINE  +DATA/racdb/onlinelog/group_2.262.952947747                                      NO
             2         ONLINE  +FRA/racdb/onlinelog/group_2.258.952947749                                       YES
             1         ONLINE  +DATA/racdb/onlinelog/group_1.261.952947745                                      NO
             1         ONLINE  +FRA/racdb/onlinelog/group_1.257.952947745                                       YES
             3         ONLINE  +DATA/racdb/onlinelog/group_3.266.952948095                                      NO
             3         ONLINE  +FRA/racdb/onlinelog/group_3.259.952948097                                       YES
             4         ONLINE  +DATA/racdb/onlinelog/group_4.267.952948099                                      NO
             4         ONLINE  +FRA/racdb/onlinelog/group_4.260.952948099                                       YES



新的参数文件+控制文件+归档信息
☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀

    SQL> show parameter spfile
    NAME                     TYPE     VALUE
    ------------------------------------ ----------- ------------------------------
    spfile                     string     +NDATA/spfile.ora
     
    SQL> show parameter control_files
    NAME                     TYPE     VALUE
    ------------------------------------ ----------- ------------------------------
    control_files                 string     +NDATA/ctrl01.dbf, +NFRA/ctrl0
                             2.dbf
    SQL> show parameter db_recovery_file_dest
     
    NAME                     TYPE     VALUE
    ------------------------------------ ----------- ------------------------------
    db_recovery_file_dest             string     +NFRA
    db_recovery_file_dest_size         big integer 4347M

 


数据库搬迁
☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀

    [oracle@rac1 ~]$ rlwrap rman target /
     
    Recovery Manager: Release 11.2.0.3.0 - Production on Mon Apr 13 11:33:05 2020
     
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
     
    connected to target database: RACDB (DBID=950564508, not open)
     
    run{
    allocate channel zzt_disk01 device type disk;
    set newname for database to '+NDATA';
    restore database;
    switch datafile all;
    release channel zzt_disk01;
    7> }
     
    using target database control file instead of recovery catalog
    allocated channel: zzt_disk01
    channel zzt_disk01: SID=18 instance=racdb1 device type=DISK
     
    executing command: SET NEWNAME
     
    Starting restore at 13-APR-20
    Starting implicit crosscheck backup at 13-APR-20
    Crosschecked 10 objects
    Finished implicit crosscheck backup at 13-APR-20
     
    Starting implicit crosscheck copy at 13-APR-20
    Finished implicit crosscheck copy at 13-APR-20
     
    searching for all files in the recovery area
    cataloging files...
    no files cataloged
     
     
    channel zzt_disk01: starting datafile backup set restore
    channel zzt_disk01: specifying datafile(s) to restore from backup set
    channel zzt_disk01: restoring datafile 00001 to +NDATA
    channel zzt_disk01: restoring datafile 00006 to +NDATA
    channel zzt_disk01: reading from backup piece /home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_01uthhoq.dbf
    channel zzt_disk01: piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_01uthhoq.dbf tag=ZZT_LVL0_DATA
    channel zzt_disk01: restored backup piece 1
    channel zzt_disk01: restore complete, elapsed time: 00:00:25
    channel zzt_disk01: starting datafile backup set restore
    channel zzt_disk01: specifying datafile(s) to restore from backup set
    channel zzt_disk01: restoring datafile 00002 to +NDATA
    channel zzt_disk01: restoring datafile 00004 to +NDATA
    channel zzt_disk01: reading from backup piece /home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_02uthhoq.dbf
    channel zzt_disk01: piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_02uthhoq.dbf tag=ZZT_LVL0_DATA
    channel zzt_disk01: restored backup piece 1
    channel zzt_disk01: restore complete, elapsed time: 00:00:15
    channel zzt_disk01: starting datafile backup set restore
    channel zzt_disk01: specifying datafile(s) to restore from backup set
    channel zzt_disk01: restoring datafile 00003 to +NDATA
    channel zzt_disk01: restoring datafile 00005 to +NDATA
    channel zzt_disk01: reading from backup piece /home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_03uthhot.dbf
    channel zzt_disk01: piece handle=/home/oracle/zzt_backup/zzt_lvl0_data_RACDB_20200413_03uthhot.dbf tag=ZZT_LVL0_DATA
    channel zzt_disk01: restored backup piece 1
    channel zzt_disk01: restore complete, elapsed time: 00:00:07
    Finished restore at 13-APR-20
     
    datafile 1 switched to datafile copy
    input datafile copy RECID=8 STAMP=1037619241 file name=+NDATA/racdb/datafile/system.258.1037619193
    datafile 2 switched to datafile copy
    input datafile copy RECID=9 STAMP=1037619241 file name=+NDATA/racdb/datafile/sysaux.260.1037619219
    datafile 3 switched to datafile copy
    input datafile copy RECID=10 STAMP=1037619241 file name=+NDATA/racdb/datafile/undotbs1.263.1037619233
    datafile 4 switched to datafile copy
    input datafile copy RECID=11 STAMP=1037619241 file name=+NDATA/racdb/datafile/users.261.1037619219
    datafile 5 switched to datafile copy
    input datafile copy RECID=12 STAMP=1037619241 file name=+NDATA/racdb/datafile/example.262.1037619233
    datafile 6 switched to datafile copy
    input datafile copy RECID=13 STAMP=1037619241 file name=+NDATA/racdb/datafile/undotbs2.259.1037619193
     
    released channel: zzt_disk01
     
    RMAN>
     
     
     
     
    SQL> select name from v$datafile;
    Warning: connection was lost and re-established
     
    NAME
    --------------------------------------------------------------------------------
    +NDATA/racdb/datafile/system.258.1037619193
    +NDATA/racdb/datafile/sysaux.260.1037619219
    +NDATA/racdb/datafile/undotbs1.263.1037619233
    +NDATA/racdb/datafile/users.261.1037619219
    +NDATA/racdb/datafile/example.262.1037619233
    +NDATA/racdb/datafile/undotbs2.259.1037619193
     
    6 rows selected

 


数据库恢复
☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀☀

    run{
    allocate channel zzt_disk01 device type disk;
    set archivelog destination to '+NFRA';
    #restore archivelog all;
    recover database;
    release channel zzt_disk01;
    }
     
     
    allocated channel: zzt_disk01
    channel zzt_disk01: SID=18 instance=racdb1 device type=DISK
     
    executing command: SET ARCHIVELOG DESTINATION
     
    Starting recover at 13-APR-20
     
    starting media recovery
     
    archived log for thread 1 with sequence 22 is already on disk as file +DATA/racdb/onlinelog/group_2.262.952947747
    archived log for thread 1 with sequence 23 is already on disk as file +DATA/racdb/onlinelog/group_1.261.952947745
    channel zzt_disk01: starting archived log restore to user-specified destination
    archived log destination=+NFRA
    channel zzt_disk01: restoring archived log
    archived log thread=1 sequence=19
    channel zzt_disk01: restoring archived log
    archived log thread=1 sequence=20
    channel zzt_disk01: restoring archived log
    archived log thread=1 sequence=21
    channel zzt_disk01: reading from backup piece /home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_0authhql_22.arc
    channel zzt_disk01: piece handle=/home/oracle/zzt_backup/zzt_lvl0_arch_RACDB_20200413_0authhql_22.arc tag=ZZT_LVL0_ARCH
    channel zzt_disk01: restored backup piece 1
    channel zzt_disk01: restore complete, elapsed time: 00:00:01
    archived log file name=+NFRA/racdb/archivelog/2020_04_13/thread_1_seq_19.257.1037620073 thread=1 sequence=19
    archived log file name=+NFRA/racdb/archivelog/2020_04_13/thread_1_seq_20.258.1037620073 thread=1 sequence=20
    archived log file name=+NFRA/racdb/archivelog/2020_04_13/thread_1_seq_21.259.1037620073 thread=1 sequence=21
    archived log file name=+DATA/racdb/onlinelog/group_2.262.952947747 thread=1 sequence=22
    archived log file name=+DATA/racdb/onlinelog/group_1.261.952947745 thread=1 sequence=23
    media recovery complete, elapsed time: 00:00:01
    Finished recover at 13-APR-20
     
    released channel: zzt_disk01
     
    RMAN>

※ 如果您觉得文章写的还不错, 别忘了在文末给作者点个赞哦 ~

 
————————————————
版权声明:本文为CSDN博主「zzt_2009」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zzt_2009/article/details/105490628

上一篇:实验2 汇编源程序编写与汇编、调试


下一篇:Gmssl与Openssl版本兼容安装方式,解决gmssl安装后,openssl无法使用的问题