- 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.
- Python程序設(shè)計(jì)教程(第2版)
- Oracle從新手到高手
- Visual Basic程序開發(fā)(學(xué)習(xí)筆記)
- 區(qū)塊鏈架構(gòu)與實(shí)現(xiàn):Cosmos詳解
- Python完全自學(xué)教程
- Python數(shù)據(jù)結(jié)構(gòu)與算法(視頻教學(xué)版)
- JavaScript腳本特效編程給力起飛
- JavaScript程序設(shè)計(jì)(第2版)
- Arduino可穿戴設(shè)備開發(fā)
- Java 9 Programming By Example
- 零基礎(chǔ)看圖學(xué)ScratchJr:少兒趣味編程(全彩大字版)
- ASP.NET Web API Security Essentials
- Puppet:Mastering Infrastructure Automation
- SAP Web Dynpro for ABAP開發(fā)技術(shù)詳解:基礎(chǔ)應(yīng)用
- Solr權(quán)威指南(下卷)