Oracle 11g Data Guard配置 (五)

2014-11-24 08:46:24 · 作者: · 浏览: 2
OTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
复制代码
备库
[oracle@tam admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0.5/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(PROGRAM = extproc)
)

(SID_DESC =
(SID_NAME = PRIMARY)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(GLOBAL_DBNAME = primary)
)
)

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

[oracle@tam admin]$ cat tnsnames.ora
# Generated by Oracle configuration tools.

PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.29.2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary)
)
)
复制代码
配置完成后,尝试从两台服务器以sysdba身份互相访问
主库:
[oracle@localhost admin]$ sqlplus sys/sys@standby as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 22 10:16:26 2012

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

Connected to an idle instance.
复制代码
备库:
[oracle@tam admin]$ sqlplus sys/sys@primary as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 22 10:15:17 2012

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
复制代码
7、启动备库
[oracle@tam dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 22 10:19:00 2012

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

Connected to an idle instance.

SYS@PRIMARY>startup nomount
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes

SYS@PRIMARY>alter database mount standby database;

Database altered.

SYS@PRIMARY>alter database recover managed standby database disconnect from session;

Database altered.
复制代码
8、验证
主库中创建一个表,并插入若凡数据后,备库中能够同步出这些数据,则认为DG实施成功
主库:
[oracle@localhost admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 22 10:28:14 2012

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

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

SYS@PRIMARY>create table test(id number);

Table created.


SYS@PRIMARY>for i in 1..10 loop
SP2-0734: unknown command beginning "for i in 1..." - rest of line ignored.
SYS@PRIMARY>begin
2 for i in 1..10 loop
3 insert into test values(i);
4 end loop;
5 commit;
6 end;
7 /

PL/SQL procedure successfully completed.

SYS@PRIMARY>select * from test;

ID
----------
1
2
3
4
5
6
7
8
9
10

10 rows selected.

SYS@PRIMARY>alter system switch logfile;

System alte