Tip: 看不到本站引用 Flickr 的图片? 下载 Firefox Access Flickr 插件 | AD: 订阅 DBA notes -- ![]()
2010-06-10 Thu
- Michael Dirolf: MongoDB @ E-VAN ¶
-
In case you have 80+ minutes for a MongoDB video:
- Kyle Banker: The MongoDB Metamorphosis: Data as Documents ¶
-
A presentation on MongoDB data model and the benefits and implications of using a document database. Topics covered: rich documents, simplifying relations, relationships as embed vs reference, e-commerce (nb we’ve already posted about E-Commerce apps with MongoDB
- Ted Neward: Going NoSQL with MongoDB, Part 2 ¶
-
Ted introduces the reader to a different approach to getting used to a new product/concept: exploration tests:
In this article, we’ll use a slightly different method to investigate MongoDB (or any technology). The procedure, called an exploration test, will help us find a possible bug in the server and, along the way, highlight one of the common issues object-oriented developers will run into when using MongoDB.
As a side note, the so called issue Ted is mentioning has nothing to do with MongoDB but with the way tests should be designed.
I just wrote a large post on reasons for innodb main tablespace excessive growth and I thought it would make sense to explain briefly of why it is so frequently you have purge not being the problem at all and when out of no where you can see purge thread being unable to keep up and undo table space explodes and performance drops down. Here is what happens.
When you have typical OLTP system with small transactions your UNDO space is small and it fits in buffer pool. In fact most of the changes do not need to go to the disk at all – the space for undo space is allocated, used and freed without ever needing to go to the disk.
Now when you have spike in writes or long running transactions which increases your undo space size it may be evicted from buffer pool and stored on disk. This is when problems often starts to happen. Now instead of purge thread simply operating in memory it has to perform IO which slows it down dramatically and makes it unable to handle amount of changes coming in.
The solution to this problem may range from pacing the load (which is helpful for batch job operations as it can be controlled), using innodb_max_purge_lag or enable separate purge thread (or threads) via innodb_use_purge_thread if you’re running Percona Server.
Entry posted by peter | No comment
Kaya 发表于 os2ora.com
RWP(Oracle RealWorld Database Performance Group)准备在中国多招一员干将,有没朋友有兴趣。工作地点最好在深圳,北京也可以接受。工作内容主要在于性能调优(OLTP/OLAP)还有可扩展性方面,希望有这方面比较丰富的经验。
仅仅是先做个不正式的预告,不过有兴趣&&有疑问的朋友也可以给我发邮件。
So you're running MySQL With innodb_file_per_table option but your ibdata1 file which holds main (or system) tablespace have grown dramatically from its starting 10MB size.
What could be the reason of this growth and what you can do about it ?
There are few things which are always stored in main tablespace - these are system tables, also known as data dictionary - table and index definitions and related stuff, double write buffer, insert buffer which temporary stores records to be inserted in the index tree and undo segment holding previous versions of changed rows.
The system tables size depends on the number and complexity of the tables you have in the system. If you have hundreds of thousands of tables it may consume gigabytes of space but for most installations we're speaking about tens of megabytes or less. Double Write Buffer is fixed size (2MB = 128 of 16KB pages) and so will not affect growth of your main Innodb Tablespace. Insert Buffer size is also restricted to half of the buffer pool size (can be changed via innodb_ibuf_max_size option) which can be significant size for systems with large amount of memory. Finally undo space can grow unbound depending on your transaction size.
The challenge is both Insert buffer and undo space will grow and shrink during the database operation and unless you can them on being large your would not know what caused your system tablespace size to explode - they will shrink to the normal size and all what you have will be free space, which you unfortunately can't reclaim without reloading tour database. This is where Trending can help, for example MySQL CACTI Templates will have the graphs you need.
If you're looking at SHOW INNODB STATUS this is how you can see Insert Buffer Size:
-
Ibuf: size 108931, free list len 64619, seg size 173551,
In this case we can see the segment is allocated to 173551 pages which is about 2.7GB only about 2/3 of it is in use right now but for sake of monitoring tablespace size you need a full allocated number.
Lets now look at the Undo Space which is a lot more interesting (and which is the most likely cause of getting extremely large system tablespace)
The records can be stored in the undo tablespace for 2 reasons. First it is re
-
History list length 4000567
In this case the History Length is about 4 million which means there are 4 million of transactions which are not yet purged. This is not very helpful as single transaction may modify single row and so be responsible for one undo entry or it may modify millions of rows. Row size can also vary a lot. For many OLTP applications though which have a lot of tiny transactions this is a very good indicator.
If you're running Percona Server the following can be helpful:
-
mysql> SELECT * FROM innodb_rseg;
-
+---------+----------+----------+---------+------------+-----------+
-
| rseg_id | space_id | zip_size | page_no | max_size | curr_size |
-
+---------+----------+----------+---------+------------+-----------+
-
| 0 | 0 | 0 | 6 | 4294967294 | 20993 |
-
+---------+----------+----------+---------+------------+-----------+
-
1 row IN SET (0.00 sec)
curr_size will display the current size of RSEG which defines undo segment size, though there is a complex data structure and you can't easily convert this number to number of data pages for undo slots or number of rows stored.
From the practical standpoint there are 3 reasons a lot of undo space may be required:
Running Transaction which does a lot of changes - If transaction modifies a lot of rows it has to use a lot of space in undo segment and there is no way around it. Be careful in particular with update or delete transactions which go over a lot of rows. In many cases doing such processes in chunks, updating/deleting may be thousands of rows per transaction may be better if your application can handle it. Note ALTER TABLE will not require excessive amount of undo space even for very large tables as it internally commits every 10000 rows.
Running Very Long Transaction If you're running very long transaction, be it even SELECT, Innodb will be unable to purge records for changes which are done after this transaction has started, in default REPEATABLE-READ isolation mode. This means very long transactions are very bad causing a lot of garbage to be accommodated in the database. It is not limited to undo slots. When we're speaking about Long Transactions the time is a bad measure. Having transaction in read only database open for weeks does no harm, however if database has very high update rate, say 10K+ rows are modified every second even 5 minute transaction may be considered long as it will be enough to accumulate about 3 million of row changes.
Purge Thread Falling Behind This is the most dangerous reason. It is possible for database updates happen faster than purge thread can purge records when they are no more needed which means undo space can just grow until it consumes all free space (or specified max size for ibdata1 file). "Good" thing is performance typically starts to suffer terribly well before that and it gets noticed. There are to things you can do about this problem first you can use innodb_max_purge_lag to make a threads doing modifications slow down if purge thread can't keep up. This however does not work in all cases. If you're running XtraDB you can also use innodb_use_purge_thread to use dedicated purge thread, which works a bit faster as it does not need to compete with other activities of main theread. You can also use more than one purge thread by setting this variable to higher values though this functionality is a bit experimental.
One related question I get asked often is why Master and Slave may get so much different table space size in the end. The answer is of course their workload is very different. On one hand slave has all updates going from one thread so it has less chance for purge thread to fall behind, on other a lot of people use slave for very long queries which may make long transactions reasons a lot more likely. So it can be both - either master or slave can have it main tablespace growing larger than its counterpart.
Writing this blog post I also discovered even in XtraDB we do not have as much transparency in regards to undo space and purging as I would like. I filed number of feature requests and I hope we'll have a chance to fix this soon.
Entry posted by peter | One comment
One of the most often heard questions about CouchDB is how do I scale CouchDB? While dealing with Google-size data is not really a problem many are facing, more and more engineers are looking for viable solutions for having less SPOFs in their systems.
We already know that starting with CouchDB 0.11.0 its support for replication became extremely smart allowing us to think about a future of CouchDB-backed distributed web data.
But replication is just one part of scaling. One other part which is more related to the size of data is data partitioning or sharding and I think that the question about how to scale CouchDB is mostly referring to it. So, let’s see what options are there for sharding CouchDB.
Right now, probably the best known solution for addressing CouchDB sharding is ☞ Lounge, a solution developed by the Meebo.com team:
The Lounge is a proxy-based partitioning/clustering framework for CouchDB.
There are two main pieces:
- dumbproxy: An NGINX module to handle simple gets/puts for everything that isn’t a view.
- smartproxy: A python/twisted daemon that handles mapping/reducing view requests to all shards in the cluster.
Another solution in this space is ☞ Pillow. While ☞ still young it shows a lot of promise:
While manually repartitioning a CouchDB database is doable, I’d rather have an automatic way of doing it since I don’t want to make mistakes. […]
Now I’ve released version 0.3 of Pillow. This version supports automatic resharding, routing of requests to the right shard and views. Reducers need to be written in erlang, but a summing reducer is in place and mappers without reducers are supported out of the box. As such, this version of Pillow has all the functionality I set out to develop, but it does not support the full CouchDB API.
A more generic solution for partitioning data can be built using the Twitter’s ☞ Gizzard framework for creating distributed datastores:
As per the above diagram, Gizzard would become the “smart” middleware that would handle data distribution between the different stores. There are quite a few interesting features available in Gizzard that can make it a good candidate for dealing with the data partitioning problem: programmable support for partitioning strategies, support for replication trees, fault-tolerance, winged migrations, just to name a few.
Last, but not least, during the Berlin Buzzwords conference, I have also heard about another solution that is in the works and will be released soon.
So, having quite a few possible solutions already available, scaling CouchDB should not be considered an issue anymore.
Basho team has ☞ announced the release of Riak 0.11.0 which features a couple enhancements and bug fixes. But more importantly the new Riak 0.11.0 is using in-house developed Bitcask storage so replacing the embedded InnoDB store and other previously available options.
As a side note, Chef cookbooks for Riak have also been ☞ updated and Basho also released their internal ☞ benchmark code.
Bitcask has been ☞ announced a while ago as a solution developed to address the following goals:
- low latency per item read or written
- high throughput, especially when writing an incoming stream of random items
- ability to handle datasets much larger than RAM w/o degradation
- crash friendliness, both in terms of fast recovery and not losing data
- ease of backup and restore
- a relatively simple, understandable (and thus supportable) code structure and data format
- predictable behavior under heavy access load or large volume
- a license that allowed for easy default use in Riak
Jeff Darcy has some ☞ very good things to say about Bitcask, so I’ve spent some time reading the ☞ technical paper (pdf). While not an expert in either Bitcask or BerkleyDB/Java I have found the top level goals and some of the implementation details quite similar, but I’m pretty sure there are some subtle differences as BerkleyDB is referred to in the paper (nb maybe it was just about the license).
Oracle SaaS for ISVs Software Licensing and Pythian Services Provide Flexible, Convenient, Scalable, Low-risk Solution to Plan, Deploy, Manage Oracle Database Infrastructures
PYTHIAN NEWS UPDATE
Contact Vanessa Simmons for media inquiries
The Pythian Group Inc., the leading provider of remote database infrastructure services, today announced that it is teaming with Oracle® to provide Independent Software Vendors (ISVs) with a convenient and flexible all-in-one solution for licensing Oracle products and Pythian services required to correctly plan, deploy and manage the ISV’s database infrastructure.
With this new utility-based model, Oracle and Pythian have significantly lowered the barrier to entry for ISVs who wish to acquire Oracle technology and Pythian database services, by offering product and service in a straightforward and predictable monthly fashion, which lowers an ISV’s upfront business risk.
“Through Oracle SaaS for ISVs program, Oracle Partners can now scale their license investment based on monthly usage when deploying SaaS applications,” said, Kevin O’Brien, senior director, ISV and SaaS Strategy, Oracle.
“The key to this approach is that the ISV can scale their software and service use, either up or down without financial risk or penalty. ISVs who wish to work on the Oracle platform are well positioned to take advantage of such a SaaS model,” said Andrew Waitman, Chief Executive Officer at Pythian. “To be able to obtain industry leading software and expert service that scales as their business does, is very appealing for an ISV, particularly if they are launching a new product or service offering and want to ease into it.”
Pythian, a Platinum Level partner in the Oracle® PartnerNetwork (OPN), has been providing organizations with a utility-style database services model to plan, deploy, and manage their Oracle infrastructures for nearly ten years, and recently extended its service offerings to ISVs through the launch of a new ISV Partner Program.
Read the SaaS for ISV program details or email us to discuss our experience if you’re considering a major product upgrade, thinking about moving from an on-premise to a SaaS delivery model, suffering from performance issues, experiencing customer support issues which are often DBMS related, seeking an alternative DBMS platform, or are lacking database architecture or modeling expertise internally.
WEBINAR: ISVs can register to join Pythian on July 14, 2010 at 12:00 pm ET for a Database Deployment Success for ISVs Webinar to learn about the unique challenges faced by ISVs associated with databases and their management using real-world examples, benefits of the Pythian ISV Partner Program, how to offer a managed service for an application, and about Oracle’s SaaS software licensing for ISVs.
About Pythian
Pythian is a trusted global database and application infrastructure services company for Oracle, Oracle Applications, MySQL and SQL Server. Since 1997, companies have entrusted Pythian to keep their database infrastructures running efficiently while assisting organizations in strategically aligning their IT with business goals. Pythian’s unparalleled DBA skills, mature methodologies, best practices and tools enable clients to do more with fewer resources. Pythian’s corporate headquarters is in Ottawa Canada, with offices worldwide. To find out more visit
About the Oracle PartnerNetwork
Oracle PartnerNetwork (OPN) Specialized is the latest version of Oracle’s partner program that provides partners with tools to better develop, sell and implement Oracle solutions. OPN Specialized offers resources to train and support specialized knowledge of Oracle products and solutions and has evolved to recognize Oracle’s growing product portfolio, partner base and business opportunity. Key to the latest enhancements to OPN is the ability for partners to differentiate through Specializations. Specializations are achieved through competency development, business results, expertise and proven success.
Trademarks
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Media Contact:
Vanessa Simmons
Director of Marketing
P: 613.565.8696 ext. 208
C: 613.897.9444
The guys from PlayNice.ly, which are building a bug tracker that uses Redis for storing all app data (users, projects, bugs, comments, audit data, etc.), have posted recently ☞ here and ☞ here about their work to support search within their product.
While the general idea is to simply store the inverted index into Redis, there are a couple of interesting things to be noted:
- Redis native support for
SETdata type and its set operations (union, intersection, difference) makes working with Redis stored reversed indexes pretty handy - While you might be tempted to use every term as an index key, this will not work with fuzzy searches (i.e. searches for the word “numbers” will not contain documents containing the word “number”). Using “smart keys” — the article mentions using phonetic algorithms for calculating the keys; another solution can employ stemming algorithms — will help you reduce the number of index keys and also to perform fuzzy searches
- Building a good API for working with a custom solution will make things feel more natural.
Anyways, before consider this problem completely solved there are a couple of additional things that you should keep in mind:
-
index updates: there are many different scenarios in which you’ll have to update the inverted index and this can raise different problems starting with:
- the increased number of operations (writes explosion) and rountrips to the storage
- dealing with concurrent updates
- index size (or data explosion) : even if the number of keys in the index is limited, the total amount of data stored will grow over time with the number of source documents. Keeping in mind that Redis stores all data in memory the hardware requirements for your machine will be higher. The upcoming Redis version will help alleviate this issue by introducing Redis virtual memory about which you can read more here.
Full text indexing is definitely not a new problem in the NoSQL space and there are different approaches to tackle it. Pick yours carefully!
Logical standby would be more mature and popular in future, i did some test about some feathures behavior in Oracle11g logical standby env.
Here is conclusion.
1) Text index is not FULLY support. It’s only Partially support. But it can be maintained on logical standby via SQL apply.
2) ROWID datatype are not supported in logical standby, you will see “ORA-16129: unsupported dml encountered” when it’s ignored by logical standby
3) Rows in compressed table can be replicated to logical standby.
4)virtual column and related function based index is also supported by logical standby
5)Logical standby will replicate “analyze table” statement from primary to standby, not copy statistics in dictionary from primary to standby.
6)Online redefinition is supported
7)Outline is supported. But manually updates in outln schema is not replicated to logical standby.
8)Oracle replicate sequence value very well and make sence.
9)During convert to some character set, we need to do convert on both databases.
10)System trigger like “after logon”or “after startup” is also supported on logical standby side.
i did some test about some feathures behavior in Oracle11g logical standby env.
Here is conclusion.
1) Text index is not FULLY support. It’s only Partially support. But it can be maintained on logical standby via SQL apply.
2) ROWID datatype are not supported in logical standby, you will see “ORA-16129: unsupported dml encountered” when it’s ignored by logical standby
3) Rows in compressed table can be replicated to logical standby.
4)virtual column and related function based index is also supported by logical standby
5)Logical standby will replicate “analyze table” statement from primary to standby, not copy statistics in dictionary from primary to standby.
6)Online redefinition is supported
7)Outline is supported. But manually updates in outln schema is not replicated to logical standby.
8)Oracle replicate sequence value very well and make sence.
9)During convert to some character set, we need to do convert on both databases.
10)System trigger like “after logon”or “after startup” is also supported on logical standby side.
————————————see more detail beow————————————————————-
1) Text index is not FULLY support. It’s only Partially support. But it can be maintained on logical standby via SQL apply.
Per OTN document, Logical standby databases do not support the following datatypes:
BFILE
Collections (including VARRAYS and nested tables)
Multimedia data types (including Spatial, Image, and Oracle Text)
ROWID, UROWID
User-defined types
XMLType stored as Object Relational
Binary XML
below is simple test to show how oracle handle TEXT index.
Step 1) creaet text index on primary
SQL> select * from document;
ID TITLE
———- —————————————-
1 house tax start
2 global economy will twice drop
3 people lost jobSQL> create index document_ctx on document(title) indextype is ctxsys.ctxcat;
Index created.SQL> select * from tab;
TNAME TABTYPE
—————————-
DOCUMENT TABLE
DR$DOCUMENT_CTX$I TABLESQL> select * from document where catsearch(title,’tax’,”)>0;
ID TITLE
———- —————————————-
1 house tax start
Step 2) Check if index is replicated to logical standby,
on logical standby, we see objects DR$ is created.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
——————– ——————— ———-
DOCUMENT TABLE
DR$DOCUMENT_CTX$I TABLE
Text search also works well.
SQL> select * from document where catsearch(title,’tax’,”)>0;
ID TITLE
———- —————————————-
1 house tax start
However, we see many warnning events on logical standby, the event means it ignores many DML on CTXSYS schema.
CTXSYS schema store many metadata for text index.
STATUS
——————————————————————————–
EVENT
——————————————————————————–
ORA-16129: unsupported dml encountered
DML on “CTXSYS”.”DR_ID_SEQ”ORA-16129: unsupported dml encountered
DML on “CTXSYS”.”DR$INDEX”ORA-16129: unsupported dml encountered
DML on “CTXSYS”.”DR$INDEX_OBJECT”ORA-16129: unsupported dml encountered
DML on “CTXSYS”.”DR$INDEX_VALUE”ORA-16227: DDL skipped due to missing object
begin
“SYS”.”DBMS_DDL”.”SET_TRIGGER_FIRING_PROPERTY” (
“TRIG_OWNER” => ‘”BINORA-16129: unsupported dml encountered
DML on “CTXSYS”.”DR$FEATURE_USED”
So to fully have logical standby to support TEXT index, it’s better to re-create it on logical standby side.
2) ROWID datatype are not supported in logical standby, you will see “ORA-16129: unsupported dml encountered” when it’s ignored by logical standby
The test first load some table’s obsolte rows ’s rowid into a ROWID type table, then do purge by rowid.
On primary,
SQL> select count(*) from test;
COUNT(*)
———-
267065SQL> create table testrowid(id number primary key, rl rowid) ;
Table created.SQL> insert into testrowid select id,rowid from test where rownum<=100;
100 rows created.SQL> commit;
Commit complete.SQL> delete from test where id in (select id from testrowid);
100 rows deleted.SQL> commit;
Commit complete.SQL> select count(*) from test;
COUNT(*)
———-
266965
Then on logical standby, ROWID table is created but rows are not replicated.
SQL> select * from testrowid;
no rows selected
We would see warning in DBA_LOGSTDBY_EVENTS.
ORA-16129: unsupported dml encountered
DML on “BINZHANG”.”TESTROWID”
Table test rows is deleted on logical standby by redo analysis & SQL apply
SQL> select count(*) from test;
COUNT(*)
———-
266965
3) Rows in compressed table can be replicated to logical standby.
In Oracle10G, rows in compressed table can NOT be replicated to logical standby. In oracle11G, it changed and oracle11G have 2 compress option: basic or OLTP.
Step 1) create basic compress table on primary.
SQL>create table testcom (id number primary key,name varchar2(63)) compress;
Table created.SQL>insert /*+ append */into testcom select object_id, ‘compress_content’ from
dba_objects where object_id is not null;
72607 rows inserted.SQL>analyze table testcom compute statistics;
SQL> select count(*) from TESTCOM;
COUNT(*)
———-
72607
And it uses 118 blocks.
SQL> select AVG_ROW_LEN,blocks from user_tables where table_name=’TESTCOM’;
AVG_ROW_LEN BLOCKS
———– ———-
25 118
Step 2) check status on logical standby
On logical standby, replcated table keep compress basic option. Rows can be replated,but uses more blocks.
It’s due to apply concept of logical standby: it ignore the direct load.
SQL> select table_name,compression,compress_for from user_tables;
TABLE_NAME COMPRESSION COMPRESS_FOR
————— ———————— ————————————
TESTCOM ENABLED BASICSQL> select count(*) from TESTCOM;
COUNT(*)
———-
72607SQL> select AVG_ROW_LEN,blocks from user_tables where table_name=’TESTCOM’;
AVG_ROW_LEN BLOCKS
———– ———-
25 244
Seems logical standby use conversional insert that compress basic doesn’t support.
Probabbly compress OLTP would make differece.
————————
insert /*+ restrict_all_ref_cons */ into “BINZHANG”.”TESTCOM”
p(”ID”,”NAME”)values(:1,:2)
—————————————–
| Id | Operation | Name |
—————————————–
| 0 | INSERT STATEMENT | |
| 1 | LOAD TABLE CONVENTIONAL | |
—————————————–
Step 3) Add a new column on compressed table on primary, it also is added into logical standby.
SQL> desc testcom
Name Null? Type
—————————————– ——– —————————-
ID NOT NULL NUMBER
NAME VARCHAR2(63)
ANOTHER VARCHAR2(30)
4) Move table on primary, on logical standby it’s moved also.
SQL> alter table testcom move tablespace users02;
Table altered.then on logical standby ,it also got moved and data object id got changed.
SEGMENT_NAME TABLESPACE
——————– ———-
TESTCOM USERS02SQL> select object_id,data_object_id from dba_objects where object_name=’TESTCOM’;
OBJECT_ID DATA_OBJECT_ID
———- ————–
76859 76861
Logical standby databases support the following table storage types:
*Cluster tables (including index clusters and heap clusters)
*Index-organized tables (partitioned and nonpartitioned, including overflow segments)
* Heap-organized tables (partitioned and nonpartitioned)
*OLTP table compression (COMPRESS FOR OLTP) and basic table compression (COMPRESS BASIC)
4)virtual column and related function based index is also supported by logical standby
In OTN document, it lists below Unsupported Table Storage Types:
Logical standby databases do not support the following table storage types:
*Tables containing LOB columns stored as SecureFiles (unless the compatibility level is set to 11.2 or higher)
*Tables with virtual columns
*Tables using hybrid columnar compression(ORA-64307: hybrid columnar compression is only supported in tablespaces residing on Exadata storage)
Per my test, tables contains virtual columns can be maintained well by logical standby.
Step 1)create table with virtual column
CREATE TABLE employees (
id NUMBER ,
first_name VARCHAR2(10),
last_name VARCHAR2(10),
salary NUMBER(9,2),
comm1 NUMBER(3),
comm2 NUMBER(3),
salary1 AS (ROUND(salary*(1+comm1/100),2)),
salary2 NUMBER GENERATED ALWAYS AS (ROUND(salary*(1+comm2/100),2)) VIRTUAL,
CONSTRAINT employees_pk PRIMARY KEY (id)
);INSERT INTO employees (id, first_name, last_name, salary, comm1, comm2)
VALUES (1, ‘JOHN’, ‘DOE’, 100, 5, 10);INSERT INTO employees (id, first_name, last_name, salary, comm1, comm2)
VALUES (2, ‘JAYNE’, ‘DOE’, 200, 10, 20);
COMMIT;SQL> select first_name,salary1,salary2 from employees;
FIRST_NAME SALARY1 SALARY2
———————- ———-
JOHN 105 110
JAYNE 220 240
Step 2) check table status on logical standby
Per event, table is created.
EVENT
——————————————————————————–
STATUS
——————————————————————————–
CREATE TABLE employees (
id NUMBER ,
first_name VARCHAR2(10),
last_name VARCHAR2(10),
salary NUMBER(9,2),
comm1 NUMBER(3),
comm2 NUMBER(3),
salary1 AS (ROUND(salary*(1+comm1/100),2)),
salary2 NUMBER GENERATED ALWAYS AS (ROUND(salary*
(1+comm2/100),2)) VIRTUAL,
CONSTRAINT employees_pk PRIMARY KEY (id)
)
ORA-16204: DDL successfully appliedSQL> !oerr ora 16204
16204, 00000, “DDL successfully applied”
// *Cause: A DDL statement has successfully commited on the logical
// standby database.
// *Action: No action necessary, this informational statement is provided
// to record the event for diagnostic purposes.Rows is also replicated.
SQL> select first_name,salary1,salary2 from employees;
FIRST_NAME SALARY1 SALARY2
——————– ———-
JOHN 105 110
JAYNE 220 240
If create a fucntion based index on virtual column, index would also be created on logical standby.
OWNER U PAR TYPE Index Name Column Name
————— - — —— —————————-
BINZHANG Y NO EMPLOYEES_PK ID
BINZHANG N NO FUNCTI EMP_FUNIDX SALARY1
5)Logical standby will replicate “analyze table” statement from primary to standby, not copy statistics in dictionary from primary to standby.
Step 1) Do analyze on primary,
SQL> analyze table employees compute statistics;
Table analyzed.SQL> select num_rows,LAST_ANALYZED from user_tables where table_name=’EMPLOYEES’;
NUM_ROWS LAST_ANALYZED
———- ——————-
2 2010-06-01 16:04:29
Then on logical standby, table also got analyzed actually. But their “LAST_ANALYZED” is different.
Logical standby apply analyze statement, not analyze result that resides in dict of primary.
SQL> select num_rows,LAST_ANALYZED from user_tables where table_name=’EMPLOYEES’;
NUM_ROWS LAST_ANALYZED
———- ——————-
2 2010-06-01 10:50:26
6)Online redefinition is supported
Step 1) do online redef on primary, just online switch tablespace.
SQL> create table large(id number primary key,text varchar(32) ) tablespace users;
Table created.SQL> insert into large select object_id,object_name from dba_objects where object_id is not null;
72631 rows created.SQL> commit;
Commit complete.SQL> exec dbms_redefinition.can_redef_table ( USER,’LARGE’, DBMS_REDEFINITION.CONS_USE_PK) ;
PL/SQL procedure successfully completed.create table large_new into tablespace USERS02 with same structure as large
SQL> exec dbms_redefinition.START_REDEF_TABLE ( USER, ‘LARGE’, ‘LARGE_NEW’, NULL, DBMS_REDEFINITION.CONS_USE_PK);
PL/SQL procedure successfully completed.SQL> exec dbms_redefinition.sync_interim_table( USER, ‘LARGE’,'LARGE_NEW’);
PL/SQL procedure successfully completed.SQL> exec dbms_redefinition.finish_redef_table( USER, ‘LARGE’,'LARGE_NEW’);
PL/SQL procedure successfully completed.
On primary,
SQL> select table_name,tablespace_name from user_tables where table_name in ( ‘LARGE’,'LARGE_NEW’);
TABLE_NAME TABLESPACE_NAME
——————– ——————–
LARGE USERS02
LARGE_NEW USERS
Step 2) then do same verify query on logical standby, we can see online-redef is still supported.
Table LARGE ’s tablespace changed from USERS to USERS02 in dict.
SQL> select table_name,tablespace_name from user_tables where table_name in ( ‘LARGE’,'LARGE_NEW’);
TABLE_NAME TABLESPACE_NAME
——————– ——————–
LARGE USERS02
LARGE_NEW USERS
In oracle documents, its description has confilict on DBMS_REDEFINITION package.
4. Supported PL/SQL Supplied Packages
Oracle PL/SQL supplied packages that do not modify system metadata or user data leave no footprint in the archived redo log files,
and hence are safe to use on the primary database. Examples of such packages are
DBMS_OUTPUT, DBMS_RANDOM, DBMS_PIPE, DBMS_DESCRIBE, DBMS_OBFUSCATION_TOOLKIT, DBMS_TRACE, DBMS_METADATA, DBMS_CRYPTO.
Oracle PL/SQL supplied packages that do not modify system metadata but may modify user data are supported by SQL Apply,
as long as the modified data belongs to the supported data types listed in Section C.1.1. Examples of such packages are DBMS_LOB,
DBMS_SQL, and DBMS_TRANSACTION.Data Guard logical standby supports replication of actions performed through the following packages: DBMS_RLS, DBMS_FGA, and DBMS_REDEFINITION.
C.9.2 Unsupported PL/SQL Supplied Packages
Oracle PL/SQL supplied packages that modify system metadata typically are not supported by SQL Apply, and
therefore their effects are not visible on the logical standby database. Examples of such packages are DBMS_JAVA, DBMS_REGISTRY,
DBMS_ALERT, DBMS_SPACE_ADMIN, DBMS_REFRESH, DBMS_REDEFINITION, and DBMS_AQ.
7)Outline is supported. But manually updates in outln schema is not replicated to logical standby.
Step 1) Create outline on primary.
SQL> create outline ol_temp for category temp_plan on select count(*) from binzhang.test;
Outline created.SQL> select count(*) from ol$;
COUNT(*)
———-
1SQL> select count(*) from ol$nodes;
COUNT(*)
———-
1SQL> select count(*) from ol$hints;
COUNT(*)
———-
6
Step 2) Then on logical standby, check outln shema also.
SQL> select sql_text from ol$;
SQL_TEXT
——————————————————————————–
select count(*) from binzhang.test
We can see outline schema is replicated and maintained by oracle.
step 3) Then did a manually update on OL$ on primary and check if manually update can be replicated
SQL> update ol$ set sql_text=’select * from dual’;
1 row updated.SQL> commit;
Commit complete.SQL> select sql_text from ol$;
SQL_TEXT
——————————————————————————–
select * from dual
Then on logical standby, it doesn’t change; so it doesn’t support manually update on outln schema.
SQL> select sql_text from ol$;
SQL_TEXT
——————————————————————————–
select count(*) from binzhang.test
8)Oracle replicate sequence value very well and make sence.
Sequences are usually cached on primary DB. And oracle only replicated bump sequence operation in seq$.
In cocnept, when session query nextval, it just fetch value from row cache, it doesn’t update seq$,so it doesn’t generated redo, so logical standby capture nothing.
For example ,cache size is 1000, when all cached sequences are used up, and new serial of sequences are generated&cached and seq$ would be updated.
Oracle will replcate redo of seq$ update operation to logical standby and applied into dictionary at logical standby.
And when disable dataguard and query sequenct.nextval on logical standby. In this way, seq$.last_number would be larger than primary.
At this time, as long as primary’s seq$.last_nuber < standby seq$.last_nuber, standby seq$.last_number will not be updated when primary.seq$ got updates.
Oracle will keep logical standy.seq$.last_number >= primary.seq$.last_number. This would make sence for switchover.
9)During convert to some character set, we need to do convert on both databases.
Per OTN document, Configurations are not supported in which the primary database and standby database have different character sets.
how to convert charset?
What i did
1) convert primary to UTF8.
2) logical standby can apply
3) convert logical standby to UTF8
4) Replication still works well.
10)System trigger like “after logon”or “after startup” can be created on logical standby side.
Below type trigger can be created on logical standby and it will not block application session logon as it’s executed recursively by SYS.
CREATE OR REPLACE TRIGGER logon_audit
AFTER LOGON ON DATABASE
BEGIN
INSERT INTO binzhang.connection_audit
(login_date, user_name)
VALUES
(SYSDATE, USER);
END logon_audit;
2010-06-09 Wed
AnySQL.net
Oracle & Starcraft
Give you some color to see see!
Oracle Scratchpad
Oracle Life
Chanel [K]
Oracle Security Blog
MySQL Performance Blog
The Tom Kyte Blog
Delicious/Fenng/oracle
O'Reilly Databases
Red Hat Magazine
车东[Blog^2]
blue_prince
玉面飞龙的BLOG
木匠 Creative and Flexible
生活帮-LifeBang
Hey!! Sky!
dba on unix
Brotherxiao's Home
jametong's shared items in Google Reader
DBA Tools
Inside the Oracle Optimizer - Removing the black magic
DBA@Taobao
存储部落
OracleBlog.cn
知道分子
支付宝官方 Blog - 支付志
木匠的天空 Oracle Architect and Developer
Hello DBA
OS与Oracle
Cary Millsap
Guy Harrison's main page
eagle's home
dbthink
DBA Notes
OracleDBA Blog---三少个人涂鸦地!The Pythian Blog
myNoSQL
OracleDBA Blog---三少个人涂鸦地!DBA@SKY-MOBI




