欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle DataGuard 简单配置

程序员文章站 2023-12-30 12:42:22
...

Oracle DataGuard 太恶心了,弄了这么长时间~下面我来介绍一下最简单的安装方法~1,首先装两个相同目录的oracle(可以选择不同

Oracle DataGuard 太恶心了,弄了这么长时间~下面我来介绍一下最简单的安装方法~

1,首先装两个相同目录的oracle(可以选择不同的目录),因为我用的是虚机,,所以默认装在c:\app下

2,在primary库上配置client参数,tnsnames.ora 和 listener.ora, standby上面也是同理~

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = C:\app\product\11.2.0\dbhome_1)
)

)

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

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

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

3, enable logging:

进入sqlplus,执行alter database force logging;

4,查看日志是否归档

archive log list;

如果没有的话就执行,

SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;

5,重新定义pfile文件

create pfile='c:\pfile.ora' from spfile

修改对应的pfile文件(其他文档说还要备份,不用累他们~),在后面加上下面这些内容

DB_UNIQUE_NAME=orcl254
LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl254,orcl253)'
LOG_ARCHIVE_DEST_1='LOCATION=c:\app\oradata\orcl\ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl254'
LOG_ARCHIVE_DEST_2='SERVICE=orcl253 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl253'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
FAL_SERVER=orcl
FAL_CLIENT=orcl
DB_FILE_NAME_CONVERT='oradata\orcl253','oradata\orcl254'
LOG_FILE_NAME_CONVERT='oradata\orcl253','oradata\orcl254'
STANDBY_FILE_MANAGEMENT=AUTO

执行:

create spfile from pfile='c:\pfile.ora'

Oracle DataGuard 简单配置

上一篇:

下一篇: