时间:2021-07-01 10:21:17 帮助过:14人阅读
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'