Dataguard单机—>单机
本演示案例所用环境:
|
primary |
Standby |
OS Hostname |
CHINA-DB1 |
CHINA-DB2 |
OS Version |
SUSE Linux Enterprise Server 11 SP4 |
SUSE Linux Enterprise Server 11 SP4 |
DB Version |
11.2.0.4 |
11.2.0.4 |
db_name |
hankey |
hankey |
db_unique_name |
hankey |
skydbstd |
service_names |
hankey |
skydbstd |
instance_name |
hankey |
skydbstd |
一、主库配置:
1.1、 主库启用强制归档
sqlplus / as sysdba select force_logging from v$database; alter database force logging;
1.2、配置客户端的网络服务
1.2.1、修改配置文件
cd $ORACLE_HOME/network/admin
vi tnsnames.ora
HANKEY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = )) ) (CONNECT_DATA = (SERVICE_NAME = hankey) ) ) SKYDBSTD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.20)(PORT = )) ) (CONNECT_DATA = (SERVICE_NAME = skydbstd) ) )
1.2.2、验证
tnsping命令解析网络服务名,命令须返回OK.
$ tnsping hankey
1.3、密码文件
若无密码文件,则创建密码文件。格式:orapw<ORACLE_SID>
cd $ORACLE_HOME/dbs
orapwd file=orapwhankey password=oracle ignorecase=y force=y
此处的password=oracle是sys的密码
1.4、修改redo大小
1.4.1、查当前环境的logfile
如果需要更改redo的大小可参考,否则忽略该步骤
set lines 200 pages 300
col member for a60
select a.thread#,a.group#,b.member,b.type,a.status,a.bytes/1024/1024 MB from v$log a,v$logfile b where a.group#=b.group#
union all
select a.thread#,a.group#,b.member,b.type, a.status,a.bytes/1024/1024 MB from v$standby_log a,v$logfile b where a.group#=b.group#;
THREAD# GROUP# MEMBER TYPE STATUS MB
---------- ---------- ------------------------------------------------------------ ------- ---------------- ----------
1 3 /home/oracle/oradata/orcl/redo03.log ONLINE CURRENT 50
1 2 /home/oracle/oradata/orcl/redo02.log ONLINE INACTIVE 50
1 1 /home/oracle/oradata/orcl/redo01.log ONLINE INACTIVE 50 SQL>
1.4.2、添加新的redo
为了避免后期日志切换太频繁,此处增加在线日志文件大小为200M,然后删除之前50M的文件。
alter database add logfile
group 4 '/opt/oradata/hankey/redo04.log' size 200M,
group 5 '/opt/oradata/hankey/redo05.log' size 200M,
group 6 '/opt/oradata/hankey/redo06.log' size 200M;
(只操作状态为inactive的日志组,若一直处于active状态,可重启数据库解决)
若要操作日志组为current时,需先进行日志切换:alter system switch logfile;
alter system switch logfile; set lines 200 pages 300
col member for a60
select a.thread#,a.group#,b.member,b.type,a.status,a.bytes/1024/1024 MB from v$log a,v$logfile b where a.group#=b.group#
union all
select a.thread#,a.group#,b.member,b.type, a.status,a.bytes/1024/1024 MB from v$standby_log a,v$logfile b where a.group#=b.group#;
删掉旧的日志组(1、2、3号redo)
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
1.5、添加备库logfiles
1.5.1、添加备库logfile的要求
l 确保主和备数据库上的日志文件大小是相同的
l 确定备库重做日志文件组的适当数目
Standby logfile数 = (每个线程的logfile数+1)* 线程数
l 检查create database时指定的MAXLOGFILES和MAXLOGMEMBERS参数,可以通过controlfile出来查看
l RAC环境创建standby logfile,指定thread#创建
每个thread的standby logfile数 = 每个thread的logfile数 + 1
1.5.2、添加standby logfile
alter database add standby logfile thread 1
group 7 '/opt/oradata/hankey/std_redo07.log' size 200M,
group 8 '/opt/oradata/hankey/std_redo08.log' size 200M,
group 9 '/opt/oradata/hankey/std_redo09.log' size 200M,
group 10 '/opt/oradata/hankey/std_redo10.log' size 200M;
1.5.3、查询添加后的结果
set lines 200 pages 300
col member for a60
select a.thread#,a.group#,b.member,b.type,a.status,a.bytes/1024/1024 MB from v$log a,v$logfile b where a.group#=b.group#
union all
select a.thread#,a.group#,b.member,b.type, a.status,a.bytes/1024/1024 MB from v$standby_log a,v$logfile b where a.group#=b.group#;
修改主库参数文件
1.6.1备份spfile:
create pfile='/tmp/pfile.bak' from spfile;
1.6.2修改以下参数
其中hankey, skydbstd分别为primary,standby的db_unqiue_name/TNS-Alias,详见参数详解部分:
alter system set log_archive_config='dg_config=(hankey,skydbstd)'; alter system set log_archive_dest_1='location=/home/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=hankey'; alter system set log_archive_dest_2='service=skydbstd lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=skydbstd'; show parameter log_archive_max_processes NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_max_processes integer 4
SQL>
alter system set log_archive_max_processes=10; #根据需求调整个数
确认以下参数默认值,如不为以下参数值,则修改:
show parameter remote_login_passwordfile
alter system set remote_login_passwordfile=exclusive scope=spfile; # remote_login_passwordfile=exclusive/shared alter system set log_archive_dest_state_1=enable;
alter system set log_archive_dest_state_2=enable; log_archive_format参数控制归档文件名称格式,默认值以.dbf结尾,为了与datafile区分,建议修改为.arc结尾:
show parameter log_archive_format NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string %t_%s_%r.dbf alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
当primary切换为standby角色后,需要增加修改以下参数,建议配置:
alter system set fal_server=skydbstd;
alter system set standby_file_management=auto;
# primary和standby的datafile和logfile存储路径不一样时,设定以下参数:
可下通过sql查询datafile路径:
set lines 300 pages 300
col name for a60
col member for a60
select file#,name from v$datafile
union all
select file#,name from v$tempfile;
设置db_file参数如下:
alter system set db_file_name_convert='/opt/oradata/skydbstd','/opt/oradata/hankey', '/opt/oradata/skydbstd','/home/oracle/oradata' scope=spfile;
可下通过sql查询logfile路径:
select MEMBER from v$logfile;
select MEMBER from v$logfile;
设置log_file参数如下
alter system set log_file_name_convert='/opt/oradata/skydbstd','/opt/oradata/hankey' scope=spfile;
注:以上参数,指定spfile修改的,在实例重启后生效。
shutdown immediate
startup
1.7、打开归档模式
首先确认当前数据库是否是归档模式,如果不是,则打开归档模式。
archive log list;
shutdown immediate;
startup mount;
alter database archivelog;
archive log list;
alter database open;
1.8、备份主库
rman target / <<EOF
run{allocate channel c1 type disk;
allocate channel c2 type disk;
backup full database format '/opt/oradata/backup/full_%U.bak' plus archivelog;
sql 'alter system switch logfile';
backup current controlfile for standby format '/opt/oradata/backup/c_%U.bak';
release channel c1;
release channel c2;
}
EOF
1.9、传送备份文件到备库
scp -r /opt/oradata/backup/ 10.10.10.20:/opt/oradata/backup/
二、备库配置
2.1、配置环境变量(可参考主库)
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product//dbhome_1
export ORACLE_SID=skydbstd
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_GRID/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:$LD_LIBRARY_PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
2.2、配置客户端的网络服务
(1) listener.ora
配置静态监听:
cd $ORACLE_HOME/network/admin vi listener.ora LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.20)(PORT=1521))
) SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=skydbstd)
(SID_NAME=skydbstd)
(ORACLE_HOME=/u01/app/oracle/product/11204/dbhome_1)
)
)
启用监听并查看监听状态:
lsnrctl start lsnrctl status
(2) tnsnames.ora
vi tnsnames.ora HANKEY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = hankey)
)
) SKYDBSTD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.20)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = skydbstd)
)
)
(3) tnsping命令解析网络服务名,命令须返回OK.
此时,standby端未配置监听,无法解析,可以standby配置后再测试。
tnsping skydbstd
(4) 密码文件
使用主库的密码文件:
scp 10.10.10.10:/u01/app/oracle/product/11gr2/dbhome_1/dbs/orapwhankey $ORACLE_HOME/dbs/orapwskydbstd
3.创建相关目录
mkdir -p $ORACLE_BASE/admin/skydbstd/{adump,dpdump,pfile}
mkdir -p /home/oracle/arch
mkdir -p /opt/oradata/skydbstd
2.4、参数文件
用primary的pfile加以修改,以保证某些参数与primary保持一致,注意主备库内存的大小适当的调整内存相关参数。
scp 10.10.10.10:/tmp/pfile.bak $ORACLE_HOME/dbs/initskydbstd.ora 修改pfile为需要的standby pfile,并创建spfile.特别注意以下事例的参数设定:
vi $ORACLE_HOME/dbs/initskydbstd.ora
*.audit_file_dest='/u01/app/oracle/admin/skydbstd/adump'
*.audit_trail='db'
*.control_files='/opt/oradata/skydbstd/control01.ctl','/opt/oradata/skydbstd/control02.ctl','/opt/oradata/skydbstd/control03.ctl'
*.db_name='skydbstd'
*.db_unique_name='skydbstd'
*.instance_name='skydbstd'
*.service_names='skydbstd'
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_config='dg_config=(skydbstd,hankey)'
*.log_archive_dest_1='location=/home/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=skydbstd'
*.log_archive_dest_2='service=hankey lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=hankey'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_1='enable'
*.log_archive_max_processes=30 #根据需求调整个数
*.fal_server='hankey'
*.standby_file_management=auto
*.remote_login_passwordfile='EXCLUSIVE'
#主、备库日志文件和数据文件存放路径不一致,设定以下参数:
#下面这两个参数和数库路径位置正好相反
*.db_file_name_convert='/opt/oradata/hankey','/opt/oradata/skydbstd','/home/oracle/oradata','/opt/oradata/skydbstd'
*. log_file_name_convert='/opt/oradata/hankey','/opt/oradata/skydbstd'
本次实际修改后的pfile如下
skydbstd.__db_cache_size=276824064
skydbstd.__java_pool_size=4194304
skydbstd.__large_pool_size=12582912
skydbstd.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
skydbstd.__pga_aggregate_target=306184192
skydbstd.__sga_target=478150656
skydbstd.__shared_io_pool_size=0
skydbstd.__shared_pool_size=163577856
skydbstd.__streams_pool_size=8388608
*.audit_file_dest='/u01/app/oracle/admin/skydbstd/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/opt/oradata/skydbstd/control01.ctl','/opt/oradata/skydbstd/control02.ctl','/opt/oradata/skydbstd/control03.ctl'
*.db_block_size=8192
*.db_domain=''
# db_name长度不要超过8个字符,同主库
*.db_name= hankey
*.diagnostic_dest='/u01/app/oracle'
*.memory_target=781189120
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
#主、备库日志文件和数据文件存放路径不一致,设定以下参数:
#下面这两个参数和数库路径位置正好相反
*.db_file_name_convert='/opt/oradata/hankey','/opt/oradata/skydbstd','/home/oracle/oradata','/opt/oradata/skydbstd'
*.log_file_name_convert='/opt/oradata/hankey','/opt/oradata/skydbstd'
*.db_unique_name='skydbstd'
*.instance_name='skydbstd'
*.service_names='skydbstd'
*.log_archive_config='dg_config=(skydbstd,hankey)'
*.log_archive_dest_1='location=/home/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=skydbstd'
*.log_archive_dest_2='service=hankey lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=hankey'
*.log_archive_dest_state_1='enable'
#按需调整
*.log_archive_max_processes=30*.fal_server='hankey'
*.standby_file_management=auto
*.remote_login_passwordfile='EXCLUSIVE' #主、备库日志文件和数据文件存放路径不一致,设定以下参数:
#下面这两个参数和数库路径位置正好相反
*.db_file_name_convert='/opt/oradata/hankey','/opt/oradata/skydbstd','/home/oracle/oradata','/opt/oradata/skydbstd'
*.log_file_name_convert='/opt/oradata/hankey','/opt/oradata/skydbstd'
创建spfile:
sqlplus / as sysdba
create spfile from pfile;
2.5、恢复standby controlfile
startup nomount; rman target /
restore standby controlfile from '/home/oracle/backup/c_08rlrfc2_1_1.bak';
2.6、恢复数据文件
启动数据库到mount阶段,恢复数据文件。
(1)standby 与primary数据文件存放路径一致:
RMAN> sql 'alter database mount standby database'; run
{allocate channel c1 type disk;
allocate channel c2 type disk;
restore database;
recover database;
release channel c1;
release channel c2;
}
执行之后,要查看打印出来的目录在备库是否都存在,不存在的话,创建对应目录。
(2) standby 与primary数据文件存放路径不一致:
查询主库的数据文件信息:
set lines 300 pages 300
col name for a60
col member for a60
select file#,name from v$datafile
union all
select file#,name from v$tempfile;
路径根据备库参数db_file_name_convert处理,
*.db_file_name_convert='+DG_ORA/ora11g/datafile','/opt/oradata/webcc','+DG_ORA/ora11g','/opt/oradata/webcc','+DG_INDEX','/opt/oradata/webcc/datafile','+DG_DATA/ora11g','/opt/oradata/webcc'
例如将+DG_ORA/ora11g/datafile换为 /opt/oradata/webcc
注意datafile和tempfile
run
{
set newname for datafile 1 to '/opt/oradata/skydbstd/system01.dbf';
set newname for datafile 2 to '/opt/oradata/skydbstd/sysaux01.dbf';
set newname for datafile 3 to '/opt/oradata/skydbstd/undotbs01.dbf';
set newname for datafile 4 to '/opt/oradata/skydbstd/users01.dbf';
set newname for datafile 5 to '/opt/oradata/skydbstd/tbs_njdf_dat01.dbf';
set newname for datafile 6 to '/opt/oradata/skydbstd/tbs_njdf_idx01.dbf';
set newname for datafile 7 to '/opt/oradata/skydbstd/ctxsys01.dbf';
set newname for datafile 8 to '/opt/oradata/skydbstd/tbs_uccbiz_dat01.dbf';
set newname for datafile 9 to '/opt/oradata/skydbstd/tbs_ucchis_dat01.dbf';
set newname for datafile 10 to '/opt/oradata/skydbstd/tbs_uccdata_dat01.dbf';
set newname for datafile 11 to '/opt/oradata/skydbstd/tbs_ucc_idx01.dbf';
set newname for datafile 12 to '/opt/oradata/skydbstd/tbs_ucc_part_dat01.dbf';
set newname for datafile 13 to '/opt/oradata/skydbstd/tbs_ucc_part_idx01.dbf';
set newname for tempfile 1 to '/opt/oradata/skydbstd/temp01.dbf';
set newname for tempfile 2 to '/opt/oradata/skydbstd/tbs_njdf_temp01.dbf';
restore database;
switch datafile all;
switch tempfile all;
recover database;
}
Starting recover at 19-SEP-18
using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 31 is already on disk as file /home/oracle/arch/1_31_928863514.dbf
archived log for thread 1 with sequence 32 is already on disk as file /home/oracle/arch/1_32_928863514.dbf
archived log for thread 1 with sequence 33 is already on disk as file /home/oracle/arch/1_33_928863514.dbf
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=29
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11gr2/dbhome_1/dbs/07rlrfc1_1_1
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/product/11gr2/dbhome_1/dbs/07rlrfc1_1_1
ORA-19505: failed to identify file "/u01/app/oracle/product/11gr2/dbhome_1/dbs/07rlrfc1_1_1"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3 failover to previous backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/19/2018 17:14:26
RMAN-20506: no backup of archived log found
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 29 and starting SCN of 303581 found to restore RMAN>
上述错误不用管,属于正常现象
查看备库 log file:
set lines 200 pages 300
col member for a60
select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB
from v$log a,v$logfile b where a.group#=b.group#
union all
select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB
from v$standby_log a,v$logfile b where a.group#=b.group#;
2.7、应用日志
应用archive log:
sqlplus / as sysdba
recover managed standby database disconnect;
select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
ARCH CLOSING
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
MRP0 WAIT_FOR_LOG
RFS IDLE
RFS IDLE 37 rows selected.
查看在备库查看接收到的被应用的redo
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#; SEQUENCE# APPLIED
---------- ---------
29 YES
30 YES
31 YES
32 YES
33 YES
查看主备归档:
archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch
Oldest online log sequence 32
Next log sequence to archive 34
Current log sequence 34
SQL>
2.8、取消应用日志:
recover managed standby database cancel;
2.9、应用redo logfile:
recover managed standby database using current logfile disconnect;
ORA-01153: an incompatible media recovery is active
ORA-16136: Managed Standby Recovery not active
如果报这个错,就是因为数据库在恢复阶段,没有执行这一步的取消应用日志命令导致
--主库端查询v$archived_log视图,确认日志是否被应用:
set lines 300 pages 300
col name for a20
select name,dest_id,thread#,sequence#,standby_dest,applied,registrar,completion_time from v$archived_log
where standby_dest='YES'
order by thread#,sequence#;
NAME DEST_ID THREAD# SEQUENCE# STA APPLIED REGISTR COMPLETIO
-------------------- ---------- ---------- ---------- --- --------- ------- ---------
orclstd 2 1 35 YES YES ARCH 04-APR-19
orclstd 2 1 36 YES YES ARCH 04-APR-19
orclstd 2 1 36 YES YES ARCH 04-APR-19
orclstd 2 1 36 YES YES ARCH 04-APR-19
orclstd 2 1 37 YES YES ARCH 04-APR-19
orclstd 2 1 37 YES YES ARCH 04-APR-19
orclstd 2 1 38 YES YES ARCH 04-APR-19
orclstd 2 1 39 YES YES LGWR 04-APR-19
2.10、取消应用日志:
recover managed standby database cancel;
2.11、打开数据库至read only模式并开始实时复制:
alter database open read only;
recover managed standby database using current logfile disconnect;
11g Physical standby database可打开至read only模式,也就是常说的Active Dataguard.可迁移查询的业务至Active DG上,减小primary DB的压力。
2.12、观察日志传输
跟踪primary,standby database的alert log,观察是否有错误发生,也可以看到应用日志的相关信息。
确认standby是否应用日志:
--primary端多切几次日志,观察alert log信息。
alter system switch logfile;
alter system switch logfile;
--观察主备库日志序列号
archive log list;
2.13、在primary端查询v$archived_log视图,确认日志是否被应用:
set lines 300 pages 300
col name for a20
select name,dest_id,thread#,sequence#,standby_dest,applied,registrar,completion_time from v$archived_log
where standby_dest='YES'
order by thread#,sequence#;
NAME DEST_ID THREAD# SEQUENCE# STA APPLIED REGISTR COMPLETIO
-------------------- ---------- ---------- ---------- --- --------- ------- ---------
orclstd 2 1 35 YES YES ARCH 04-APR-19
orclstd 2 1 36 YES YES ARCH 04-APR-19
orclstd 2 1 36 YES YES ARCH 04-APR-19
orclstd 2 1 36 YES YES ARCH 04-APR-19
orclstd 2 1 37 YES YES ARCH 04-APR-19
orclstd 2 1 37 YES YES ARCH 04-APR-19
orclstd 2 1 38 YES YES ARCH 04-APR-19
orclstd 2 1 39 YES YES LGWR 04-APR-19
orclstd 2 1 40 YES YES LGWR 04-APR-19
orclstd 2 1 41 YES NO ARCH 04-APR-19
10 rows selected.
2.14、在主库查询primary,standby的最大日志序列号是否一致:
select 'Primary :' "DB Role",thread#,max(sequence#)
from v$archived_log
where standby_dest='NO'
group by thread#
union
select 'Standby :' "DB Role",thread#,max(sequence#)
from v$archived_log
where standby_dest='YES' and applied='YES'
group by thread#
order by thread#;
DB Role THREAD# MAX(SEQUENCE#)
--------- ---------- --------------
Primary : 1 41
Standby : 1 40
2.15、在备库查看接收到的被应用的redo
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# APPLIED
---------- ---------
34 YES
35 YES
36 YES
37 YES
38 YES
39 YES
40 YES
41 IN-MEMORY
8 rows selected.
2.16、验证
在主库建测试表
SQL> create table t2019 as select * from dba_users;
然后在备库查看
SQL> select count(*) from t2019; COUNT(*)
----------
35 SQL>
至此,dataguard搭建完成。
三、如果需要清理备库环境重新配置,请参考以下步骤:
3.1、停库:
3.2、删除归档:
3.3、删除数据文件、在线日志文件
3.4、删除控制文件
3.5、删除adump dpdump pfile里面的文件
3.6、在dbs目录下只保留initstandby.ora orapwstandby
-----------------------
Dataguard单机—>单机的更多相关文章
- 大道浮屠诀---NBU7.7.3_oracle11G单机-单机(异机恢复WINDOWS2008平台)
现有环境说明: 一台WINDOWS2008R2:安装有NBU7.7.3,作为服务端 一台WINDOWS2008R2:安装有oracle11.2.0.3,作为数据库服务器 现假设数据库意外崩溃,需要进行 ...
- ORACLE11G 将dataguard的rman备份恢复到測试环境的单机oracle中的具体过程
. 也就是说此时数据库仅仅能进行不全然恢复了,在打开数据库时得使用resetlogs打开. recover database until scn 11412370952; RMAN> recov ...
- 基于 Eclipse 的 MapReduce 开发环境搭建
文 / vincentzh 原文连接:http://www.cnblogs.com/vincentzh/p/6055850.html 上周末本来要写这篇的,结果没想到上周末自己环境都没有搭起来,运行起 ...
- GOLDENGATE 配置文档,各类参数--转发
1 GoldenGate简要说明 GoldenGate现在是业内成熟的数据容灾与复制产品,经过多年的发展与完善,现在已经成为业内事实上的标准之一. GoldenGate软件是一种基于日志的 ...
- 浅析CQRS的应用部署
CQRS,中文翻译命令和查询职责分离,它是一种架构,不仅可以从数据库层面实现读写分离,在代码层面上也是推荐读写分离的.在接口上可以更为简单 命令端定义 ICommandResult Execute(I ...
- OpenVPN server端配置文件详细说明(转)
本文将介绍如何配置OpenVPN服务器端的配置文件.在Windows系统中,该配置文件一般叫做server.ovpn:在Linux/BSD系统中,该配置文件一般叫做server.conf.虽然配置文件 ...
- 【DG】利用闪回数据库(flashback)修复Failover后的DG环境
利用闪回数据库(flashback)修复Failover后的DG环境 1.1 BLOG文档结构图 1.2 前言部分 1.2.1 导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能, ...
- Java项目中使用Redis缓存案例
缓存的目的是为了提高系统的性能,缓存中的数据主要有两种: 1.热点数据.我们将经常访问到的数据放在缓存中,降低数据库I/O,同时因为缓存的数据的高速查询,加快整个系统的响应速度,也在一定程度上提高并发 ...
- openvpn的搭建
openvpn搭建 原创不易,转载请注明 openvpn简介 1.1 openvpn原理 OpenVpn的技术核心是虚拟网卡,其次是SSL协议实现 虚拟网卡是使用网络底层编程技术实现的一个驱动软件,安 ...
随机推荐
- Codeforces Round #601 (Div. 2) D Feeding Chicken
//为了连贯,采取一条路形式,从第一行开始 也就是s型 #include <bits/stdc++.h> using namespace std; ; char str[MAXN][MAX ...
- numpy基础知识练习
# 1.导入numpy模块 # 2.创建一个大小为10的空向量 # 3.创建一个大小为10的空向量,但是第五个值为1 # 4.创建一个10-49的ndarray数组 # 5.创建一个3x3的矩阵,其值 ...
- 《深入理解Java虚拟机》读书笔记十
第十一章 晚期(运行期)优化 1.HotSpot虚拟机内的即时编译 解释器与编译器: 许多Java虚拟机的执行引擎在执行Java代码的时候都有解释执行(通过解释器执行)和编译执行(通过即时编译器产生 ...
- EF简单的CodeFirst示例(自己创建数据库,不使用数据迁移)
1.新建一个控制台应用程序 2.右键引用--管理NuGet程序包,安装如下几项 3.打开App.config文件,加入如下代码: <connectionStrings> <ad ...
- Echarts--来自官网
引入 ECharts ECharts 3 开始不再强制使用 AMD 的方式按需引入,代码里也不再内置 AMD 加载器.因此引入方式简单了很多,只需要像普通的 JavaScript 库一样用 scrip ...
- codeforces 1285E. Delete a Segment
链接:https://codeforces.com/problemset/problem/1285/E 题意:给一个数轴上有n个线段集,线段集若有相交,则合并为一个新的合并线段集,比如[1,6]和[2 ...
- 神舟战神笔记本使用U盘重装系统
今天我的神舟战神笔记本电脑系统故障了,在这里记录一下使用U盘重装系统的方法: 1.插入装机U盘. 2.按开机键,然后马上按Esc键. 3.选择Boot Manager进入. 4.选择EFI USB D ...
- JavaScript对象之get/set方法
我们可以重写js对象属性的get和set方法. 从上图我们可以看出set和get的语法. 上图则是使用set和get方法对对象的属性进行了输入校验. 从上图可得若对象的原型链上具有不可配置的同名属性( ...
- HTML连载61-焦点图、固定定位
一.焦点图 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- mysql中间件proxysql实现mysql读写分离
目录 1. mysql实现读写分离的方式 2. ProxySQL简介 3. ProxySQL安装 4. ProxySQL的Admin管理接口 5. 和admin管理接口相关的变量 5.1 admin- ...