📄 1786.html
字号:
SQL>insert into dept values (dept_no.nextval,'research','dallas');<br>
SQL>commit;<br>
⑥、在beijing数据库那边同样运行以上①,②,③<br>
⑦、在beijing数据库scott用户下创建主关键字的序列号,范围避免和shenzhen的冲突。<br>
SQL> create sequence dept_no increment by 1 start with 45 maxvalue 99 cycle nocache;<br>
⑧、在beijing数据库scott用户下插入初始化数据<br>
SQL>insert into dept values (dept_no.nextval,'sales','chicago');<br>
SQL>insert into dept values (dept_no.nextval,'operations','boston');<br>
SQL>commit;<br>
6、创建要复制的组scott_mg,加入数据库对象,产生对象的复制支持<br>
①、用repadmin身份登录shenzhen数据库,创建主复制组scott_mg<br>
SQL> execute dbms_repcat.create_master_repgroup('scott_mg');<br>
说明:scott_mg组名可以根据用户的需求自由命名。<br>
②、在复制组scott_mg里加入数据库对象<br>
SQL>execute dbms_repcat.create_master_repobject(sname=>'scott',oname=>'dept', type=>'table',use_existing_object=>true,gname=>'scott_mg');<br>
参数说明:<br>
sname 实现数据库复制的用户名称<br>
oname 实现数据库复制的数据库对象名称<br>
(表名长度在27个字节内,程序包名长度在24个字节内)<br>
type 实现数据库复制的数据库对象类别<br>
(支持的类别:表,索引,同义词,触发器,视图,过程,函数,程序包,程序包体)<br>
use_existing_object true表示用主复制节点已经存在的数据库对象<br>
gname 主复制组名<br>
③、对数据库对象产生复制支持<br>
SQL>execute dbms_repcat.generate_replication_support('scott','dept','table');<br>
(说明:产生支持scott用户下dept表复制的数据库触发器和程序包)<br>
④、确认复制的组和对象已经加入数据库的数据字典<br>
SQL>select gname, master, status from dba_repgroup;<br>
SQL>select * from dba_repobject;<br>
7、创建主复制节点<br>
①、用repadmin身份登录shenzhen数据库,创建主复制节点<br>
SQL>execute dbms_repcat.add_master_database<br>
(gname=>'scott_mg',master=>'beijing.test.com.cn',use_existing_objects=>true, copy_rows=>false, propagation_mode => 'asynchronous');<br>
参数说明:<br>
gname 主复制组名<br>
master 加入主复制节点的另一个数据库<br>
use_existing_object true表示用主复制节点已经存在的数据库对象<br>
copy_rows false表示第一次开始复制时不用和主复制节点保持一致<br>
propagation_mode 异步地执行<br>
②、确认复制的任务队列已经加入数据库的数据字典<br>
SQL>select * from user_jobs;<br>
8、使同步组的状态由停顿(quiesced )改为正常(normal)<br>
①、用repadmin身份登录shenzhen数据库,运行以下命令<br>
SQL> execute dbms_repcat.resume_master_activity('scott_mg',false);<br>
②、确认同步组的状态为正常(normal)<br>
SQL> select gname, master, status from dba_repgroup;<br>
③、如果这个①命令不能使同步组的状态为正常(normal),可能有一些停顿的复制,运行以下命令再试试(建议在紧急的时候才用):<br>
SQL> execute dbms_repcat.resume_master_activity('scott_mg',true);<br>
9、创建复制数据库的时间表,我们假设用固定的时间表:10分钟复制一次。<br>
①、用repadmin身份登录shenzhen数据库,运行以下命令<br>
SQL>begin<br>
dbms_defer_sys.schedule_push (<br>
destination => 'beijing.test.com.cn',<br>
interval => 'sysdate + 10/1440',<br>
next_date => sysdate);<br>
end;<br>
/<br>
<br>
SQL>begin<br>
dbms_defer_sys.schedule_purge (<br>
next_date => sysdate,<br>
interval => 'sysdate + 10/1440',<br>
delay_seconds => 0,<br>
rollback_segment => '');<br>
end;<br>
/<br>
<br>
②、用repadmin身份登录beijing数据库,运行以下命令<br>
SQL>begin<br>
dbms_defer_sys.schedule_push (<br>
destination => ' shenzhen.test.com.cn ',<br>
interval => 'sysdate + 10 / 1440',<br>
next_date => sysdate);<br>
end;<br>
/<br>
<br>
SQL>begin<br>
dbms_defer_sys.schedule_purge (<br>
next_date => sysdate,<br>
interval => 'sysdate + 10/1440',<br>
delay_seconds => 0,<br>
rollback_segment => '');<br>
end;<br>
/<br>
10、添加或修改两边数据库的记录,跟踪复制过程<br>
如果你想立刻看到添加或修改后数据库的记录的变化,可以在两边repadmin用户下找到push的job_number,然后运行:<br>
SQL>exec dbms_job.run(job_number);<br>
三、异常情况的处理<br>
1、检查复制工作正常否,可以在repadmin 用户下查询user_jobs<br>
SQL>select job,this_date,next_date,what, broken from user_jobs;<br>
正常的状态有两种:<br>
任务闲——this_date为空,next_date为当前时间后的一个时间值<br>
任务忙——this_date不为空,next_date为当前时间后的一个时间值<br>
异常状态也有两种:<br>
任务死锁——next_date为当前时间前的一个时间值<br>
任务死锁——next_date为非常大的一个时间值,例如:4001-01-01<br>
这可能因为网络中断照成的死锁<br>
解除死锁的办法:<br>
$ps –ef|grep orale<br>
找到死锁的刷新快照的进程号ora_snp*,用kill –9 命令删除此进程<br>
然后进入repadmin 用户SQL>操作符下,运行命令:<br>
SQL>exec dbms_job.run(job_number);<br>
说明:job_number 为用select job,this_date,next_date,what from user_jobs;命令查出的job编号。<br>
2、增加或减少复制组的复制对象<br>
①、停止主数据库节点的复制动作,使同步组的状态由正常(normal)改为停顿(quiesced )<br>
用repadmin身份登录shenzhen数据库,运行以下命令<br>
SQL>execute dbms_repcat.suspend_master_activity (gname => 'scott_mg');<br>
②、在复制组scott_mg里加入数据库对象,保证数据库对象必须有主关键字。<br>
SQL>execute dbms_repcat.create_master_repobject(sname=>'scott',oname=>'emp', type=>'table',use_existing_object=>true,gname=>'scott_mg');<br>
对加入的数据库对象产生复制支持<br>
SQL>execute dbms_repcat.generate_replication_support('scott','emp','table');<br>
③、在复制组scott_mg里删除数据库对象。<br>
SQL>execute dbms_repcat.drop_master_repobject ('scott','dept','table');<br>
④、重新使同步组的状态由停顿(quiesced )改为正常(normal)。<br>
SQL> execute dbms_repcat.resume_master_activity('scott_mg',false);<br>
[返回列表]<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -