• oracle使用rman备份集恢复方式创建ADG


    一、背景
    系统:
    主库:rhel 6.4 64bit
    备库:rhel 6.4 64bit
     
    内存:2G
    [oracle@dgdb1 ~]$ free -m
    total used free shared buffers cached
    Mem: 1863 1176 686 0 13 896
    -/+ buffers/cache: 266 1596
    Swap: 2047 78 1969
     
    ip分配:
    主库:192.168.12.50 dgdb1
    备库:192.168.12.51 dgdb2
     
    主库已安装数据库软件,并建库。
    备库已安装数据库软件,未建库。
     
    二、配置监听
    主库:
    LISTENER=
    (DESCRIPTION=
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST=dgdb1)(PORT=1521))
    )
    )
    SID_LIST_LISTENER=
    (SID_LIST=
    (SID_DESC=
    (GLOBAL_DBNAME=rmanpri)
    (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
    (SID_NAME=rmanpri)
    )
    )
     
    备库:
    LISTENER=
    (DESCRIPTION=
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST=dgdb2)(PORT=1521))
    )
    )
    SID_LIST_LISTENER=
    (SID_LIST=
    (SID_DESC=
    (GLOBAL_DBNAME=rmanstd)
    (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
    (SID_NAME=rmanstd)
    )
    )
     
    三、配置tns
    主库:
    RMANPRI=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=dgdb1)(PORT=1521))
    (CONNECT_DATA=
    (SERVICE_NAME=rmanpri)
    )
    )
     
    RMANSTD=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=dgdb2)(PORT=1521))
    (CONNECT_DATA=
    (SERVICE_NAME=rmanstd)
    )
    )
     
    备库:
    RMANPRI=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=dgdb1)(PORT=1521))
    (CONNECT_DATA=
    (SERVICE_NAME=rmanpri)
    )
    )
     
    RMANSTD=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=dgdb2)(PORT=1521))
    (CONNECT_DATA=
    (SERVICE_NAME=rmanstd)
    )
    )
     
    四、主库开启归档模式,开启强制日志
    SQL> alter database archivelog;
    SQL> alter database force logging;
    SQL> alter database open;
     
    五、修改主备库pfile
    主库参数文件(initrmanpri.ora)内容如下:
    rmanpri.__db_cache_size=415236096
    rmanpri.__java_pool_size=4194304
    rmanpri.__large_pool_size=8388608
    rmanpri.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    rmanpri.__pga_aggregate_target=197132288
    rmanpri.__sga_target=587202560
    rmanpri.__shared_io_pool_size=0
    rmanpri.__shared_pool_size=150994944
    rmanpri.__streams_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/rmanpri/adump'
    *.audit_trail='db'
    *.compatible='11.2.0.4.0'
    *.control_files='/u01/app/oracle/oradata/rmanpri/control01.ctl','/u01/app/oracle/fast_recovery_area/rmanpri/control02.ctl'
    *.db_block_size=8192
    *.db_domain=''
    *.db_name='rmanpri'
    *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    *.db_recovery_file_dest_size=4385144832
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=rmanpriXDB)'
    *.open_cursors=300
    *.pga_aggregate_target=195035136
    *.processes=150
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=585105408
    *.undo_tablespace='UNDOTBS1'
    DB_UNIQUE_NAME=rmanpri
    LOG_ARCHIVE_CONFIG='DG_CONFIG=(rmanpri,rmanstd)'
    LOG_ARCHIVE_DEST_1='LOCATION=/oracle/archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rmanpri'
    LOG_ARCHIVE_DEST_2= 'SERVICE=rmanstd ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rmanstd'
    LOG_ARCHIVE_DEST_STATE_1=ENABLE
    LOG_ARCHIVE_DEST_STATE_2=ENABLE
    FAL_SERVER=rmanstd
    DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/rmanstd','/u01/app/oracle/oradata/rmanpri'
    LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/rmanstd','/u01/app/oracle/oradata/rmanpri'
    STANDBY_FILE_MANAGEMENT=AUTO
     
    修改完成后,主库使用修改后的参数文件启动数据库,并创建spfile。
     
    备库参数文件(initrmanstd.ora)内容如下:
    [oracle@dgdb2 dbs]$ vi initrmanstd.ora
    rmanpri.__db_cache_size=415236096
    rmanpri.__java_pool_size=4194304
    rmanpri.__large_pool_size=8388608
    rmanpri.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    rmanpri.__pga_aggregate_target=197132288
    rmanpri.__sga_target=587202560
    rmanpri.__shared_io_pool_size=0
    rmanpri.__shared_pool_size=150994944
    rmanpri.__streams_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/rmanstd/adump'
    *.audit_trail='db'
    *.compatible='11.2.0.4.0'
    *.control_files='/u01/app/oracle/oradata/rmanstd/control01.ctl','/u01/app/oracle/fast_recovery_area/rmanstd/control02.ctl'
    *.db_block_size=8192
    *.db_domain=''
    *.db_name='rmanpri'
    *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    *.db_recovery_file_dest_size=4385144832
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=rmanstdXDB)'
    *.open_cursors=300
    *.pga_aggregate_target=195035136
    *.processes=150
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=585105408
    *.undo_tablespace='UNDOTBS1'
    DB_UNIQUE_NAME=rmanstd
    LOG_ARCHIVE_CONFIG='DG_CONFIG=(rmanstd,rmanpri)'
    LOG_ARCHIVE_DEST_1='LOCATION=/oracle/archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rmanstd'
    LOG_ARCHIVE_DEST_2= 'SERVICE=rmanpri ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rmanpri'
    LOG_ARCHIVE_DEST_STATE_1=ENABLE
    LOG_ARCHIVE_DEST_STATE_2=ENABLE
    FAL_SERVER=rmanpri
    DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/rmanpri','/u01/app/oracle/oradata/rmanstd'
    LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/rmanpri','/u01/app/oracle/oradata/rmanstd'
    STANDBY_FILE_MANAGEMENT=AUTO
     
    六、主库使用修改后的pfile启动,并且创建spfile,再用spfile启动。
    SQL> shutdown immediate
    SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initrmanpri.ora';
    SQL> create spfile from pfile;
    SQL> shutdown immediate
    SQL> startup
     
    七、备库创建目录
    [root@dgdb2 ~]# mkdir -p /rmanbak
    [root@dgdb2 ~]# mkdir -p /oracle/archive
    [root@dgdb2 ~]# chown -R oracle.oinstall /rmanbak/
    [root@dgdb2 ~]# chown -R oracle.oinstall /oracle/archive/
    [oracle@dgdb2 dbs]$ mkdir -p /u01/app/oracle/admin/rmanstd/{a,dp}dump
    [oracle@dgdb2 dbs]$ mkdir -p /u01/app/oracle/fast_recovery_area/rmanstd
    [oracle@dgdb2 dbs]$ mkdir -p /u01/app/oracle/oradata/rmanstd
     
    八、主库全备
    run
    {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    allocate channel c3 type disk;
    backup database format '/rmanbak/full_%d_%T_%s_%p';
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    backup archivelog all format '/rmanbak/arch_%d_%T_%s_%p';
    backup current controlfile for standby format '/rmanbak/ctl_bf';
    release channel c1;
    release channel c2;
    release channel c3;
    }
     
    九、将密码文件、修改后的参数文件传送到备库
    [oracle@dgdb1 dbs]$ scp initrmanpri.ora oracle@dgdb2:$ORACLE_HOME/dbs/initrmanstd.ora
    [oracle@dgdb1 dbs]$ scp orapwrmanpri oracle@dgdb2:$ORACLE_HOME/dbs/orapwrmanstd
     
    十、使用参数文件将备库启动到nomount状态
    SQL> startup nomount pfile=‘$ORACLE_HOME/dbs/initrmanstd.ora’;
     
    十一、登录rman恢复控制文件
    RMAN> restore standby controlfile from '/rmanbak/ctl_bf';
     
    Starting restore at 21-NOV-19
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=19 device type=DISK
     
    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
    output file name=/u01/app/oracle/oradata/rmanstd/control01.ctl
    output file name=/u01/app/oracle/fast_recovery_area/rmanstd/control02.ctl
    Finished restore at 21-NOV-19
     
    十二、将备库启动到mount状态
    RMAN> alter database mount;
     
    database mounted
    released channel: ORA_DISK_1
     
    十三、将传送到备库的数据库备份以及归档日志备份注册到rman
    RMAN> catalog start with '/rmanbak/';
     
    searching for all files that match the pattern /rmanbak/
     
    List of Files Unknown to the Database
    =====================================
    File Name: /rmanbak/ctl_bf
     
    Do you really want to catalog the above files (enter YES or NO)? yes
    cataloging files...
    cataloging done
     
    List of Cataloged Files
    =======================
    File Name: /rmanbak/ctl_bf
     
    十四、检查数据库备份以及归档日志备份
    检查数据库备份
    RMAN> list backup;
     
     
    List of Backup Sets
    ===================
     
     
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    15 Full 9.33M DISK 00:00:05 20-NOV-19
    BP Key: 15 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192658
    Piece Name: /rmanbak/full_RMANPRI_20191120_17_1
    Control File Included: Ckp SCN: 1048764 Ckp time: 20-NOV-19
     
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    16 Full 80.00K DISK 00:00:01 20-NOV-19
    BP Key: 16 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192658
    Piece Name: /rmanbak/full_RMANPRI_20191120_18_1
    SPFILE Included: Modification time: 20-NOV-19
    SPFILE db_unique_name: RMANPRI
     
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    17 Full 393.30M DISK 00:01:20 20-NOV-19
    BP Key: 17 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192658
    Piece Name: /rmanbak/full_RMANPRI_20191120_16_1
    List of Datafiles in backup set 17
    File LV Type Ckp SCN Ckp Time Name
    ---- -- ---- ---------- --------- ----
    2 Full 1048767 20-NOV-19 /u01/app/oracle/oradata/rmanstd/sysaux01.dbf
    3 Full 1048767 20-NOV-19 /u01/app/oracle/oradata/rmanstd/undotbs01.dbf
     
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    18 Full 636.91M DISK 00:01:37 20-NOV-19
    BP Key: 18 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192658
    Piece Name: /rmanbak/full_RMANPRI_20191120_15_1
    List of Datafiles in backup set 18
    File LV Type Ckp SCN Ckp Time Name
    ---- -- ---- ---------- --------- ----
    1 Full 1048766 20-NOV-19 /u01/app/oracle/oradata/rmanstd/system01.dbf
    4 Full 1048766 20-NOV-19 /u01/app/oracle/oradata/rmanstd/users01.dbf
     
    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    19 37.63M DISK 00:00:01 20-NOV-19
    BP Key: 19 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192844
    Piece Name: /rmanbak/arch_RMANPRI_20191120_20_1
     
    List of Archived Logs in backup set 19
    Thrd Seq Low SCN Low Time Next SCN Next Time
    ---- ------- ---------- --------- ---------- ---------
    1 6 980617 19-NOV-19 997893 20-NOV-19
    1 7 997893 20-NOV-19 998101 20-NOV-19
    1 8 998101 20-NOV-19 998911 20-NOV-19
    1 9 998911 20-NOV-19 998981 20-NOV-19
    1 10 998981 20-NOV-19 1010244 20-NOV-19
    1 11 1010244 20-NOV-19 1010463 20-NOV-19
     
    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    20 30.20M DISK 00:00:01 20-NOV-19
    BP Key: 20 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192844
    Piece Name: /rmanbak/arch_RMANPRI_20191120_21_1
     
    List of Archived Logs in backup set 20
    Thrd Seq Low SCN Low Time Next SCN Next Time
    ---- ------- ---------- --------- ---------- ---------
    1 12 1010463 20-NOV-19 1037695 20-NOV-19
    1 13 1037695 20-NOV-19 1043477 20-NOV-19
    1 14 1043477 20-NOV-19 1044219 20-NOV-19
    1 15 1044219 20-NOV-19 1046065 20-NOV-19
    1 16 1046065 20-NOV-19 1047740 20-NOV-19
    1 17 1047740 20-NOV-19 1047788 20-NOV-19
     
    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    21 435.00K DISK 00:00:01 20-NOV-19
    BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192844
    Piece Name: /rmanbak/arch_RMANPRI_20191120_22_1
     
    List of Archived Logs in backup set 21
    Thrd Seq Low SCN Low Time Next SCN Next Time
    ---- ------- ---------- --------- ---------- ---------
    1 18 1047788 20-NOV-19 1048880 20-NOV-19
    1 19 1048880 20-NOV-19 1048889 20-NOV-19
    1 20 1048889 20-NOV-19 1048898 20-NOV-19
    1 21 1048898 20-NOV-19 1048906 20-NOV-19
     
    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    22 83.49M DISK 00:00:03 20-NOV-19
    BP Key: 22 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192844
    Piece Name: /rmanbak/arch_RMANPRI_20191120_19_1
     
    List of Archived Logs in backup set 22
    Thrd Seq Low SCN Low Time Next SCN Next Time
    ---- ------- ---------- --------- ---------- ---------
    1 4 956911 19-NOV-19 966107 19-NOV-19
    1 5 966107 19-NOV-19 980617 19-NOV-19
     
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    23 Full 9.33M DISK 00:00:00 20-NOV-19
    BP Key: 23 Status: AVAILABLE Compressed: NO Tag: TAG20191120T192850
    Piece Name: /rmanbak/ctl_bf
    Standby Control File Included: Ckp SCN: 1048926 Ckp time: 20-NOV-19
     
    检查归档日志备份
    RMAN> list archivelog all;
     
    List of Archived Log Copies for database with db_unique_name RMANSTD
    =====================================================================
     
    Key Thrd Seq S Low Time
    ------- ---- ------- - ---------
    1 1 22 A 20-NOV-19
    Name: /oracle/archive/1_22_1024761634.dbf
     
    十五、使用rman备份集恢复备库
    RMAN> run
    2> {
    3> allocate channel c1 device type disk;
    4> allocate channel c2 device type disk;
    5> allocate channel c3 device type disk;
    6> set newname for datafile 1 to '/u01/app/oracle/oradata/rmanstd/system01.dbf';
    7> set newname for datafile 2 to '/u01/app/oracle/oradata/rmanstd/sysaux01.dbf';
    8> set newname for datafile 3 to '/u01/app/oracle/oradata/rmanstd/undotbs01.dbf';
    9> set newname for datafile 4 to '/u01/app/oracle/oradata/rmanstd/users01.dbf';
    10> restore database;
    11> switch datafile all;
    12> release channel c1;
    13> release channel c2;
    14> release channel c3;
    15> }
     
    released channel: ORA_DISK_1
    allocated channel: c1
    channel c1: SID=27 device type=DISK
     
    allocated channel: c2
    channel c2: SID=30 device type=DISK
     
    allocated channel: c3
    channel c3: SID=31 device type=DISK
     
    executing command: SET NEWNAME
     
    executing command: SET NEWNAME
     
    executing command: SET NEWNAME
     
    executing command: SET NEWNAME
     
    Starting restore at 21-NOV-19
     
    channel c1: starting datafile backup set restore
    channel c1: specifying datafile(s) to restore from backup set
    channel c1: restoring datafile 00002 to /u01/app/oracle/oradata/rmanstd/sysaux01.dbf
    channel c1: restoring datafile 00003 to /u01/app/oracle/oradata/rmanstd/undotbs01.dbf
    channel c1: reading from backup piece /rmanbak/full_RMANPRI_20191120_16_1
    channel c2: starting datafile backup set restore
    channel c2: specifying datafile(s) to restore from backup set
    channel c2: restoring datafile 00001 to /u01/app/oracle/oradata/rmanstd/system01.dbf
    channel c2: restoring datafile 00004 to /u01/app/oracle/oradata/rmanstd/users01.dbf
    channel c2: reading from backup piece /rmanbak/full_RMANPRI_20191120_15_1
    channel c1: piece handle=/rmanbak/full_RMANPRI_20191120_16_1 tag=TAG20191120T192658
    channel c1: restored backup piece 1
    channel c1: restore complete, elapsed time: 00:00:26
    channel c2: piece handle=/rmanbak/full_RMANPRI_20191120_15_1 tag=TAG20191120T192658
    channel c2: restored backup piece 1
    channel c2: restore complete, elapsed time: 00:01:20
    Finished restore at 21-NOV-19
     
    datafile 1 switched to datafile copy
    input datafile copy RECID=2 STAMP=1024943778 file name=/u01/app/oracle/oradata/rmanstd/system01.dbf
    datafile 2 switched to datafile copy
    input datafile copy RECID=3 STAMP=1024943779 file name=/u01/app/oracle/oradata/rmanstd/sysaux01.dbf
    datafile 3 switched to datafile copy
    input datafile copy RECID=4 STAMP=1024943779 file name=/u01/app/oracle/oradata/rmanstd/undotbs01.dbf
    datafile 4 switched to datafile copy
    input datafile copy RECID=5 STAMP=1024943779 file name=/u01/app/oracle/oradata/rmanstd/users01.dbf
     
    released channel: c1
     
    released channel: c2
     
    released channel: c3
     
    十六、恢复数据库
    RMAN> recover database;
     
    Starting recover at 21-NOV-19
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=27 device type=DISK
     
    starting media recovery
     
    archived log for thread 1 with sequence 22 is already on disk as file /oracle/archive/1_22_1024761634.dbf
    channel ORA_DISK_1: starting archived log restore to default destination
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=18
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=19
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=20
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=21
    channel ORA_DISK_1: reading from backup piece /rmanbak/arch_RMANPRI_20191120_22_1
    channel ORA_DISK_1: piece handle=/rmanbak/arch_RMANPRI_20191120_22_1 tag=TAG20191120T192844
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    archived log file name=/oracle/archive/1_18_1024761634.dbf thread=1 sequence=18
    archived log file name=/oracle/archive/1_19_1024761634.dbf thread=1 sequence=19
    archived log file name=/oracle/archive/1_20_1024761634.dbf thread=1 sequence=20
    archived log file name=/oracle/archive/1_21_1024761634.dbf thread=1 sequence=21
    archived log file name=/oracle/archive/1_22_1024761634.dbf thread=1 sequence=22
    unable to find archived log
    archived log thread=1 sequence=23
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 11/21/2019 18:36:48
    RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 23 and starting SCN of 1049910
     
    这是正常的,因为还没有23号归档日志。
     
    十七、启动备库
    RMAN> alter database open;
     
    database opened
     
    十八、主备库创建standby logfile
    主库创建standby logfile
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanpri/stdby01.log' size 50m;
    Database altered.
     
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanpri/stdby02.log' size 50m;
    Database altered.
     
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanpri/stdby03.log' size 50m;
    Database altered.
     
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanpri/stdby04.log' size 50m;
    Database altered.
     
     
    备库创建standby logfile
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanstd/stdby01.log' size 50m;
     
    Database altered.
     
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanstd/stdby02.log' size 50m;
     
    Database altered.
     
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanstd/stdby03.log' size 50m;
     
    Database altered.
     
    SQL> alter database add standby logfile '/u01/app/oracle/oradata/rmanstd/stdby04.log' size 50m;
     
    Database altered.
     
    SQL> alter database recover managed standby database using current logfile disconnect from session;
     
    Database altered.
     
    十八、应用归档
    SQL> alter database recover managed standby database using current logfile disconnect from session;
     
    Database altered.
     
    十九、检查是否搭建成功
    主库:
    SQL> archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination /oracle/archive
    Oldest online log sequence 24
    Next log sequence to archive 26
    Current log sequence 26
     
    备库:
    SQL> archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination /oracle/archive
    Oldest online log sequence 25
    Next log sequence to archive 0
    Current log sequence 26
     
    切换日志测试:
    主库:
    SQL> alter system switch logfile;
     
    System altered.
     
    SQL> archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination /oracle/archive
    Oldest online log sequence 25
    Next log sequence to archive 27
    Current log sequence 27
     
    备库:
    SQL> archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination /oracle/archive
    Oldest online log sequence 25
    Next log sequence to archive 0
    Current log sequence 27
     
    查看备库警告日志:
    Fri Nov 22 03:16:29 2019
    Media Recovery Waiting for thread 1 sequence 27 (in transit)
    Fri Nov 22 03:16:29 2019
    RFS[3]: Selected log 5 for thread 1 sequence 27 dbid -400525088 branch 1024761634
    Recovery of Online Redo Log: Thread 1 Group 5 Seq 27 Reading mem 0
    Mem# 0: /u01/app/oracle/oradata/rmanstd/stdby02.log
    Fri Nov 22 03:16:32 2019
    Archived Log entry 9 added for thread 1 sequence 26 ID 0xe81fefe0 dest 1:
     
     二十、由于备库没有临时表空间,这里可以自己创建临时表空间,并指定为数据库默认临时表空间。

  • 相关阅读:
    做好产品经理,需要具备哪些技能?
    【FastAPI 学习 四】 日志配置
    【FastAPI 学习三】 FastAPI SqlAlchemy MySql表迁移
    【FastAPI 学习 二】SqlAlchemy Model模型类
    【FastAPI 学习一】配置文件
    Python 时间操作 格式化“2020-10-16T17:36:00+08:00“时间
    Python sqlalchemy 原生SQL LIKE 查询
    Git 使用笔记
    数据清洗(一)
    PDF文件转换为TXT文件
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/11909459.html
Copyright © 2020-2023  润新知