2013年(350)
分类: Oracle
2013-04-25 13:13:49
正如前面介绍的那样,对于级复制,提供了两种方式:
Maintain_global适用于中小型数据库创建,而PRE_INSTANTIATION_SETUP+POST_INSTANTIATION_SETUP适用于大型数据库的创建,这里我们演示通过 PRE_INSTANTIATION_SETUP 和POST_INSTANTIATION_SETUP过程创建数据库级复制环境。
设定环境如下:
提示:capture进程不会捕获sys/system/ctxsys几个schema的修改。因此这几个用户下的修改不会在streams环境中维护。
为了醒目区分操作所在的数据库,便于阅读,我们首先通过sql*plus的set sqlprompt命令设置操作符。
设置源库端显示:
[oracle@yans1 ~]$ export ORACLE_SID=jssweb
[oracle@yans1 ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 11月 25 16:4 1 :40
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Mining options
SQL> set sqlprompt "JSSWEB> "
JSSWEB>设置目标库显示:
[oracle@yanttest ~$ export ORACLE_SID=jssstr
[oracle@yanttest ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 11月 25 16:43:43 2008
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
已连接到空闲例程。
SQL> set sqlprompt "JSSSTR> "
JSSSTR>这一步主要是为了后面执行rman duplicate命令打下基础,关于创建辅助实例的相关操作,如果你尚不了解,建议参考《[ 三思笔记]RMAN高级应用之Duplicate复制数据库》,由于本步操作稍嫌繁琐,而且非本节介绍之主要内容,为避免本步操作占用过多篇幅影响视线,就不提供详细步骤了。
主要修改两机%ORACLE_HOME/network/admin/listener.ora和tnsnames.ora,确保监听已启动,两机互联互通。
源端和目标端tnsnames.ora增加下列内容:
JSSWEB_172.25.13.229 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.13.229)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = jssweb.jss.cn)
)
)
JSSSTR_172.25.13.231 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.13.231)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = jssstr.jss.cn)
)
)源端监听listener.ora增加下列内容:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PlsExtProc)
(ORACLE_HOME = /opt/ora10g/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = jssweb.jss.cn)
(ORACLE_HOME = /opt/ora10g/product/10.2.0/db_1)
(SID_NAME = jssweb)
)
)目标端也进行相应修改:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PlsExtProc)
(ORACLE_HOME = /data/oracle/product/10.2)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = jssstr.jss.cn)
(ORACLE_HOME = /data/oracle/product/10.2)
(SID_NAME = jssstr)
)
)修改后保存并重启监听。
首先查看源端:
JSSWEB> show parameter global_names
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
global_names boolean TRUE
JSSWEB> show parameter compatible
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 10.2.0.3.0
JSSWEB> show parameter job_queue
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 10目标端辅助实例配置完成后,启动到nomount状态:
JSSSTR> startup nomount
ORACLE 例程已经启动。
Total System Global Area 524288000 bytes
Fixed Size 2073984 bytes
Variable Size 213912192 bytes
Database Buffers 301989888 bytes
Redo Buffers 6311936 bytes
JSSSTR> show parameter global_names;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
global_names boolean TRUE
JSSSTR> show parameter compatible
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 10.2.0.3.0
JSSSTR> show parameter job_queue
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 10这里我们设置了必须设置的几个初始化参数,事实上除了上述参数外,还有一些其它可选或相关的初始化参数设置,详见:
JSSWEB> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /opt/ora10g/product/10.2.0/db_1/dbs/arch
Oldest online log sequence 9
Current log sequence 11如果不是,可按下列方式操作修改数据库为归档模式。
JSSWEB> startup mount
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 2073984 bytes
Variable Size 163580544 bytes
Database Buffers 352321536 bytes
Redo Buffers 6311936 bytes
Database mounted.
JSSWEB> alter database archivelog ;
Database altered.
JSSWEB> alter system set log_archive_dest_1=¨location=/data/oradata/jssweb/archive/¨;
System altered.
JSSWEB> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /data/oradata/jssweb/archive/
Oldest online log sequence 9
Next log sequence to archive 11
Current log sequence 11
JSSWEB> alter database open;
Database altered.提示:如果不是准备配置成双向的复制环境,目标端可以是非归档模式。
======================================