Home Database Mysql Tutorial Oracle 10g 物理standby转为逻辑standby

Oracle 10g 物理standby转为逻辑standby

Jun 07, 2016 pm 04:43 PM

在创建逻辑standby之前,首先检查primary数据库的状态,确保primary数据库已经为创建逻辑standby做好了全部准备工作,比如说是否

1.配置逻辑Standby 的准备工作

SQL> SELECT * FROM DBA_LOGSTDBY_UNSUPPORTED;

OWNER TABLE_NAME COLUMN_NAME DATA_TYPE ATTRIBUTES
---------- -------------------- -------------------- -------------------- --------------------
SH MVIEW$_EXCEPTIONS BAD_ROWID ROWID
OE CUSTOMERS CUST_ADDRESS CUST_ADDRESS_TYP
OE CUSTOMERS PHONE_NUMBERS PHONE_LIST_TYP
OE CUSTOMERS CUST_GEO_LOCATION SDO_GEOMETRY
OE WAREHOUSES WAREHOUSE_SPEC XMLTYPE
OE WAREHOUSES WH_GEO_LOCATION SDO_GEOMETRY
PM ONLINE_MEDIA PRODUCT_AUDIO ORDAUDIO
PM ONLINE_MEDIA PRODUCT_TESTIMONIALS ORDDOC
PM ONLINE_MEDIA PRODUCT_PHOTO ORDIMAGE
PM ONLINE_MEDIA PRODUCT_PHOTO_SIGNATURE ORDIMAGESIGNATURE
PM ONLINE_MEDIA PRODUCT_THUMBNAIL ORDIMAGE
PM ONLINE_MEDIA PRODUCT_VIDEO ORDVIDEO
PM PRINT_MEDIA AD_TEXTDOCS_NTAB TEXTDOC_TAB
PM PRINT_MEDIA AD_GRAPHIC BFILE
PM PRINT_MEDIA AD_HEADER ADHEADER_TYP
OE CATEGORIES_TAB CATEGORY_NAME VARCHAR2 Object Table
OE CATEGORIES_TAB CATEGORY_DESCRIPTION VARCHAR2 Object Table
OE CATEGORIES_TAB CATEGORY_ID NUMBER Object Table
OE CATEGORIES_TAB PARENT_CATEGORY_ID NUMBER Object Table

19 rows selected.

批注:关于DBA_LOGSTDBY_UNSUPPORTED 该视图显示包含不被支持的数据类型的表的列名及该列的数据类型,注意该视图的ATTRIBUTES列,列值会显示表不被sql应用支持的原因。

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

Oracle 11g从入门到精通 PDF+光盘源代码

RHEL6 ASM方式安装Oracle 11g R2

2)维护逻辑standby与primary的数据库同步是通过sql应用实现,SQL应用转换的SQL语句在执行时,对于insert还好说,对于update,delete操作则必须能够唯一定位到数据库待更新的那条记录,问题就在这里,如果primary库中表设置不当,可能就无法确认唯一条件,逻辑standby跟物理standby的区别,就是因为它只是逻辑上与primary数据库相同,,物理上可能与primary数据库存在相当大差异,一定要认识到,逻辑standby的物理结构与primary是不相同的(即使初始逻辑standby是通过primary的备份创建),因此想通过rowid更新显然是不好使的,就不能再将其做为唯一条件,可以通过以下的方法来解决:
如何确保primary库中各表的行可被唯一标识
Oracle 通过主键、唯一索引/约束补充日志(supplemental logging)来确定待更新逻辑standby库中的行,当数据库启用了补充日志(supplemental logging)每一条update语句写redo的时候会附加列值唯一信息,比如:
如果表定义了主键,则主键值会随同被更新列一起做为update语句的一部分,以便执行时区别哪些列应该被更新;
如果没有主键,则非空的唯一索引/约束会随同被更新列做为update语句的一部分,以便执行时区分哪些列应该被更新,如果该表有多个唯一索引/约束,则oracle自动选择最短的那个;
如果表即无主键,也没有定义唯一索引/约束,所有可定长度的列连同被更新列作为update语句的一部分,更明确的话可定长度的列是指那些除:long,lob,long raw,object type,collection类型外的列;
确定在主数据库上,补充日志是否被启用,可以查询v$database,如下:SQL> select SUPPLEMENTAL_LOG_DATA_FK,SUPPLEMENTAL_LOG_DATA_ALL,SUPPLEMENTAL_LOG_DATA_MIN from v$database;
SUP SUP SUPPLEME
--- --- --------
NO NO NO

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
SQL> select SUPPLEMENTAL_LOG_DATA_FK,SUPPLEMENTAL_LOG_DATA_ALL,SUPPLEMENTAL_LOG_DATA_MIN from v$database;

SUP SUP SUPPLEME
--- --- --------
NO NO YES

批注:SUPPLEMENTAL_LOG_DATA_MIN=YES和IMPLICIT都表示数据库启动了最小化的补充日志。YES表示通过ALTER DATABASE ADD SUPPLEMENTAL LOG DATA语句启动的最小化补充日志;如果启动了对主键、唯一键、外键、ALL的补充日志,默认情况下都会打开最小化的补充日志,IMPLICIT表示的是通过启动对主键、唯一键、外键或者ALL的支持而打开的最小化补充日志。
因此,Oracle 建议你为表创建一个主键或非空的唯一索引/约束,以尽可能确保sql应用能够有效应用redo数据更新逻辑standby数据库。
3)执行下列语句检查sql应用能否唯一识别表列,找出不被支持的表:
SQL> SELECT OWNER, TABLE_NAME FROM DBA_LOGSTDBY_NOT_UNIQUE
2 WHERE (OWNER, TABLE_NAME) NOT IN
3 (SELECT DISTINCT OWNER, TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED)
4 AND BAD_COLUMN = 'Y';

OWNER TABLE_NAME
------------------------------ ------------------------------
TSMSYS SRS$ --这是一张系统表,首先查看该用户是否可以登录,如果是锁定状态,我们就无需设置它

SQL> select username,account_status from dba_users where username like '%TSMSYS%';

USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
TSMSYS
N:表示该表拥有足够的信息,能够支持在逻辑standby的更新,不过仍然建议你为该表创建一个主键或者唯一索引/约束以提高log应用效率;

4)

更多详情见请继续阅读下一页的精彩内容:

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1661
14
PHP Tutorial
1261
29
C# Tutorial
1234
24
When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

Can mysql and mariadb coexist Can mysql and mariadb coexist Apr 08, 2025 pm 02:27 PM

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

RDS MySQL integration with Redshift zero ETL RDS MySQL integration with Redshift zero ETL Apr 08, 2025 pm 07:06 PM

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.

Laravel Eloquent ORM in Bangla partial model search) Laravel Eloquent ORM in Bangla partial model search) Apr 08, 2025 pm 02:06 PM

LaravelEloquent Model Retrieval: Easily obtaining database data EloquentORM provides a concise and easy-to-understand way to operate the database. This article will introduce various Eloquent model search techniques in detail to help you obtain data from the database efficiently. 1. Get all records. Use the all() method to get all records in the database table: useApp\Models\Post;$posts=Post::all(); This will return a collection. You can access data using foreach loop or other collection methods: foreach($postsas$post){echo$post->

The relationship between mysql user and database The relationship between mysql user and database Apr 08, 2025 pm 07:15 PM

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

MySQL: The Ease of Data Management for Beginners MySQL: The Ease of Data Management for Beginners Apr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

See all articles