【搭建教程】教你一步步 windows Oracle 11g搭建dg详细步骤

一.背景

利用rman备份搭建基于windows到windows的11g dg的搭建。需要注意的是在sqlplus登录的时候,不同于linux上面,需要先oradim创建一个实例名之后才能登录。

二.利用rman备份搭建步骤

1.源端打开归档模式和force logging

logging;
archive log list
–开启归档
shutdown immediate;
startup mount;
archivelog;

2.目标端安装操作系统

安装windows操作系统。

3.目标端安装数据库软件

安装数据库软件,不用建库。

4.目标端配置静态监听

编辑listener.ora文件

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcldg)
(Oracle_HOME = C:\oracle\product\10.2.0\db_1)
(SID_NAME = orcldg)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.122)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)

5.目标端和源端配置tnsnames.ora

配置tnsnames.ora

orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.121)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

orcldg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.122)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcldg)
)
)

6.源端生成standby controlfile和pfile,源端修改参数

spfile;
‘C:\archivelog\control01.ctl’;

修改参数

both;
both;
both;
both;
both;
both;
both;
both;

7.源端做rman备份

run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
sql ‘‘;
backup database format ‘
C:\‘;
release channel c1;
release channel c2;
release channel c3;
}

8.源端传输standby controlfiel、pfile、密码文件到目标端

密码文件放到database文件夹中,同时名称中更改orcl为orcldg。
控制文件放置到pfile指定的位置。

9.目标端修改pfile文件

备库端添加:
DB_UNIQUE_NAME=orcldg
LOG_ARCHIVE_CONFIG=’DG_CONFIG=(orcldg,orcl)’
LOG_ARCHIVE_DEST_1= ‘LOCATION=/u01/app/oracle/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcldg’
LOG_ARCHIVE_DEST_2= ‘SERVICE=orcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl’
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
DB_FILE_NAME_CONVERT=’C:\oracle\product\10.2.0\oradata\orcldg’,’C:\oracle\product\10.2.0\oradata\orcl’
LOG_FILE_NAME_CONVERT=’C:\oracle\product\10.2.0\oradata\orcldg’,’C:\oracle\product\10.2.0\oradata\orcl’
STANDBY_FILE_MANAGEMENT=AUTO

10.启动目标端数据库至mount状态。

**oradim -new -sid orcldg**
**set ORACLE_SID=orcldg**
sqlplus / sysdba
‘C:\archivelog\pfile.ora’;
mount;

11.传输源端备份到目标端

12.目标端restore数据库

rman target /
catalog ‘C:\backup\’;
crosscheck backup
backup;
database;

13.创建spfile

‘C:\archivelog\pfile.ora’;

14.重启数据库

shutdown immediate;
startup;

15.创建standby logfile

SRL = (maximum number of logfiles for each thread + 1) * maximum number of threads
4;
5;
6;
7;

16.开启归档实时应用

NODELAY;

三.利用rman duplicate搭建步骤

1.源端打开归档模式和force logging

2.目标端安装操作系统

3.目标端安装数据库软件

4.目标端配置静态监听

5.目标端和源端配置tnsnames.ora

6.源端pfile

7.源端传输spfile、密码文件到目标端

8.目标端修改pfile文件

9.启动目标端数据库至nomount状态。

10.rman duplicate进行复制

rman target sys/sys@orcl auxiliary sys/sys@orcldg
duplicate target database for standby from active database nofilenamecheck;

11.创建spfile

12.重启数据库

13.创建standby logfile

14.开启归档实时应用


数据运维技术 » 【搭建教程】教你一步步 windows Oracle 11g搭建dg详细步骤