- Oracle Data Guard 11gR2 Administration Beginner's Guide
- Emre Baransel Nassyam Basha
- 482字
- 2021-08-13 17:12:28
Time for action – searching for and fixing any table row uniqueness problem
- In order to check for any table row uniqueness, we can run the following query on the primary database:
SQL> SELECT * FROM DBA_LOGSTDBY_NOT_UNIQUE; OWNER TABLE_NAME B ------------------------------ ------------------------------ - SCOTT BONUS N SCOTT SALGRADE N SH SALES N SH COSTS N SH SUPPLEMENTARY_DEMOGRAPHICS N
This query was run on a newly created 11g release 2 database, which only includes built-in example schemas. The output shows that several tables from
SCOTT
andSH
schemas have row uniqueness problem.The
BAD_COLUMN
column has two values, which areY
andN
. If you see the rows withBAD_COLUMN=Y
, it means that the table column is defined using an unbounded data type, such asLONG
orBLOB
. If two rows contain the same data except in theirLOB
columns, the replication will not work properly for this table. If the application ensures the rows are unique, we should consider adding a disabled primary keyRELY
constraint to these tables. WhenRELY
is used, the system will assume that rows are unique and not validate them on every modification to the table. This method will avoid the overhead of maintaining a primary key on the primary database. However, if there's no such uniqueness, we must add a unique-constraint/index to the columns on the primary database.BAD_COLUMN=N
means that there is enough column information to maintain the table in the logical standby database; however, the transport and apply services will run more efficiently if you add a primary key to the table. We should again consider adding a disabledRELY
constraint to these tables. - Let's add a disabled primary key
RELY
constraint to theBONUS
table in theSCOTT
schema. First we check the columns of the table using the following query:SQL> DESC SCOTT.BONUS Name Null? Type ----------------- -------- ---------------------------- ENAME VARCHAR2(10) JOB VARCHAR2(9) SAL NUMBER COMM NUMBER
- Now we add the disabled
RELY
constraint to theENAME
column of the table:SQL> ALTER TABLE SCOTT.BONUS ADD PRIMARY KEY (ENAME) RELY DISABLE; Table altered.
- We can check the
DBA_LOGSTDBY_NOT_UNIQUE
view again to see if theBONUS
table has disappeared from the list using the following query:SQL> SELECT * FROM DBA_LOGSTDBY_NOT_UNIQUE; OWNER TABLE_NAME B ------------------------------ ------------------------------ - SCOTT SALGRADE N SH SALES N SH COSTS N SH SUPPLEMENTARY_DEMOGRAPHICS N
- We should add disabled
RELY
constraints to the rest of the tables above. Now we're ready for the next step, which is creating the logical standby database.
What just happened?
We've just seen the prerequisite steps to create a logical standby database configuration. The first step was checking the unsupported tables that will not be replicated, in order to be aware which data will be missed on the logical standby and to decide whether to use the logical option or not. The next step is searching for and fixing any table row uniqueness problem, for properly working redo transport and SQL Apply services.
- Boost程序庫完全開發(fā)指南:深入C++”準”標準庫(第5版)
- 玩轉(zhuǎn)Scratch少兒趣味編程
- VMware View Security Essentials
- 案例式C語言程序設計
- Mastering Adobe Captivate 2017(Fourth Edition)
- Beginning C++ Game Programming
- 企業(yè)級Java EE架構(gòu)設計精深實踐
- NLTK基礎教程:用NLTK和Python庫構(gòu)建機器學習應用
- Python王者歸來
- Learning Three.js:The JavaScript 3D Library for WebGL
- Spring Boot Cookbook
- 數(shù)據(jù)結(jié)構(gòu)案例教程(C/C++版)
- Learning JavaScript Data Structures and Algorithms
- HTML5從入門到精通 (第2版)
- Creating Mobile Apps with jQuery Mobile(Second Edition)