逻辑备库,数据类型的考虑
1逻辑支持的数据类型
2逻辑备库不支持的数据类型
1逻辑备库支持下面的数据类型
BINARY_DOUBLE
BINARY_FLOAT
BLOB
CHAR
CLOB and NCLOB
DATE
INTERVAL YEAR TO MONTH
INTERVAL DAY TO SECOND
LONG
LONG RAW
NCHAR
NUMBER
NVARCHAR2
RAW
TIMESTAMP
TIMESTAMP WITH LOCAL TIMEZONE
TIMESTAMP WITH TIMEZONE
VARCHAR2 and VARCHAR
sql apply 支持下面的数据类型,要求主库上设置兼容
multibyte clob支持(要求主库的compatibility是10.1或更高)
没有LOB与overflows的iot支持(要求主库compatibilty10.1或更高)
带LOB与overflows的iot,要求主库compatibility 10.2或更高)
逻辑备库不支持下面的数据类型
BFILE
Collections (including VARRAYS and nested tables)
Encrypted columns
Multimedia data types (including Spatial, Image, and Context)
ROWID, UROWID
User-defined types
XMLType
存储类型的考虑
逻辑备库支持下面的存储类型
Cluster tables (including index clusters and heap clusters)
Index-organized tables (partitioned and nonpartitioned, including overflow segments)
Heap-organized tables (partitioned and nonpartitioned
逻辑备库不支持的存储类型
不支持段压缩存储类型
pl/sql包的考虑
支持的pl/sql包
oracle pl/sql不修改系统元数据但是也许会修改用户数据是被sql apply支持的。如:DBMS_LOB, DBMS_SQL, and DBMS_TRANSACTION
不支持的pl/sql包
修改系统元数据的包是不被支持的。如:are DBMS_JAVA, DBMS_REGISTRY, DBMS_ALERT, DBMS_SPACE_ADMIN, DBMS_REFRESH, DBMS_REDEFINITION, DBMS_SCHEDULER, and DBMS_AQ.
dbms_job是支持的,被复制到备库的job不会运行,当发生角色切换的时候,job会继续运行。
不支持的表,序列,和视图
一些schema会被sql apply跳过,为了看哪些schema会被跳过,查看下面的视图
SELECT OWNER FROM DBA_LOGSTDBY_SKIP WHERE STATEMENT_OPT = 'INTERNAL SCHEMA';
为了看主库包含哪些不被支持的对象,查看下面的视图
SELECT DISTINCT OWNER,TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED ORDER BY OWNER,TABLE_NAME;
为了查看列和列的类型,使用下面的语句
SELECT COLUMN_NAME,DATA_TYPE FROM DBA_LOGSTDBY_UNSUPPORTED WHERE OWNER='OE' AND TABLE_NAME = 'CUSTOMERS';
被逻辑备库跳过的sql
ALTER DATABASE
ALTER MATERIALIZED VIEW
ALTER MATERIALIZED VIEW LOG
ALTER SESSION
ALTER SYSTEM
CREATE CONTROL FILE
CREATE DATABASE
CREATE DATABASE LINK
CREATE PFILE FROM SPFILE
CREATE MATERIALIZED VIEW
CREATE MATERIALIZED VIEW LOG
CREATE SCHEMA AUTHORIZATION
CREATE SPFILE FROM PFILE
DROP DATABASE LINK
DROP MATERIALIZED VIEW
DROP MATERIALIZED VIEW LOG
EXPLAIN
LOCK TABLE
SET CONSTRAINTS
SET ROLE
SET TRANSACTION
应用dml的考虑
在主库上的直接路径insert到逻辑备库上会变成常规的insert
并行dml事务在逻辑库上不并行执行
在主库上的批量更新或删除(一个命令导致多行被修改),在备库上的应用就像是单行被修改,因此表上有唯一键或是主键是很必要的。
应用ddl的考虑
并行ddl在备库上不并行
ddl事务在备库上顺序执行
CREATE TABLE AS SELECT
(CTAS) statements are executed such that the DML activities (that are part of the CTAS statement) are suppressed on the logical standby database. The rows inserted in the newly created table as part of the CTAS statement are mined from the redo log files and applied to the logical standby database using INSERT
statements.