Oracle 11gR2 搭建Data Guard 数据库热备份集群

目的

搭建一个Oracle 11gR2支持数据热备份的验证环境,对应用系统进行集群部署验证。

准备

安装CentOS 7 64位系统上的Oracle 11gR2服务器两台(primary、standby)
确定主从数据库全局唯一名称(db_unique_name):primary(xiaoji)、standby(xiaoji_standby)

开始安装

1 打开Forced Logging模式

操作对象:primary
操作用户:oracle

sqlplus xiaoji as sysdba
archive log list;

确认归档模式

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival            Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence    7
Current log sequence          9

启动归档模式

SQL> shutdown immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.
Total System Global Area  534462464 bytes
Fixed Size                  2215064 bytes
Variable Size            402654056 bytes
Database Buffers          121634816 bytes
Redo Buffers                7958528 bytes
Database mounted.

SQL> alter database archivelog;

Database altered.

确认归档模式

SQL> archive log list;

Database log mode              Archive Mode
Automatic archival            Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence    14
Next log sequence to archive  16
Current log sequence          16

确认强制归档

SQL> select force_logging from v$database;

FOR
---
YES

强制归档

alter database force logging;

执行结果

SQL> alter database force logging;

Database altered.

确认归档模式

SQL> select force_logging from v$database;

FOR
---
YES

2 添加standby日志文件

操作对象:primary
操作用户:oracle

sqlplus xiaoji as sysdba
alter database add standby logfile group 4 ('/home/oracle/tools/oracle11g/oradata/xiaoji/redo_standby_01.log') size 20M;
alter database add standby logfile group 5 ('/home/oracle/tools/oracle11g/oradata/xiaoji/redo_standby_02.log') size 20M;
alter database add standby logfile group 6 ('/home/oracle/tools/oracle11g/oradata/xiaoji/redo_standby_03.log') size 20M;
alter database drop standby logfile group 4;
alter database drop standby logfile group 5;
alter database drop standby logfile group 6;

select * from v$logfile order by 1;

确认日志文件

[oracle@vmco0240 xiaoji]$ pwd
/home/oracle/tools/oracle11g/oradata/xiaoji
[oracle@vmco0240 xiaoji]$ ls -la
total 1418624
drwxr-x---. 2 oracle asmadmin      4096 Jan  5 16:31 .
drwxr-x---. 5 oracle asmadmin      4096 Jan  4 11:40 ..
-rw-r-----. 1 oracle asmadmin  9748480 Jan  4 13:01 control01.ctl
-rw-r-----. 1 oracle asmadmin  52429312 Jan  4 11:18 redo01.log
-rw-r-----. 1 oracle asmadmin  52429312 Jan  4 11:18 redo02.log
-rw-r-----. 1 oracle asmadmin  52429312 Jan  4 13:00 redo03.log
-rw-r-----. 1 oracle asmadmin 20972032 Jan 7 13:17 redo_standby_01.log
-rw-r-----. 1 oracle asmadmin 20972032 Jan 7 13:17 redo_standby_02.log
-rw-r-----. 1 oracle asmadmin 20972032 Jan 7 13:18 redo_standby_03.log
-rw-r-----. 1 oracle asmadmin 482353152 Jan  4 13:00 sysaux01.dbf
-rw-r-----. 1 oracle asmadmin 702554112 Jan  4 12:58 system01.dbf
-rw-r-----. 1 oracle asmadmin  20979712 Jan  4 12:18 temp01.dbf
-rw-r-----. 1 oracle asmadmin  31465472 Jan  4 12:53 undotbs01.dbf
-rw-r-----. 1 oracle asmadmin  5251072 Jan  4 11:18 users01.dbf

3 准备参数文件

生成pfile

SQL> create pfile from spfile;

File created.

关闭数据库

SQL> shutdown immediate

修改pfile


参考资料

ORACLE 11G 搭建dataguard详细步骤(所有操作总结)
http://blog.itpub.net/26230597/viewspace-1432637/

你可能感兴趣的:(Oracle 11gR2 搭建Data Guard 数据库热备份集群)