<?xml version="1.0" encoding="GB2312"?>
<rss version="2.0">
<channel>
<title>Friends Life and Oracle</title>
<link>http://www.eygle.com/blog/</link>
<description>eygle的Oracle Blog，提供Oracle技术研究及深入探讨，同时记录个人爱好及生活历程。</description>
<copyright>Copyright 2006</copyright>
<lastBuildDate>Tue, 28 Nov 2006 10:32:19 +0800</lastBuildDate>
<generator>http://www.movabletype.org/?v=3.33</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs> 

<item>
<title>DataGuard数据库服务器硬盘故障处理一则</title>
<description><![CDATA[<p>昨天一台PC Server上的数据库又出问题，<a href="http://www.eygle.com/archives/2006/10/start_dataguard_db.html">同样</a>是硬盘故障。</p>

<p>这两台服务器用的都是<a href="http://www.realserver.com.cn/">联志</a>的国产低端PC Server，这些服务器的质量实在是差，上次一台备机的硬盘损坏，然后又有一台因为电源模块的问题反复重起，现在这一台服务器的硬盘再次出现问题。</p>

<blockquote>Nov 24 10:27:48 wapcom1 kernel: attempt to access beyond end of device<BR>Nov 24 10:27:48 wapcom1 kernel: 08:08: rw=0, want=1564747716, limit=5245191<BR>Nov 24 10:27:48 wapcom1 kernel: EXT3-fs error (device sd(8,8)): ext3_readdir: <BR>&nbsp;directory #128110 contains a hole at offset 2011258880<BR>Nov 24 10:27:49 wapcom1 kernel: attempt to access beyond end of device<BR>Nov 24 10:27:49 wapcom1 kernel: 08:08: rw=0, want=1564747716, limit=5245191<BR>Nov 24 10:27:50 wapcom1 kernel: EXT3-fs error (device sd(8,8)): ext3_readdir: <BR>&nbsp;directory #128110 contains a hole at offset 2011262976<BR>Nov 24 10:27:50 wapcom1 kernel: attempt to access beyond end of device<BR>Nov 24 10:27:50 wapcom1 kernel: 08:08: rw=0, want=1564747716, limit=5245191<BR>Nov 24 10:27:50 wapcom1 kernel: EXT3-fs error (device sd(8,8)): ext3_readdir: <BR>&nbsp;directory #128110 contains a hole at offset 2011267072<BR>Nov 24 10:27:50 wapcom1 kernel: attempt to access beyond end of device<BR>Nov 24 10:27:50 wapcom1 kernel: 08:08: rw=0, want=1564747716, limit=5245191<BR>Nov 24 10:27:50 wapcom1 kernel: EXT3-fs error (device sd(8,8)): ext3_readdir: <BR>&nbsp;directory #128110 contains a hole at offset 2011271168</blockquote>

<p>好在数据库通过DataGuard可以切换到另外一台，没有数据损失：<br />
<blockquote>Thu Nov 23 18:46:18 2006<BR>ARC0: Complete FAL archive (thread 1 sequence 6045 destination bmarksb)<BR>ARC0: Begin FAL archive (thread 1 sequence 6047 destination bmarksb)<BR>Creating archive destination LOG_ARCHIVE_DEST_2: 'bmarksb'<BR>ARC0: Complete FAL archive (thread 1 sequence 6047 destination bmarksb)<BR>ARC0: Begin FAL archive (thread 1 sequence 6048 destination bmarksb)<BR>Creating archive destination LOG_ARCHIVE_DEST_2: 'bmarksb'<BR>Thu Nov 23 18:46:18 2006<BR>ARC1: Complete FAL archive (thread 1 sequence 6046 destination bmarksb)<BR>ARC1: Begin FAL archive (thread 1 sequence 6049 destination bmarksb)<BR>Creating archive destination LOG_ARCHIVE_DEST_2: 'bmarksb'<BR>Thu Nov 23 18:46:18 2006<BR>ARC0: Complete FAL archive (thread 1 sequence 6048 destination bmarksb)<BR>Thu Nov 23 18:46:18 2006<BR>ARC1: Complete FAL archive (thread 1 sequence 6049 destination bmarksb)</blockquote></p>

<p>现在是主库所在的服务器出现问题:<br />
<blockquote><P>SQL&gt; select dbid,name,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;</P><br />
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DBID NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROTECTION_MODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DATABASE_ROLE&nbsp;&nbsp;&nbsp; SWITCHOVER_STATUS<BR>---------- --------- -------------------- ---------------- ------------------<BR>3520694939 BMARK&nbsp;&nbsp;&nbsp;&nbsp; MAXIMUM PERFORMANCE&nbsp; PRIMARY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SESSIONS ACTIVE</P></blockquote></p>

<p>备库现在一切正常:<br />
<blockquote><P>SQL&gt; select dbid,name,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;</P><br />
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DBID NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROTECTION_MODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DATABASE_ROLE&nbsp;&nbsp;&nbsp; SWITCHOVER_STATUS<BR>---------- --------- -------------------- ---------------- ------------------<BR>3520694939 BMARK&nbsp;&nbsp;&nbsp;&nbsp; MAXIMUM PERFORMANCE&nbsp; PHYSICAL STANDBY SESSIONS ACTIVE</P></blockquote></p>

<p>现在需要的是一点停机时间进行切换。</p>

<p>切换日志:<br />
<blockquote>Fri Nov 24 11:30:43 2006<br />
alter database commit to switchover to physical standby with session shutdown<br />
Fri Nov 24 11:30:43 2006<br />
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY<br />
Fri Nov 24 11:30:43 2006<br />
SMON: disabling tx recovery<br />
Fri Nov 24 11:30:44 2006<br />
Active process 26743 user 'oracle' program 'oracle@wapcom1.hawa.cn (CJQ0)'<br />
Active process 9033 user 'oracle' program 'oracle@wapcom1.hawa.cn (TNS V1-V3)'<br />
Active process 7655 user 'oracle' program 'oracle@wapcom1.hawa.cn (TNS V1-V3)'<br />
...............<br />
Active process 8944 user 'oracle' program 'oracle@wapcom1.hawa.cn (TNS V1-V3)'<br />
Active process 29104 user 'oracle' program 'oracle@wapcom1.hawa.cn (TNS V1-V3)'<br />
Active process 30750 user 'oracle' program 'oracle@wapcom1.hawa.cn (TNS V1-V3)'<br />
Active process 9045 user 'oracle' program 'oracle@wapcom1.hawa.cn (TNS V1-V3)'<br />
CLOSE: waiting for server sessions to complete.<br />
Fri Nov 24 11:31:51 2006<br />
CLOSE: all sessions shutdown successfully.<br />
Fri Nov 24 11:32:09 2006<br />
SMON: disabling cache recovery<br />
Fri Nov 24 11:32:10 2006<br />
Shutting down archive processes<br />
Archiving is disabled<br />
Fri Nov 24 11:32:10 2006<br />
ARCH shutting down<br />
Fri Nov 24 11:32:10 2006<br />
ARCH shutting down<br />
Fri Nov 24 11:32:10 2006<br />
ARC0: Archival stopped<br />
Fri Nov 24 11:32:10 2006<br />
ARC1: Archival stopped<br />
Fri Nov 24 11:32:10 2006<br />
Thread 1 closed at log sequence 6076<br />
Successful close of redo thread 1<br />
Fri Nov 24 11:32:28 2006<br />
ARCH: noswitch archival of thread 1, sequence 6076<br />
ARCH: End-Of-Redo archival of thread 1 sequence 6076<br />
ARCH: Evaluating archive   log 3 thread 1 sequence 6076<br />
ARCH: Beginning to archive log 3 thread 1 sequence 6076<br />
Creating archive destination LOG_ARCHIVE_DEST_2: 'bmarksb'<br />
Creating archive destination LOG_ARCHIVE_DEST_1: '/var/oradata/arch/1_6076.arc'<br />
ARCH: Completed archiving  log 3 thread 1 sequence 6076<br />
ARCH: archiving is disabled due to current logfile archival<br />
Clearing standby activation ID 3520937155 (0xd1dd3cc3)<br />
The primary database controlfile was created using the<br />
'MAXLOGFILES 5' clause.<br />
The resulting standby controlfile will not have enough<br />
available logfile entries to support an adequate number<br />
of standby redo logfiles. Consider re-creating the<br />
primary controlfile using 'MAXLOGFILES 8' (or larger).<br />
Use the following SQL commands on the standby database to create<br />
standby redo logfiles that match the primary database:<br />
ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 10485760;<br />
ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 10485760;<br />
ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 10485760;<br />
ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 10485760;<br />
Archivelog for thread 1 sequence 6076 required for standby recovery<br />
MRP0 started with pid=8<br />
MRP0: Background Managed Standby Recovery process started<br />
Media Recovery Log /var/oradata/arch/1_6076.arc<br />
Identified end-of-REDO for thread 1 sequence 6076<br />
Identified end-of-REDO for thread 1 sequence 6076<br />
Media Recovery End-Of-Redo indicator encountered<br />
Media Recovery Applied until change 194025715<br />
MRP0: Media Recovery Complete: End-Of-REDO<br />
Resetting standby activation ID 3520937155 (0xd1dd3cc3)<br />
MRP0: Background Media Recovery process shutdown<br />
Fri Nov 24 11:32:35 2006<br />
Switchover: Complete - Database shutdown required<br />
Completed: alter database commit to switchover to physical st<br />
Fri Nov 24 11:32:53 2006<br />
Shutting down instance: further logons disabled<br />
Shutting down instance (immediate)<br />
License high water mark = 140<br />
Fri Nov 24 11:32:53 2006<br />
ALTER DATABASE CLOSE NORMAL<br />
ORA-1507 signalled during: ALTER DATABASE CLOSE NORMAL...<br />
ARCH: Archiving is disabled<br />
Shutting down archive processes<br />
Archiving is disabled<br />
Archive process shutdown avoided: 0 active<br />
ARCH: Archiving is disabled<br />
Shutting down archive processes<br />
Archiving is disabled<br />
Archive process shutdown avoided: 0 active<br />
Fri Nov 24 11:33:14 2006<br />
Starting ORACLE instance (normal)<br />
LICENSE_MAX_SESSION = 0<br />
LICENSE_SESSIONS_WARNING = 0<br />
SCN scheme 2<br />
Using log_archive_dest parameter default value<br />
LICENSE_MAX_USERS = 0<br />
SYS auditing is disabled<br />
Starting up ORACLE RDBMS Version: 9.2.0.6.0.<br />
System parameters with non-default values:<br />
  processes                = 150<br />
  timed_statistics         = TRUE<br />
  shared_pool_size         = 83886080<br />
  large_pool_size          = 33554432<br />
  standby_archive_dest     = /var/oradata/arch<br />
  fal_server               = bmarksb<br />
  fal_client               = bmark<br />
  log_archive_format       = %t_%s.arc<br />
...........<br />
CJQ0 started with pid=8<br />
Fri Nov 24 11:33:15 2006<br />
ARCH: STARTING ARCH PROCESSES<br />
ARC0 started with pid=9<br />
ARC0: Archival started<br />
ARC1 started with pid=10<br />
Fri Nov 24 11:33:15 2006<br />
ARCH: STARTING ARCH PROCESSES COMPLETE<br />
Fri Nov 24 11:33:15 2006<br />
ARC1: Archival started<br />
Fri Nov 24 11:33:15 2006<br />
ARC0: Thread not mounted<br />
Fri Nov 24 11:33:15 2006<br />
ARC1: Thread not mounted<br />
Fri Nov 24 11:33:22 2006<br />
alter database mount standby database<br />
Fri Nov 24 11:33:26 2006<br />
Successful mount of redo thread 1, with mount id 3559140162<br />
Fri Nov 24 11:33:26 2006<br />
Standby Database mounted.<br />
Completed: alter database mount standby database<br />
Fri Nov 24 11:33:29 2006<br />
ALTER DATABASE RECOVER  managed standby database disconnect  <br />
Attempt to start background Managed Standby Recovery process<br />
MRP0 started with pid=12<br />
MRP0: Background Managed Standby Recovery process started<br />
Fri Nov 24 11:33:34 2006<br />
Completed: ALTER DATABASE RECOVER  managed standby database d<br />
Fri Nov 24 11:33:34 2006<br />
Media Recovery Waiting for thread 1 seq# 6077<br />
Media Recovery Log /var/oradata/arch/1_6077.arc<br />
Media Recovery Waiting for thread 1 seq# 6078<br />
Media Recovery Log /var/oradata/arch/1_6078.arc<br />
Media Recovery Waiting for thread 1 seq# 6079</blockquote></p>

<p>看来以后不能再采购联志服务器了。</p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/11/aisino_server_dataguard.html</link>
<guid>http://www.eygle.com/archives/2006/11/aisino_server_dataguard.html</guid>
<category>Advanced</category>
<pubDate>Tue, 28 Nov 2006 10:32:19 +0800</pubDate>
</item>
<item>
<title>EMC存储+Solaris+Oracle10g+Veritas</title>
<description><![CDATA[<p>前一段搭建了一个EMC CX500+Sun Solaris9+VERITAS Storage Foundation for Oracle 4.0 + Oracle10gR2 的测试环境。</p>

<p>其本上采用了目前公司采用的所有技术，是一个全面的测试环境，这个环境帮我解决了一系列的Veritas技术问题。</p>

<p></p>

<p>这是一套HA的高可用性架构，把系统的结构截取了一下:</p>

<p></p>

<p><a href="http://www.flickr.com/photos/65577044@N00/303940107/" title="Photo Sharing"><img src="http://static.flickr.com/99/303940107_f744688bbc_o.jpg" width="796" height="627" alt="resource" /></a></p>

<p>留念，这个环境要毁掉重做了。</p>

<blockquote>bash-2.05# hastatus -summary

<p>-- SYSTEM STATE<br />
-- System               State                Frozen              </p>

<p>A  db210-1              RUNNING              0                    <br />
A  db210-2              RUNNING              0                    </p>

<p>-- GROUP STATE<br />
-- Group           System               Probed     AutoDisabled    State          </p>

<p>B  ClusterService  db210-1              Y          N               ONLINE         <br />
B  ClusterService  db210-2              Y          N               OFFLINE        <br />
B  O10g            db210-1              Y          N               ONLINE         <br />
B  O10g            db210-2              Y          N               OFFLINE        </blockquote></p>

<p></p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/11/emc_solaris_oracle_veritas.html</link>
<guid>http://www.eygle.com/archives/2006/11/emc_solaris_oracle_veritas.html</guid>
<category>Advanced</category>
<pubDate>Thu, 23 Nov 2006 11:21:08 +0800</pubDate>
</item>
<item>
<title>设置ARCHIVE_LAG_TARGET 强制日志切换</title>
<description><![CDATA[<p>在DataGuard环境中，为了减少故障时数据损失，我们可以设置ARCHIVE_LAG_TARGET参数，强制进行日志切换。</p>

<p>ARCHIVE_LAG_TARGET参数可以设置一个时间，通过时间限制，指定数据库强制进行Log Switch，进行归档。</p>

<p>这个参数的缺省值是0，即为不启用该参数。该参数合理的取值范围在60 ~ 7200之间。<br />
通常大于7200和小于1800不被推荐，低于30分钟的切换时间可能导致性能问题。</p>

<p>以下是我的一个生产环境的设置效果。<br />
设置之前:<br />
<blockquote>SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';</p>

<p>Session altered.</p>

<p>SQL> col name for a60<br />
SQL> select name,COMPLETION_TIME from v$archived_log where name is not null;</p>

<p>NAME                                                         COMPLETION_TIME<br />
------------------------------------------------------------ -------------------<br />
/data2/oradata/STAT/archive/1_5441_593258512.dbf           2006-11-20 10:49:57<br />
/data2/oradata/STAT/archive/1_5442_593258512.dbf           2006-11-20 15:49:50</blockquote></p>

<p>由于数据库并不繁忙，日志很久才会切换一次。</p>

<p>设置archive_lag_target参数:<br />
<blockquote>SQL> show parameter archive_lag</p>

<p>NAME                                 TYPE        VALUE<br />
------------------------------------ ----------- ------------------------------<br />
archive_lag_target                   integer     0<br />
SQL> alter system set archive_lag_target=1800;</p>

<p>System altered.</p>

<p>SQL> show parameter archive_lag</p>

<p>NAME                                 TYPE        VALUE<br />
------------------------------------ ----------- ------------------------------<br />
archive_lag_target                   integer     1800</blockquote></p>

<p>此时可以看到日志切换时间发生改变:<br />
<blockquote>[oracle@STAT ~]$ sqlplus "/ as sysdba"</p>

<p>SQL*Plus: Release 10.2.0.2.0 - Production on Mon Nov 20 21:31:31 2006</p>

<p>Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.</p>

<p><br />
Connected to:<br />
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production<br />
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options</p>

<p>SQL> archive log list;<br />
Database log mode              Archive Mode<br />
Automatic archival             Enabled<br />
Archive destination            /data2/oradata/STAT/archive<br />
Oldest online log sequence     5449<br />
Next log sequence to archive   5451<br />
Current log sequence           5451<br />
SQL> !<br />
[oracle@STAT ~]$ ll /data2/oradata/STAT/archive<br />
total 125776<br />
-rw-r-----  1 oracle oinstall 43030016 Nov 20 10:49 1_5441_593258512.dbf<br />
-rw-r-----  1 oracle oinstall 43122688 Nov 20 15:49 1_5442_593258512.dbf<br />
-rw-r-----  1 oracle oinstall 14172672 Nov 20 17:31 1_5443_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  3620864 Nov 20 18:02 1_5444_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  3511296 Nov 20 18:32 1_5445_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  3626496 Nov 20 19:02 1_5446_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  4903936 Nov 20 19:32 1_5447_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  3521536 Nov 20 20:02 1_5448_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  5144576 Nov 20 20:32 1_5449_593258512.dbf<br />
-rw-r-----  1 oracle oinstall  3916800 Nov 20 21:02 1_5450_593258512.dbf</blockquote></p>

<p>这个参数在DataGuard/Standby环境中是非常有效的。</p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/11/archive_lag_target_force_logswitch.html</link>
<guid>http://www.eygle.com/archives/2006/11/archive_lag_target_force_logswitch.html</guid>
<category>Advanced</category>
<pubDate>Tue, 21 Nov 2006 10:07:24 +0800</pubDate>
</item>
<item>
<title>Oracle9i与Oracle10g之间的高级复制配置</title>
<description><![CDATA[<p>今天有朋友问及，Oracle9i和Oracle10g之间能够构建高级复制环境。<br />
基于实现原理，我们知道一定是可以的，但是还是动手测试了一下。</p>

<p>测试了简单的表复制，结论是没有问题。<br />
高级复制的详细过程可以参考我以前的文章:<br />
<a href="http://www.eygle.com/archives/2005/06/oraclessoeaeaeo.html">http://www.eygle.com/archives/2005/06/oraclessoeaeaeo.html</a></p>

<p>测试的简单过程如下(略去了一些基本步骤).<br />
首先测试两个数据库的连通性:<br />
<blockquote>$ sqlplus "/ as sysdba"</p>

<p>SQL*Plus: Release 9.2.0.4.0 - Production on Tue Oct 31 10:36:31 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production<br />
With the Partitioning, OLAP and Oracle Data Mining options<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>SQL> show parameter glob</p>

<p>NAME                                 TYPE        VALUE<br />
------------------------------------ ----------- ---------------------<br />
global_context_pool_size             string<br />
global_names                         boolean     TRUE<br />
SQL> select * from global_name;</p>

<p>GLOBAL_NAME<br />
----------------------------------------------------------------------<br />
HSBILL.HURRAY.COM.CN</p>

<p>SQL> exit<br />
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production<br />
With the Partitioning, OLAP and Oracle Data Mining options<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>bash-2.03$ tnsping mars</p>

<p>TNS Ping Utility for Solaris: Version 9.2.0.4.0 - Production on 31-OCT-2006 10:39:41</p>

<p>Copyright (c) 1997 Oracle Corporation.  All rights reserved.</p>

<p>Used parameter files:<br />
/opt/oracle/product/9.2.0/network/admin/sqlnet.ora</p>

<p><br />
Used TNSNAMES adapter to resolve the alias<br />
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.31.110)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mars)))<br />
OK (10 msec)</blockquote></p>

<p>两个数据库分别创建db link:<br />
9i的数据库:<br />
<blockquote>bash-2.03$ sqlplus repadmin/repadmin</p>

<p>SQL*Plus: Release 9.2.0.4.0 - Production on Tue Oct 31 10:57:49 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production<br />
With the Partitioning, OLAP and Oracle Data Mining options<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>SQL> create public database link "MARS.HURRAY.COM.CN" connect to repadmin identified by repadmin using 'MARS';</p>

<p>Database link created.</p>

<p>SQL> select * from dual@mars;</p>

<p>D<br />
-<br />
X</blockquote></p>

<p>10g的数据库:<br />
<blockquote>bash-2.03$ sqlplus "/ as sysdba"</p>

<p>SQL*Plus: Release 10.2.0.1.0 - Production on Tue Oct 31 10:15:20 2006</p>

<p>Copyright (c) 1982, 2005, Oracle.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production<br />
With the Partitioning, OLAP and Data Mining options</p>

<p>SQL> select username from dba_users where username='REPADMIN';</p>

<p>USERNAME<br />
------------------------------<br />
REPADMIN</p>

<p>SQL> connect repadmin/repadmin<br />
Connected.<br />
SQL> select * from tab;</p>

<p>no rows selected</p>

<p>SQL> select * from global_name;</p>

<p>GLOBAL_NAME<br />
--------------------------------------------------------------------------------<br />
MARS.HURRAY.COM.CN</p>

<p>SQL> create public database link "HSBILL.HURRAY.COM.CN" connect to repadmin identified by repadmin using 'HSBILL';</p>

<p>Database link created.</p>

<p>SQL> select * from dual@hsbill;</p>

<p>D<br />
-<br />
X</blockquote></p>

<p>两个数据库分别创建测试表：<br />
<blockquote>SQL> connect eygle/eygle<br />
Connected.</p>

<p>SQL> create table eygle as select * from v$session;</p>

<p>Table created.</p>

<p>SQL> alter table eygle add (constraint pk_eygle primary key (SADDR));</p>

<p>Table altered.</blockquote></p>

<p>进行复制创建:<br />
<blockquote>SQL> connect repadmin/repadmin<br />
Connected.</p>

<p>SQL> execute dbms_repcat.create_master_repgroup('rep_910');</p>

<p>PL/SQL procedure successfully completed.</p>

<p>SQL> execute dbms_repcat.create_master_repobject(sname=>'eygle',oname=>'eygle', type=>'table',use_existing_object=>true,gname=>'rep_910',copy_rows=>false);</p>

<p>PL/SQL procedure successfully completed.</p>

<p>SQL> execute dbms_repcat.generate_replication_support('eygle','eygle','table');</p>

<p>PL/SQL procedure successfully completed.</p>

<p>SQL> execute dbms_repcat.add_master_database(gname=>'rep_910',master=>'MARS.HURRAY.COM.CN',use_existing_objects=>true, copy_rows=>false, propagation_mode => 'synchronous');</p>

<p>PL/SQL procedure successfully completed.</p>

<p><br />
SQL> execute dbms_repcat.resume_master_activity('rep_910',true);</p>

<p>PL/SQL procedure successfully completed.</blockquote></p>

<p>基本测试:</p>

<blockquote>SQL> select count(*) from eygle.eygle;

<p>  COUNT(*)<br />
----------<br />
        20</p>

<p>SQL> select count(*) from eygle.eygle@mars;</p>

<p>  COUNT(*)<br />
----------<br />
        20</p>

<p>SQL> delete from eygle.eygle where rownum <11;</p>

<p>10 rows deleted.</p>

<p>SQL> commit;</p>

<p>Commit complete.</p>

<p>SQL> select count(*) from eygle.eygle;</p>

<p>  COUNT(*)<br />
----------<br />
        10</p>

<p>SQL> select count(*) from eygle.eygle@mars;</p>

<p>  COUNT(*)<br />
----------<br />
        10</p>

<p>SQL> select * from v$version@mars;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi<br />
PL/SQL Release 10.2.0.1.0 - Production<br />
CORE    10.2.0.1.0      Production<br />
TNS for Solaris: Version 10.2.0.1.0 - Production<br />
NLSRTL Version 10.2.0.1.0 - Production</p>

<p>SQL> select * from v$version;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production<br />
PL/SQL Release 9.2.0.4.0 - Production<br />
CORE    9.2.0.3.0       Production<br />
TNS for Solaris: Version 9.2.0.4.0 - Production<br />
NLSRTL Version 9.2.0.4.0 - Production</p>

<p>SQL> </blockquote></p>

<p>本例未作全面测试，仅用于说明Oracle9iR2和Oracle10gR2之间的高级复制功能上可行。</p>

<p>-The End-<br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/10/oracle9i_oracle10g_replication.html</link>
<guid>http://www.eygle.com/archives/2006/10/oracle9i_oracle10g_replication.html</guid>
<category>Advanced</category>
<pubDate>Tue, 31 Oct 2006 14:27:16 +0800</pubDate>
</item>
<item>
<title>如何将复制队列表移出系统(SYSTEM)表空间</title>
<description><![CDATA[在Oracle的高级复制中，缺省的，Oracle会将所有复制的系统队列表（queue table）置于系统表空间之中。<br><br>

这种缺省设置非常不当，在管理不善的环境中，Oracle的队列表很可能扩展到几个G甚至几十个G，从而使得系统表空间的维护及极为困难，也不利于数据库性能。<br><br>

我在之前《<a href="http://www.eygle.com/archives/2006/09/plan_is_very_important.html">高级复制的整体规划也很重要</a>》一文中提到的就是这样一类情况。<br><br>

即使在Oracle10gR2 中，Oracle仍然没有改变:<br>
<blockquote><pre>
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production</pre></blockquote><br>

复制字典对象的存储地都是SYSTEM表空间:<br>
<blockquote><pre>
SQL> set linesize 120
SQL> col segment_name for a30
SQL> col segment_type for a20
SQL> col tablespace_name for a20
SQL> select segment_name,segment_type,tablespace_name,bytes/1024 
  2  from dba_segments where segment_name like '%DEF$_%';

SEGMENT_NAME                   SEGMENT_TYPE         TABLESPACE_NAME      BYTES/1024
------------------------------ -------------------- -------------------- ----------
DEF$_AQCALL                    TABLE                SYSTEM                       64
DEF$_AQERROR                   TABLE                SYSTEM                       64
DEF$_TRANORDER                 INDEX                SYSTEM                       64
DEF$_ERROR_PRIMARY             INDEX                SYSTEM                       64
DEF$_ERROR                     TABLE                SYSTEM                       64
DEF$_DESTINATION               TABLE                SYSTEM                       64
DEF$_DESTINATION_PRIMARY       INDEX                SYSTEM                       64
DEF$_CALLDEST                  TABLE                SYSTEM                       64
DEF$_CALLDEST_PRIMARY          INDEX                SYSTEM                       64
DEF$_CALLDEST_N2               INDEX                SYSTEM                       64
DEF$_DEFAULTDEST               TABLE                SYSTEM                       64

SEGMENT_NAME                   SEGMENT_TYPE         TABLESPACE_NAME      BYTES/1024
------------------------------ -------------------- -------------------- ----------
DEF$_DEFAULTDEST_PRIMARY       INDEX                SYSTEM                       64
DEF$_LOB                       TABLE                SYSTEM                       64
DEF$_LOB_PRIMARY               INDEX                SYSTEM                       64
DEF$_LOB_N1                    INDEX                SYSTEM                       64
DEF$_TEMP$LOB                  TABLE                SYSTEM                       64
DEF$_PROPAGATOR                TABLE                SYSTEM                       64
DEF$_PROPAGATOR_PRIMARY        INDEX                SYSTEM                       64
DEF$_ORIGIN                    TABLE                SYSTEM                       64
DEF$_PUSHED_TRANSACTIONS       TABLE                SYSTEM                       64
DEF$_PUSHED_TRAN_PRIMARY       INDEX                SYSTEM                       64

21 rows selected.</pre></blockquote><br>

一般我们建议，在初始创建数据库时，可以通过修改队列创建脚本<br>$ORACLE_HOME/rdbms/admin/catdefrt.sql 定义存储参数来更改创建地点。<br>
<br>
如果已经完成了创建，可以通过exp/imp等一系列手段迁移队列表。<br>

不过这些方法都需要停机时间，这对于一个上线的24x7的业务系统来说，通常都极为困难，所以最好的方法仍然是提前规划。<br>
<br>
-The End-
<br>


]]></description>
<link>http://www.eygle.com/archives/2006/09/move_queue_table_out_system.html</link>
<guid>http://www.eygle.com/archives/2006/09/move_queue_table_out_system.html</guid>
<category>Advanced</category>
<pubDate>Wed, 20 Sep 2006 17:51:19 +0800</pubDate>
</item>
<item>
<title>高级复制下如何强制删除废弃复制组</title>
<description><![CDATA[<p>在高级复制环境中，有时候某些复制组已经废弃。<br />
主体站点或主体定义站点已经不存在，db link也已经不存在或被重建。</p>

<p>在这种情况下，删除复制组将成为一个困难。<br />
我们的尝试很容易以以下错误告终。<br />
<blockquote>$ sqlplus repadmin/repadmin</p>

<p>SQL*Plus: Release 10.1.0.2.0 - Production on Tue Sep 19 16:54:10 2006</p>

<p>Copyright (c) 1982, 2004, Oracle.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production<br />
With the Partitioning, OLAP and Data Mining options</p>

<p>SQL> select gname, status from dba_repgroup;</p>

<p>GNAME                          STATUS<br />
------------------------------ ---------<br />
REP_TT                         QUIESCED</p>

<p>SQL> EXEC dbms_repcat.drop_master_repgroup(gname => 'REP_TT',<br />
  2  drop_contents => false,all_sites => false);<br />
BEGIN dbms_repcat.drop_master_repgroup(gname => 'REP_TT',<br />
		 drop_contents => false,all_sites => false); END;</p>

<p>*<br />
ERROR at line 1:<br />
ORA-23313: object group "PUBLIC"."REP_TT" is not mastered at<br />
EYGLE.HURRAY.COM.CN<br />
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105<br />
ORA-06512: at "SYS.DBMS_REPCAT_UTL4", line 2860<br />
ORA-06512: at "SYS.DBMS_REPCAT_MAS", line 2660<br />
ORA-06512: at "SYS.DBMS_REPCAT", line 635<br />
ORA-06512: at line 1</blockquote></p>

<p>我们可以查看一下dba_repgroup依赖的底层基本对象:<br />
<blockquote>SQL> set autotrace on explain<br />
SQL> select gname,status,owner from dba_repgroup;</p>

<p>GNAME                          STATUS    OWNER<br />
------------------------------ --------- ------------------------------<br />
REP_TT                         QUIESCED  PUBLIC</p>

<p><br />
Execution Plan<br />
----------------------------------------------------------<br />
   0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=2 Bytes=82)<br />
   1    0   NESTED LOOPS (OUTER) (Cost=2 Card=2 Bytes=82)<br />
   2    1     TABLE ACCESS (FULL) OF 'REPCAT$_REPCAT' (TABLE) (Cost=2<br />
          Card=2 Bytes=44)</p>

<p>   3    1     INDEX (UNIQUE SCAN) OF 'REPCAT$_FLAVORS_UNQ1' (INDEX (UN<br />
          IQUE)) (Cost=0 Card=1 Bytes=19)</blockquote></p>

<p>如果对系统状况足够了解和确认，我们可以直接从底层表'REPCAT$_REPCAT' 中删除这个复制组的信息:</p>

<blockquote>SQL> delete from system.REPCAT$_REPCAT;

<p>1 row deleted.</p>

<p>SQL> commit;</p>

<p>Commit complete.</p>

<p>SQL> select gname,status,owner from dba_repgroup;</p>

<p>no rows selected</blockquote></p>

<p>在进行这些操作之前，请做好备份，并做好确认。</p>

<p>这个故事告诉我们的是，做事情一定要遵循正确的步骤，即使失败了，也应该按照正常的步骤退回原点，否则留下的各类不完全操作可能为数据库留下种种隐患。</p>

<p>-The End-<br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/09/delete_repcat_repcat.html</link>
<guid>http://www.eygle.com/archives/2006/09/delete_repcat_repcat.html</guid>
<category>Advanced</category>
<pubDate>Wed, 20 Sep 2006 11:05:59 +0800</pubDate>
</item>
<item>
<title>高级复制下如何强制删除复制组</title>
<description><![CDATA[<p>在高级复制环境下，有时候由于一些故障，可能导致复制组删除时出现错误。</p>

<blockquote>$ sqlplus repadmin/repadmin

<p>SQL*Plus: Release 10.1.0.2.0 - Production on Tue Sep 19 10:34:30 2006</p>

<p>Copyright (c) 1982, 2004, Oracle.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production<br />
With the Partitioning, OLAP and Data Mining options</p>

<p>SQL> set linesize 120<br />
SQL> col sname for a10<br />
SQL> col gname for a10<br />
SQL> col schema_comment for a1<br />
SQL> col fname for a10<br />
SQL> col owner for a10<br />
SQL> select * from dba_repgroup;</p>

<p>SNAME      M STATUS    S GNAME      FNAME      R OWNER<br />
---------- - --------- - ---------- ---------- - ----------<br />
REP_TEST   Y NORMAL      REP_TEST              N PUBLIC</p>

<p>SQL> exec dbms_repcat.drop_master_repgroup(gname=>'rep_test',all_sites => true);<br />
BEGIN dbms_repcat.drop_master_repgroup(gname=>'rep_test',all_sites => true); END;</p>

<p>*<br />
ERROR at line 1:<br />
ORA-23353: deferred RPC queue has entries for object group "PUBLIC"."REP_TEST"<br />
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95<br />
ORA-06512: at "SYS.DBMS_REPCAT_MAS", line 1190<br />
ORA-06512: at "SYS.DBMS_REPCAT_MAS", line 2666<br />
ORA-06512: at "SYS.DBMS_REPCAT", line 635<br />
ORA-06512: at line 1</blockquote></p>

<p>这表明此时，在deftran中还有记录，而可能在deftrandest中已经没有需要push的事务</p>

<blockquote>SQL> select count(*) from deftran;

<p>  COUNT(*)<br />
----------<br />
         3</p>

<p>SQL> select count(*) from deftrandest;</p>

<p>  COUNT(*)<br />
----------<br />
         0</blockquote></p>

<p>正常情况下可以通过dbms_defer_sys.purge过程去清除队列。<br />
在异常情况下，我们可以选择直接截断(truncate)，强制删除复制组:<br />
<blockquote>SQL> truncate table system.def$_aqcall;</p>

<p>Table truncated.</p>

<p>SQL> exec dbms_repcat.drop_master_repgroup(gname=>'rep_test',all_sites => true);</p>

<p>PL/SQL procedure successfully completed.</blockquote><br />
此时可以进行其他操作，如恢复复制组等。</p>

<p>-The End-</p>

<p><br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/09/force_drop_master_repgroup.html</link>
<guid>http://www.eygle.com/archives/2006/09/force_drop_master_repgroup.html</guid>
<category>Advanced</category>
<pubDate>Tue, 19 Sep 2006 11:09:22 +0800</pubDate>
</item>
<item>
<title>高级复制的整体规划也很重要</title>
<description><![CDATA[<p>我们通常都知道数据库的整体规划非常重要，同样的，高级复制的规划也非常重要。</p>

<p>上周一个客户的高级复制环境出现问题，两边的复制组状态异常，一个主体站点的复制组处于QUIESCING状态，无法执行DML操作。</p>

<p>经过检查发现用户的队列表空间占用极大：<br />
<blockquote> SQL&gt; select segment_name,SEGMENT_TYPE,bytes/1024/1024,tablespace_name<br />
&nbsp; 2&nbsp; from dba_segments where bytes/1024/1024 &gt; 500;</p>

<p>SEGMENT_NAME&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SEGMENT_TYPE&nbsp; &nbsp; &nbsp;  BYTES/1024/1024 TABLESPACE_NAME<br />
----------------------------- ------------------ --------------- ---------------<br />
I_WRI$_OPTSTAT_IND_OBJ#_ST&nbsp; &nbsp; INDEX&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 699 SYSAUX<br />
WRI$_OPTSTAT_IND_HISTORY&nbsp; &nbsp; &nbsp; TABLE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 513 SYSAUX<br />
SYS_LOB0000004603C00003$$&nbsp; &nbsp;  LOBSEGMENT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  63637 SYSTEM<br />
SYS_LOB0000004603C00004$$&nbsp; &nbsp;  LOBSEGMENT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1540 SYSTEM<br />
DEF$_LOB&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TABLE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  4330 SYSTEM<br />
DEF$_AQCALL&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  TABLE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  3762 SYSTEM<br />
SYS_LOB0000058045C00106$$&nbsp; &nbsp;  LOBSEGMENT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  15133 USERS<br />
SYS_LOB0000058012C00025$$&nbsp; &nbsp;  LOBSEGMENT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4394 USERS</p>

<p>8 rows selected.</blockquote></p>

<p>而且一些大对象占用了系统表空间大量的空间。<br />
最重要的队列表DEF$_AQCALL已经扩展到了3762M大小，这显然为管理和维护带来了麻烦，而且在Oracle10gR1中，高级复制的对象仍然位于SYSTEM表空间，这是一个极大的问题，实际上在创建之初我们就应该将这些对象分离到SYSAUX表空间或其它独立的表空间，减少对于系统表空间的冲击。</p>

<p>这些问题加上用户的一些不当操作，最终导致了数据库故障。<br />
而且这个环境相当复杂，Oracle10gR1 + Crs + ASM 的2套RAC环境间的高级复制，处理过程着实花了一番功夫。</p>

<p>最后体会深刻的是，<strong>不管哪一项技术，前期的规划都极其重要，如果规划不当，后期的问题将会曾出不穷。</strong></p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/09/plan_is_very_important.html</link>
<guid>http://www.eygle.com/archives/2006/09/plan_is_very_important.html</guid>
<category>Advanced</category>
<pubDate>Mon, 18 Sep 2006 11:32:59 +0800</pubDate>
</item>
<item>
<title>高级复制ORA-25207错误解决</title>
<description><![CDATA[<p>这些天在处理一个高级复制的问题，重新学习了一下高级复制的相关知识。<br />
感觉又有了一些新的体会很进步。</p>

<p>如果有时间，就把遇到的一些问题整理出来，不过遇到了实在太多的问题。</p>

<p>在重建高级复制的队列表时曾经出过这样一个错误:<br />
<blockquote>SQL> delete from eygle.test;<br />
delete from eygle.test<br />
*<br />
ERROR at line 1:<br />
ORA-25207: enqueue failed, queue SYSTEM.DEF$_AQCALL is disabled from enqueueing</blockquote></p>

<p>这个错误通常是因为某些异常而导致了队列停顿，一般不建议手工处理复制字典表，解决这个错误很简单，启动队列即可：<br />
<blockquote>SQL> exec dbms_aqadm.start_queue('SYSTEM.DEF$_AQCALL',true,true);</p>

<p>PL/SQL procedure successfully completed.</blockquote></p>

<p>此时数据库可以恢复正常，复制对象可以正常操作：</p>

<blockquote>SQL> delete from eygle.test;

<p>20 rows deleted.</p>

<p>SQL> commit;</p>

<p>Commit complete.</blockquote></p>

<p>如果队列不能正常启动，则可能需要重建，会麻烦许多。</p>

<p>-The End-<br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/09/start_queue_ora_25207.html</link>
<guid>http://www.eygle.com/archives/2006/09/start_queue_ora_25207.html</guid>
<category>Advanced</category>
<pubDate>Thu, 14 Sep 2006 14:22:04 +0800</pubDate>
</item>
<item>
<title>Oracle10g Materialized View enhanced</title>
<description><![CDATA[<p>今天<a href="http://blog.dbform.com/">Kamus</a>在Gtalk上让我帮忙测试,是关于物化视图的:</p>
<ol>
    <li>truncate分区以后，物化视图快速刷新出错 </li>
    <li>drop分区以后，物化视图快速刷新出错 </li>
</ol>
<p>测试Oralce9i的情况:</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; create table T_PART<br />&nbsp; 2&nbsp; (<br />&nbsp; 3&nbsp;&nbsp;&nbsp; C1 NUMBER,<br />&nbsp; 4&nbsp;&nbsp;&nbsp; C2 NUMBER,<br />&nbsp; 5&nbsp;&nbsp;&nbsp; C3 NUMBER<br />&nbsp; 6&nbsp; )<br />&nbsp; 7&nbsp; partition by range (C2)<br />&nbsp; 8&nbsp; (<br />&nbsp; 9&nbsp;&nbsp;&nbsp; partition T_P2 values less than (20)<br />&nbsp;10&nbsp; ,<br />&nbsp;11&nbsp;&nbsp;&nbsp; partition T_P3 values less than (30)<br />&nbsp;12&nbsp; )<br />&nbsp;13&nbsp; ;</pre>
            <pre>Table created.<br />SQL&gt; insert into t_part values(1,2,3);</pre>
            <pre>1 row created.</pre>
            <pre>SQL&gt; insert into t_part values(1,25,3);</pre>
            <pre>1 row created.</pre>
            <pre>SQL&gt; insert into t_part values(1,18,3);</pre>
            <pre>1 row created.</pre>
            <pre>SQL&gt; commit;</pre>
            <pre>Commit complete.</pre>
            <pre>SQL&gt; create materialized view log on t_part with rowid;</pre>
            <pre>Materialized view log created.</pre>
            <pre>SQL&gt; create materialized view mv_t_part refresh with rowid as select * from t_part;</pre>
            <pre>Materialized view created.</pre>
            <pre>SQL&gt; select * from t_part;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C3<br />---------- ---------- ----------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3</pre>
            <pre>SQL&gt; select * from mv_t_part;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C3<br />---------- ---------- ----------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3</pre>
            <pre>SQL&gt; alter table t_part truncate partition t_p2;</pre>
            <pre>Table truncated.</pre>
            <pre>SQL&gt; exec dbms_mview.refresh('mv_t_part','f');<br />BEGIN dbms_mview.refresh('mv_t_part','f'); END;</pre>
            <pre>*<br />ERROR at line 1:<br />ORA-32313: REFRESH FAST of &quot;SYS&quot;.&quot;MV_T_PART&quot; unsupported after PMOPs<br />ORA-06512: at &quot;SYS.DBMS_SNAPSHOT&quot;, line 794<br />ORA-06512: at &quot;SYS.DBMS_SNAPSHOT&quot;, line 851<br />ORA-06512: at &quot;SYS.DBMS_SNAPSHOT&quot;, line 832<br />ORA-06512: at line 1</pre>
            </td>
        </tr>
    </tbody>
</table>
<p>这里出现错误。</p>
<p><strong>ORA-32313 REFRESH FAST of &quot;<em class="Italic">string</em>&quot;.&quot;<em class="Italic">string</em>&quot; unsupported after PMOPs<br /></strong></p>
<dd class="MH1"><a name="932147"></a>
<p><strong>Cause:</strong> A Partition Maintenance Operation (PMOP) has been performed on a detail table, and the specified materialized view does not support fast refersh after PMOPs.</p>
</dd><dd class="MH2"><a name="932149"></a>
<p><strong>Action:</strong> Use REFRESH COMPLETE. You can determine why your materialized view does not support fast refresh after PMOPs using the DBMS_MVIEW.EXPLAIN_MVIEW() API.</p>
<p>再来测试Oracle10g的:</p>
</dd>]]></description>
<link>http://www.eygle.com/archives/2005/12/oracle10g_materialized_view_enhanced.html</link>
<guid>http://www.eygle.com/archives/2005/12/oracle10g_materialized_view_enhanced.html</guid>
<category>Oracle10g</category>
<pubDate>Tue, 13 Dec 2005 23:14:51 +0800</pubDate>
</item>
<item>
<title>Oracle高级复制的创建配置步骤-Step by Step</title>
<description><![CDATA[本例涉及两个站点.<br>
主体定义站点:AVATAR.COOLYOUNG.COM.CN<br>
主体站点:AUTHAA.COOLYOUNG.COM.CN<br>
注:主体定义站点指配置复制工作的站点<br>
<br>
本例涉及的用户.<br>
复制管理员:repadmin<br>
应用用户:hawa<br>

本例复制的对象:hw_test 数据表<br>
本例的先决条件:你需要设置好相应的参数,job_queue_processes需要大于0,global_name=true,并且建立相应的db link.<br>
这些具体可以参考:<a href="http://www.eygle.com/pdf/Advanced.Replication.Research.by.Kamus.pdf">高级复制的初步研究</a>一文.<br><br>



1.在主体定义站点复制用户下创建复制对象<br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> select * from global_name;

GLOBAL_NAME
-----------------------------------------------------------
AVATAR.COOLYOUNG.COM.CN

SQL> connect hawa/password
Connected.
SQL> create table hw_test as select * from hw_online;

Table created.

SQL>  select count(*) from hw_test;

  COUNT(*)
----------
       464

SQL> alter table hw_test add (constraint pk_userid primary key (numuserid));

Table altered.
</pre></td></table><br>


2.在主体站点同样创建复制对象<br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> select * from global_name;

GLOBAL_NAME
------------------------------------------------------------------------
AUTHAA.COOLYOUNG.COM.CN

SQL> connect hawa/password
Connected.
SQL> create table hw_test as select * from hw_online;

Table created.

SQL> select count(*) from hw_test;

  COUNT(*)
----------
         0
</pre></td></table><br>

         
3.在主体站点手工同步数据<br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> connect repadmin/password

Connected.
SQL> insert into hawa.hw_test select * from hawa.hw_test@avatar;

464 rows created.

SQL> commit;

Commit complete.
</pre></td></table><br>


4.在主体定义站点开始操作<br>

登陆主体定义站点<br>
<table><td width="500" bgcolor="#999999"> <pre>
$ sqlplus repadmin/password

SQL*Plus: Release 9.2.0.4.0 - Production on Mon Jun 27 09:32:36 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> select * from global_name;

GLOBAL_NAME
----------------------------------------------------------------------------
AVATAR.COOLYOUNG.COM.CN
</pre></td></table><br>


创建复制组:<br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> execute dbms_repcat.create_master_repgroup('rep_hh');

PL/SQL procedure successfully completed.

SQL> select gname,master,status from dba_repgroup where gname='REP_HH';

GNAME                          M STATUS
------------------------------ - ---------
REP_HH                         Y QUIESCED

</pre></td></table><br>

]]></description>
<link>http://www.eygle.com/archives/2005/06/oraclessoeaeaeo.html</link>
<guid>http://www.eygle.com/archives/2005/06/oraclessoeaeaeo.html</guid>
<category>Advanced</category>
<pubDate>Mon, 27 Jun 2005 09:34:22 +0800</pubDate>
</item>
<item>
<title>如何使用Oracle全文检索功能?</title>
<description><![CDATA[本文简要说明全文检索功能的使用，不做太多的具体说明。<br>
仅供参考使用方法。<br>

1.授权<br>
对具体使用全文检索的用户授权.<br>

<table><td width="500" bgcolor="#999999"> <pre>
$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Sun May 15 20:00:10 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> grant ctxapp to club;

Grant succeeded.


SQL> connect ctxsys/password
Connected.
SQL> grant execute on ctx_ddl to club;

Grant succeeded.
</pre></td></table><br>

2.使用应用用户连接<br>

创建域索引<br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> connect club/password
Connected.

SQL> begin ctx_ddl.create_preference('club_lexer','chinese_vgram_lexer'); end;
  2  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.03

SQL> create index id_cont_msg 
  2  on jivemessage ( SUBJECT ) indextype is ctxsys.context parameters('lexer club_lexer'); 

Index created.

Elapsed: 00:01:22.42

SQL> select count(*) from jivemessage where contains(subject,'幸福')>0;

  COUNT(*)
----------
      1847

Elapsed: 00:00:00.17
SQL> select count(*) from jivemessage where subject like '%幸福%';

  COUNT(*)
----------
      1841

Elapsed: 00:00:02.89
</pre></td></table><br>

3.检索比较<br>
以下是一个全文检索的示例，我们检索'abc'，那么全文检索可以把包含'abc'的任何变化组合都查询出来，包括大小写、全半角，而如果用单纯的SQL实现同样的结果，则需要多次like之后union all，其性能差距是不可想象的。<br>

全文检索在类似文本模糊查询上具有极大的优势。当然也可能存在问题，即词法分析器是否准确，会否漏掉部分内容等。<br>
总的说来，<strong>满足需求的技术就是好的技术，是否使用一项技术应该通过实践来检验.<</strong>br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> select subject from jivemessage where contains(subject,'abc') >0;

SUBJECT
--------------------------------------------------------------------------------
【游戏】 把你的名字的首字母用智能ABC打出，看能出来什么？
游戏——把你的名字首字母用智能ABC打出来
智能ABC暗藏杀机
ABC
ABC
ABC
ABC
ABC
ＡＢＣ
哈哇abc
abc

SUBJECT
--------------------------------------------------------------------------------
abc
ABC
振奋爱的激情方案ABC
智能ABC的错吗？
ABC全选
瓜果美容ABC
经典英文歌曲ABC，不好你拿版砖砍我，好就回帖顶一下！
初夜abc
Re: abc
Re: abc
Re: abc

SUBJECT
--------------------------------------------------------------------------------
abc
测试发贴""abc
abc

25 rows selected.

Elapsed: 00:00:00.04
</pre></td></table><br>]]></description>
<link>http://www.eygle.com/archives/2005/06/ecieoaoracleeia.html</link>
<guid>http://www.eygle.com/archives/2005/06/ecieoaoracleeia.html</guid>
<category>HowTo</category>
<pubDate>Sat, 11 Jun 2005 00:33:21 +0800</pubDate>
</item>
<item>
<title>如何手工安装Oracle全文检索工具?</title>
<description><![CDATA[在Oracle9i Rlease2中，Oracle的全文检索技术被称为:Oracle Text，功能十分强大。Oracle Text是Oracle9i采用的新名称，在Oracle8/8i中它被称作Oracle interMedia Text，在Oracle8以前它的名称是Oracle ConText Cartridge。<br>

Oracle Text组件可以在安装数据库的时候选择，缺省是安装的，如果没有安装，那么可以按照以下方式手动安装Oracle Text。<br>

1.创建存储表空间<br>
<table><td width="500" bgcolor="#999999"> <pre>
$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Sun May 15 19:54:48 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/h2love/oracle/system01.dbf
/h2love/oracle/undotbs01.dbf
/h2love/oracle/users01.dbf
...

9 rows selected.

SQL> create tablespace oratext
  2  datafile '/h2love/oracle/oratext01.dbf' size 100m
  3  extent management local uniform size 128k
  4  ;      

Tablespace created.
</pre></td></table><br>


2.创建相关对象<br>
]]></description>
<link>http://www.eygle.com/archives/2005/06/ecieoeoracleeia.html</link>
<guid>http://www.eygle.com/archives/2005/06/ecieoeoracleeia.html</guid>
<category>Advanced</category>
<pubDate>Sat, 11 Jun 2005 00:17:55 +0800</pubDate>
</item>
<item>
<title>高级复制/物化视图复制中ORA-23313错误解决一例</title>
<description><![CDATA[原问题可以参考Itpub帖子:<br>
<a href="http://www.itpub.net/372872.html">http://www.itpub.net/372872.html</a><br>

在进行复制组创建的过程中出现如下错误:<br>

<table><td width="500" bgcolor="#999999"> <pre>
SQL> begin
2 dbms_repcat.create_mview_repgroup(
3 gname=>'reptest',
4 master=>'db001.d-link',
5 propagation_mode => 'ASYNCHRONOUS');
6 end;
7 /
begin
*
ERROR 位于第 1 行:
ORA-23313: 在 PUBLIC 没有控制对象组 "REPTEST"."db001.d-link"
ORA-06512: 在"SYS.DBMS_SYS_ERROR", line 105
ORA-06512: 在"SYS.DBMS_REPCAT_SNA_UTL", line 1690
ORA-06512: 在"SYS.DBMS_REPCAT_SNA", line 64
ORA-06512: 在"SYS.DBMS_REPCAT", line 1262
ORA-06512: 在line 2
</pre></td></table><br>

反复检查后发现问题还是出现在db link上，在测试中发现:<br>
<table><td width="500" bgcolor="#999999"> <pre>
SQL> connect system/pass@db002  ;
已连接。
SQL> select owner,db_link from dba_db_links ;

OWNER      DB_LINK
---------- --------------------
PUBLIC     DB001.Q-LINK
MVADMIN    DB001.Q-LINK
DEV001     DB001.Q-LINK

SQL> connect system/pass@db001 ;
已连接。
SQL> select owner,db_link from dba_db_links ;

OWNER      DB_LINK
---------- --------------------
PUBLIC     DB002.Q-LINK
REPADMIN   DB002.Q-LINK

SQL> connect mvadmin/pass@db002
已连接。
SQL> select * from dev001.test001@db001 ;

         A B
---------- --------------------
         1 wanghui
         2 zhangyun

SQL> select * from dev001.test001@db001.q-link ;
select * from dev001.test001@db001.q-link
                                    *
ERROR 位于第 1 行:
ORA-00933: SQL 命令未正确结束


SQL>
</pre></td></table><br>

当引用类似"db001.q-link"的db link时，Oracle出现错误，这时候我怀疑"-"这个特殊字符Oracle在db link 中无法正确识别。<br>

告诉他加上双引号("")，也就是:<br>
<table><td width="500" bgcolor="#999999"> <pre>
select * from dev001.test001@"db001.q-link" ;
</pre></td></table><br>

此时结果正常。<br>

Ok，现在我基本确认是域名的问题。<br>
]]></description>
<link>http://www.eygle.com/archives/2005/06/ssoeiieeoioeoeo.html</link>
<guid>http://www.eygle.com/archives/2005/06/ssoeiieeoioeoeo.html</guid>
<category>Advanced</category>
<pubDate>Wed, 08 Jun 2005 11:13:52 +0800</pubDate>
</item>
<item>
<title>高级复制中如何应对主体站点故障</title>
<description><![CDATA[在同步复制中<br>
<span class="myunderlineHL">一旦任意主体站点出现故障，数据库将会出现问题。</span><br>
<br>
<table><td width="500" bgcolor="#999999"><pre>
SQL> select * from scott.dept;

DEPTNO DNAME          LOC
------ -------------- -------------
    10 ACCOUNTING     NEW YORK
    20 RESEARCH       DALLAS
    30 SALES          CHICAGO
    40 OPERATIONS     BOSTON
    33 ORACLE         beijing
    35 Oracle         Beijing

6 rows selected

SQL> 
</pre></td></table><br>
此时DML操作不能进行<br>]]></description>
<link>http://www.eygle.com/archives/2005/02/ssoeoeecioooeio.html</link>
<guid>http://www.eygle.com/archives/2005/02/ssoeoeecioooeio.html</guid>
<category>Advanced</category>
<pubDate>Fri, 18 Feb 2005 11:27:11 +0800</pubDate>
</item>


</channel>
</rss>