一:实验环境介绍
PC机系统: CentOS 6.5(64位)
数据库版本: Oracle 11gR2 11.2.0.4 (64位)
IP地址规划:
主数据库
10.110.9.41
SID:orapri
db_name:orapri
db_unique_name:orapri
备份数据库
10.110.9.40
SID:orastd
db_name:orapri
db_unique_name:orastd
二:安装数据库软件前的系统配置 (主库和备库端都要做下列操作),如果是PDT系统安装数据库可以省略此步
1.装包
binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh numactl-devel glibc-headers
现在是通过yum方式进行安装的。
2.创建相关的组与用户:
groupadd dba
groupadd oinstall
groupadd oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
3.创建所需的目录并赋予特定的属主和属组
mkdir -p /opt/local/oracle/app/product/11.2.0/db_1
chown -R oracle:oinstall/opt/local/oracle
chmod -R755/opt/local/oracle
4.修改/etc/sysctl.conf文件,在最下新增
#setting oracle
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range=3276861000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

--以前系统已经配置参数
kernel.shmall = 4294967296 oracle官网推荐值2097152,系统现有的值4294967296需修改,推荐值(内存大小KB/4KB)
kernel.shmmax = 68719476736Minimum: 536870912Maximum: 比物理内存小1个字节的值 建议:超过物理内存的80%

后需执行sysctl -p命令使其生效.
5.修改vi /etc/pam.d/login文件,在最下新增(使/etc/security/limits.conf 文件配置生效)
#setting oracle
session required pam_limits.so
6.修改/etc/security/limits.conf文件,在最下新增
#setting oracle
oracle soft nproc 65535
oracle hard nproc 65535
oracle soft nofile 65535
oracle hard nofile 65536
oracle soft stack 10240
7.修改参数配置文件/etc/profile,新增
#setting oracle
export ORACLE_BASE=/opt/local/oracle/app
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_PID=oradb
export ORACLE_SID=oradb
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export ORACLE_HOME_LISTNER=$ORACLE_HOME
8.在root用户下执行以下命令
usermod -G oinstall root
9.使用oracle用户登录服务器,修改~/.bash_profile文件,新增
#setting oracle
export ORACLE_BASE=/opt/local/oracle/app
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_PID=oradb
export ORACLE_SID=oradb
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export ORACLE_HOME_LISTNER=$ORACLE_HOME
10.修改主备机名编辑主备机/etc/hosts文件
主:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.110.9.41 primary

备:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.110.9.40 standy

三:开始安装oracle11g数据库软件 (主库和备库端都要做下列操作)
安装过程:详见《VOS系统oracle数据库安装配置使用说明书》
注意:主库在安装完软件后需要进行DBCA建库操作,推荐不要启用归档模式,会节省时间,备库端不要建库!可以开启监听程序
四:开始搭建Dataguard
1:将数据库改为强制日志模式 (此步骤只在主库上做)
[oracle@primary ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 31 21:35:05 2018

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name,log_mode,force_logging from v$database;

NAME LOG_MODE FORCE_LOG
--------------------------- ------------------------------------ ---------
ORAPRI ARCHIVELOG NO

SQL>
SQL> alter database force logging;

Database altered.

SQL> select name,log_mode,force_logging from v$database;

NAME LOG_MODE FORCE_LOG
--------------------------- ------------------------------------ ---------
ORAPRI ARCHIVELOG YES
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@primary ~]$
2:创建密码文件 (此步骤只在主库上做)
注意:两端分别创建自己的密码文件好像有问题,备库的密码文件需要跟主库一致,否则导致日志传输不到备库,有待验证。我最后是将主库的密码文件直接copy到备库,重命名后使用。
[oracle@primary ~]$ cd $ORACLE_HOME/dbs
[oracle@primary dbs]$ ls
hc_orapri.dat initorapri.ora lkORAPRI orapwpri spfileorapri.ora
init.ora lkORADB orapworapri snapcf_orapri.f spfileorapri.ora_bak
[oracle@primary dbs]$
已经有一个密码文件了
[oracle@primary dbs]$ orapwd file=orapwpri password=sysdba force=y
这条命令可以手动生成密码文件,force=y的意思是强制覆盖当前已有的密码文件(如果有可以不建立)

将主库的密码文件copy给备库,并重命名
[oracle@primary dbs]$ scp orapwpri 10.110.9.40:$ORACLE_HOME/dbs/orapwstd
3:创建standby redolog日志组 (此步骤只在主库上做)
原则:
1:standby redo log的文件大小与primary 数据库online redo log 文件大小相同
2:standby redo log日志文件组的个数依照下面的原则进行计算:
Standby redo log组数公式>=(每个instance日志组个数+1)*instance个数
假如只有一个节点,这个节点有三组redolog,
所以Standby redo log组数>=(3+1)*1 == 4
所以至少需要创建4组Standby redo log
查看当前线程与日志组的对应关系及日志组的大小:
SQL> select thread#,group#,bytes/1024/1024 from v$log;

THREAD# GROUP# BYTES/1024/1024
---------- ---------- ---------------
1 1 50
1 2 50
1 3 50

SQL>
如上,我现在的环境有三组redolog,每个日志组的大小都是50M,
所以Standby redo log组数>=(3+1)*1== 4
所以至少需要创建4组Standby redo log,大小均为50M
SQL> col member for a50
SQL> select group#,member from v$logfile;

GROUP# MEMBER
---------- --------------------------------------------------
3 /opt/local/oracle/app/oradata/orapri/redo03.log
2 /opt/local/oracle/app/oradata/orapri/redo02.log
1 /opt/local/oracle/app/oradata/orapri/redo01.log

3 rows selected.

SQL>
先手动创建standby log日志组所需的目录:(创建新目录只是为了便于区分,并非必须)
[oracle@primary dbs]$ cd /opt/local/oracle/app/oradata/
[oracle@primary oradata]$ mkdir standbylog
新建4个日志组作为standby redolog日志组,大小与原来的日志组一致:
由于已经存在group1-3,,所以group号只能从4开始
SQL>
alter database add standby logfile group 4 '/opt/local/oracle/app/oradata/standbylog/std_redo04.log' size 50m;
alter database add standby logfile group 5 '/opt/local/oracle/app/oradata/standbylog/std_redo05.log' size 50m;
alter database add standby logfile group 6 '/opt/local/oracle/app/oradata/standbylog/std_redo06.log' size 50m;
alter database add standby logfile group 7 '/opt/local/oracle/app/oradata/standbylog/std_redo07.log' size 50m;
SQL>
查看standby 日志组的信息:
SQL> set linesize 1000
SQL> select group#,sequence#,status, bytes/1024/1024 from v$standby_log;

GROUP# SEQUENCE# STATUS BYTES/1024/1024
---------- ---------- ------------------------------ ---------------
4 0 UNASSIGNED 50
5 0 UNASSIGNED 50
6 0 UNASSIGNED 50
7 0 UNASSIGNED 50

SQL>
查看当前有哪些日志组及其成员:
SQL> set pagesize 100
SQL> col member for a60
SQL> select group#,member from v$logfile order by group#;

GROUP# MEMBER
---------- ------------------------------------------------------------
1 /opt/local/oracle/app/oradata/orapri/redo01.log
2 /opt/local/oracle/app/oradata/orapri/redo02.log
3 /opt/local/oracle/app/oradata/orapri/redo03.log
4 /opt/local/oracle/app/oradata/standbylog/std_redo04.log
5 /opt/local/oracle/app/oradata/standbylog/std_redo05.log
6 /opt/local/oracle/app/oradata/standbylog/std_redo06.log
7 /opt/local/oracle/app/oradata/standbylog/std_redo07.log
4:修改主库的pfile参数文件 (此步骤只在主库上做)
创建pfile文件
SQL> create pfile from spfile;

File created.

SQL>
修改pfile文件
orapri.__db_cache_size=1040187392
orapri.__java_pool_size=16777216
orapri.__large_pool_size=33554432
orapri.__oracle_base='/opt/local/oracle/app'#ORACLE_BASE set from environment
orapri.__pga_aggregate_target=838860800
orapri.__sga_target=1442840576
orapri.__shared_io_pool_size=0
orapri.__shared_pool_size=335544320
orapri.__streams_pool_size=0
*.audit_file_dest='/opt/local/oracle/app/admin/orapri/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/opt/local/oracle/app/oradata/orapri/control01.ctl','/opt/local/oracle/app/flash_recovery_area/orapri/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orapri'
*.db_recovery_file_dest='/opt/local/oracle/app/flash_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/opt/local/oracle/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orapriXDB)'
*.open_cursors=300
*.pga_aggregate_target=825229312
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1428160512
*.undo_tablespace='UNDOTBS1'
#新增部分
*.db_unique_name='orapri'
*.log_archive_config='dg_config=(orapri,orastd)'
*.log_archive_dest_1='location=/opt/local/oracle/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=orapri'
*.log_archive_dest_2='service=orastd valid_for=(online_logfiles,primary_role) db_unique_name=orastd'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_archive_max_processes=4
*.fal_server='orastd'
*.fal_client='orapri'
*.db_file_name_convert='/opt/local/oracle/app/oradata/orastd','/opt/local/oracle/app/oradata/orapri'
*.log_file_name_convert='/opt/local/oracle/app/oradata/orastd','/opt/local/oracle/app/oradata/orapri'
*.standby_file_management='auto'

手动创建归档日志路径
手工创建/u01/app/oracle/arch:
[oracle@primary ~]$ mkdir –p /opt/local/oracle/app/oracle/arch/
5:用修改过的pfile重新创建一个spfile,用于重启数据库 (此步骤只在主库上做)
关闭数据库:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

用修改过的pfile重新创建一个spfile:
SQL> create spfile from pfile;
此时把数据库改为归档模式: (如果当初建库时选择了启用归档,则此步骤忽略)
由于当前数据库已关闭,首先需要把数据库启动到mount状态
SQL> startup mount;
ORACLE instance started.
Database mounted.
SQL> alter database archivelog; 启用归档模式
Database altered.

SQL> alter database open; OPEN数据库
Database altered.

SQL> archive log list; 查看是否启用归档模式
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination/opt/local/oracle/app/oracle/arch
Oldest online log sequence 22
Next log sequence to archive 24
Current log sequence 24
如上,归档路径已经改为/opt/local/oracle/app/oracle/arch,证明对pfile的修改已生效
6:修改监听文件,添加静态监听 (主库、备库都要做)
主库:
[oracle@primary ~]$ cd $ORACLE_HOME/network/admin
[oracle@primary admin]$ vim listener.ora
# listener.ora Network Configuration File: /opt/local/oracle/app/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = primary))
(ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = /opt/local/oracle/app

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orapri)
(ORACLE_HOME = /opt/local/oracle/app/product/11.2.0/db_1)
(SID_NAME = orapri)
)
)

[oracle@primary admin]$ vim tnsnames.ora

# tnsnames.ora Network Configuration File: /opt/local/oracle/app/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORAPRI =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orapri)
)
)

pri =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.9.41)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orapri)
)
)

std =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.9.40)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orastd)
)
)

orastd =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.9.40)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orastd)
)
)

备库:
[oracle@standy ~]$ cd $ORACLE_HOME/network/admin
[oracle@standy admin]$ vim listener.ora

# listener.ora Network Configuration File: /opt/local/oracle/app/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = standy))
(ADDRESS = (PROTOCOL = TCP)(HOST = standy)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = /opt/local/oracle/app

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orastd)
(ORACLE_HOME = /opt/local/oracle/app/product/11.2.0/db_1)
(SID_NAME = orastd)
)
)

[oracle@standy admin]$ vim tnsnames.ora

# tnsnames.ora Network Configuration File: /opt/local/oracle/app/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORAPRI =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orapri)
)
)

pri =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.9.41)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orapri)
)
)

std =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.9.40)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orastd)
)
)

orastd =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.9.40)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orastd)
)
)
使新增加的监听生效: (主库和备库端都要做)
[oracle@standy admin]$ lsnrctl stop
[oracle@standy admin]$ lsnrctl start

确认新增加的静态监听有效:
主库:
[oracle@standy admin]$ lsnrctl status

备库:
[oracle@standy admin]$ lsnrctl status

7:在备库端,修改pfile参数文件 (只在备库端做)
orapri.__db_cache_size=1040187392
orapri.__java_pool_size=16777216
orapri.__large_pool_size=33554432
orapri.__oracle_base='/opt/local/oracle/app'#ORACLE_BASE set from environment
orapri.__pga_aggregate_target=838860800
orapri.__sga_target=1442840576
orapri.__shared_io_pool_size=0
orapri.__shared_pool_size=335544320
orapri.__streams_pool_size=0
*.audit_file_dest='/opt/local/oracle/app/admin/orastd/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/opt/local/oracle/app/oradata/orastd/control01.ctl','/opt/local/oracle/app/flash_recovery_area/orastd/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orapri'
*.db_recovery_file_dest='/opt/local/oracle/app/flash_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/opt/local/oracle/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orapriXDB)'
*.open_cursors=300
*.pga_aggregate_target=825229312
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1428160512
*.undo_tablespace='UNDOTBS1'

#新增内容
*.db_unique_name='orastd'
*.log_archive_config='dg_config=(orapri,orastd)'
*.log_archive_dest_1='location=/opt/local/oracle/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=orastd'
*.log_archive_dest_2='service=orapri valid_for=(online_logfiles,primary_role) db_unique_name=orapri'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_archive_max_processes=4
*.fal_server='orastd'
*.fal_client='orapri'
*.db_file_name_convert='/opt/local/oracle/app/oradata/orapri','/opt/local/oracle/app/oradata/orastd'
*.log_file_name_convert='/opt/local/oracle/app/oradata/orapri','/opt/local/oracle/app/oradata/orastd'
*.standby_file_management='auto'

8:在备库端手工创建所需的目录 (备库端做,不提前创建的话恢复时会报错!)
mkdir -pv /opt/local/oracle/app/admin/orastd/adump
mkdir -pv /opt/local/oracle/app/diag/rdbms/orastd/orastd/trace
mkdir -pv /opt/local/oracle/app/oracle/arch
mkdir -pv /opt/local/oracle/app/oradata/orastd
mkdir -pv /opt/local/oracle/app/oradata/standbylog
mkdir -pv /opt/local/oracle/app/flash_recovery_area

9:用修改后的pfile创建一个spfile,用于启动数据库 (备库端做)
[oracle@standy ~]$ sqlplus / as sysdba
Connected to an idle instance.

SQL> create spfile from pfile;
File created.

将数据库启动到nomount状态:
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 839282688 bytes
Fixed Size 2233000 bytes
Variable Size 482348376 bytes
Database Buffers 352321536 bytes
Redo Buffers 2379776 bytes
SQL>
10:利用RMAN在备库上恢复主库 (备库端做)
[oracle@standy ~]$ rman target sys/sysdba@pri auxiliary sys/sysdba@std nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Dec 31 22:00:57 2018

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

connected to target database: ORAPRI (DBID=2916030696)
using target database control file instead of recovery catalog
connected to auxiliary database: ORAPRI (DBID=2916030696)

RMAN> duplicate target database for standby from active database nofilenamecheck; --备机同步主机数据
...
Finished Duplicate Db at 16-MAR-16

RMAN>
恢复数据库结束

12:分别查看主库和备库的归档序列号是否一致:
主机:
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/local/oracle/app/oracle/arch
Oldest online log sequence 26
Next log sequence to archive 28
Current log sequence 28
SQL>
备机:
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/local/oracle/app/oracle/arch
Oldest online log sequence 26
Next log sequence to archive 0
Current log sequence 28
SQL>

13 : 启动备机为只读模式
启用备机实时查询
SQL> startup mount
SQL>alter database recover managed standby database using current logfile disconnect;
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
SQL> alter database recover managed standby database using current logfile disconnect;

14 : 修改数据库保护模式
adg的数据传输应用三大模式转换
1.最大可用性模式(Maximum Availability)
1)该模式提供了仅次于“最大保护模式”的数据保护能力;
2)要求至少一个物理备库收到重做日志后,主库的事务才能够提交;
3)主库找不到合适的备库写入时,主库不会关闭,而是临时降低到“最大性能模式”模式,直到问题得到处理;
4)优点:该模式可以在没有问题出现的情况下,保证备库没有数据丢失,是一种折中的方法;
5)缺点:在正常运行的过程中缺点是主库的性能受到诸多因素的影响。
2.最大性能模式(Maximum Performance)
1)该模式是默认模式,可以保证主数据库的最高可用性;
2)保证主库运行过程中不受备库的影响,主库事务正常提交,不因备库的任何问题影响到主库的运行;
4)优点:避免了备库对主数据库的性能和可用性影响;
5)缺点:如果与主库提交的事务相关的恢复数据没有发送到备库,这些事务数据将被丢失,不能保证数据无损失。
3.最大保护模式(Maximum Protection)
1)这种模式提供了最高级别的数据保护能力;
2)要求至少一个物理备库收到重做日志后,主库的事务才能够提交;
3)主库找不到合适的备库写入时,主库会自动关闭,防止未受保护的数据出现;
4)优点:该模式可以保证备库没有数据丢失;
5)缺点:主库的自动关闭会影响到主库的可用性,同时需要备库恢复后才能提交,对网络等客观条件要求非常的高,主库的性能会因此受到非常大的冲击。

#primary 端查看,我们可以看到数据库的保护模式为最大性能
SQL> select database_role,protection_mode,protection_level,open_mode from v$database;
#standby 端查看,也是一样的。
SQL> select database_role,protection_mode,protection_level,open_mode from v$database;

主备机mount状态下切换保护模式:
alter database set standby database to maximize performance; --切换为最大性能
alter database set standby database to maximize availability; --切换为最大可用
alter database set standby database to maximize protection; --切换为最大保护

15 : ADG常用运维命令和脚本

主要做主从数据库同步,通过Dataguard实现,当运行一段时间后,发现主从数据库的数据不一致了,从库无法启动,报“ORA-01196: 文件 1 由于介质恢复会话失败而不一致”这个错误,具体日志信息如下:
SQL> alter database open;
alter database open
*
第 1 行出现错误:
ORA-10458: standby database requires recovery
ORA-01196: 文件 1 由于介质恢复会话失败而不一致
ORA-01110: 数据文件 1: 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF'

解决方法:
从库启动到mount状态:
SQL>SHUTDOWN IMMEDIATE
SQL>STARTUP MOUNT;
SQL>alter database recover managed standby database using current logfile disconnect;
到主库上操作:
SQL>ALTER SYSTEM SWITCH LOGFILE;
多操作几次,操作之后,稍等一段时间,时间视网速而定,过一段时间后,在主库上查询一下规定情况:
SQL>SELECT NAME,SEQUENCE#,ARCHIVED,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
如果返回结果"APPLIED"都是“YES”或者只有最后一个是“NO”的话,说明全部归档日志全部已经归档完了,此时到备库上上操作:
备库操作:
SQL>alter database recover managed standby database cancel;
SQL>alter database open;
SQL>alter database recover managed standby database using current logfile disconnect;

ADG环境搭建的更多相关文章

  1. 11g adg 环境搭建实施手册-0908

    11g adg 环境搭建实施手册-0908 2017年8月30日 9:16 11g adg 环境搭建实施手册-0824 2017年8月24日 10:18 ####################### ...

  2. Oracle ADG环境搭建

    部署 环境介绍 1,软件安装前基础部署 (两台做同样操作) 1.1,关闭selinux和防火墙 因为centos7里面没有/etc/sysconfig/iptables这个配置文件所以我们首先用yum ...

  3. Oracle11g ADG环境实施文档-1204

    Oracle11g adg 环境搭建实施手册-1204 2017年8月30日 9:16 11g adg 环境搭建实施手册-0824 2017年8月24日 10:18 ################# ...

  4. [Android系列—] 1. Android 开发环境搭建与Hello World

    前言 開始之前先熟悉几个名词: SDK -- Software Development Kit, 软件开发工具包.这个词并不陌生, JDK,就是Jave Development Kit,相同对于And ...

  5. 转 DataGuard环境搭建 (一主一备一级联)

    DataGuard环境搭建 (一主一备一级联) http://blog.itpub.net/30130773/viewspace-2116985/ 1.--------- primary_role / ...

  6. .NET Core系列 : 1、.NET Core 环境搭建和命令行CLI入门

    2016年6月27日.NET Core & ASP.NET Core 1.0在Redhat峰会上正式发布,社区里涌现了很多文章,我也计划写个系列文章,原因是.NET Core的入门门槛相当高, ...

  7. Azure Service Fabric 开发环境搭建

    微服务体系结构是一种将服务器应用程序构建为一组小型服务的方法,每个服务都按自己的进程运行,并通过 HTTP 和 WebSocket 等协议相互通信.每个微服务都在特定的界定上下文(每服务)中实现特定的 ...

  8. rnandroid环境搭建

    react-native 环境搭建具体步骤这个大家已经玩烂了,这个主要是记录下来自己做win7系统遇到的坑 1.com.android.ddmlib.installexception 遇到这个问题,在 ...

  9. python开发环境搭建

    虽然网上有很多python开发环境搭建的文章,不过重复造轮子还是要的,记录一下过程,方便自己以后配置,也方便正在学习中的同事配置他们的环境. 1.准备好安装包 1)上python官网下载python运 ...

随机推荐

  1. Codeforces 1167 E Range Deleting 双指针+思维

    题意 给一个数列\(a​\),定义\(f(l,r)​\)为删除\(a​\)中所有满足\(l<=a_i<=r​\)的数后的数列,问有多少对\((l,r)​\),使\(f(l,r)​\)是一个 ...

  2. luoguP5024 保卫王国

    题目链接 问题分析 其实是比较明显的动态DP. 懒于再推一遍式子,直接用 最小权点覆盖=全集-最大权独立集,然后就和这道题一样了.题解可以看这里. 然后必须选或者不选的话,就直接把相应的点权变成\(- ...

  3. [JOI2012春季合宿]Rotate (链表)

    题意 题解 又是一道神仙题-- 显然的做法是大力splay,时间复杂度\(O((N+Q)N\log N)\), 可以卡掉. 正解: 使用十字链表维护矩阵,在周围增加第\(0\)行/列和第\((n+1) ...

  4. JavaWeb-SpringBoot(抖音)_二、服务器间通讯

    JavaWeb-SpringBoot(抖音)_一.抖音项目制作 传送门 JavaWeb-SpringBoot(抖音)_二.服务器间通讯 传送门 JavaWeb-SpringBoot(抖音)_三.抖音项 ...

  5. HDU 5858 Hard problem ——(计算几何)

    其实这题最多是个小学奥数题- -,,看到别人博客各显神通,也有用微积分做的(我也试了一下,结果到最后不会积...). 思路如下(这两张图是网上找来的): 然后就很简单了,算三角形面积可以用海伦公式,也 ...

  6. Leetcode题目21.合并两个有序链表(简单)

    题目描述: 将两个有序链表合并为一个新的有序链表并返回.新链表是通过拼接给定的两个链表的所有节点组成的. 示例: 输入:1->2->4, 1->3->4输出:1->1-& ...

  7. git commit 合并到指定分支

    1. 将指定的commit合并到当前分支 git cherry-pick  commit_id 2. 合并多个连续 commit 到指定分支 假设需要合并 devlop 上从 fb407a3f 到 9 ...

  8. beta week 2/2 Scrum立会报告+燃尽图 06

    此作业要求参见https://edu.cnblogs.com/campus/nenu/2019fall/homework/9959 一.小组情况 组长:贺敬文组员:彭思雨 王志文 位军营 徐丽君队名: ...

  9. 基于XML的AOP配置(2)-环绕通知

    配置方式: <aop:config> <aop:pointcut expression="execution(* com.itheima.service.impl.*.*( ...

  10. 开始JavaScript的学习了

    为何学习? 1. 所有主流浏览器都支持JavaScript. 2. 目前,全世界大部分网页都使用JavaScript. 3. 它可以让网页呈现各种动态效果. 4. 做为一个Web开发师,如果你想提供漂 ...