环境 :数据库版本Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 VBOX虚拟机主机名、数据库实例、库名及IP规划:源
环境 :
数据库版本Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
VBOX虚拟机
主机名、数据库实例、库名及IP规划:
源主机IP:192.168.1.213 HOSTNAME:bys001.oel.com
目标主机IP:192.168.1.213 HOSTNAME:bys2.oel.com
实例名和数据库名两台主机一样,两台主机的数据库结构完全一样。
采用先配置源主机,再克隆一台修改一下配置做为目标机。
其中源主机已经安装好ORACLE数据库软件并已经创建数据库。
整个配置分6步:
1.修改环境变量,创建目录
2.上传OGG软件解压并安装
3.查询数据库名、实例名并开启归档模式,,强制产生日志等
4.在数据库中为OGG创建用户
5.开始配置OGG的同步--未配置DDL的同步
6.测试test用户的test1表做DML操作能否同步
######################################
1.修改环境变量,创建目录
[oracle@bys001 ~]$ vi .bash_profile
增加这一句:
export OGG_HOME=/u01/ogg
".bash_profile" 24L, 560C written
[oracle@bys001 ~]$ source .bash_profile
[oracle@bys001 ~]$ cd /u01
[oracle@bys001 u01]$ mkdir ogg
[oracle@bys001 u01]$ ls
admin checkpoints oradata
app diag oraInventory
archbys1 flash_recovery_area
cfgtoollogs ogg
[oracle@bys001 u01]$ echo $OGG_HOME
/u01/ogg
2.上传OGG软件解压并安装
----使用SSH SECURE SHELL上传很好用。
[oracle@bys001 ~]$ ls ogg112101_fbo_ggs_Linux_x86_ora11g_32bit.zip ogg112101_fbo_ggs_Linux_x86_ora11g_32bit.zip
[oracle@bys001 ~]$ unzip ogg112101_fbo_ggs_Linux_x86_ora11g_32bit.zip
[oracle@bys001 ~]$ ls fbo_ggs_Linux_x86_ora11g_32bit.tar
fbo_ggs_Linux_x86_ora11g_32bit.tar
[oracle@bys001 ~]$ tar -xvf fbo_ggs_Linux_x86_ora11g_32bit.tar -C $OGG_HOME
打开 ggsci时的一个错误解决:
我这里在使用ggsci遇到错误因为找不到库文件报错:
[oracle@oel-01 ogg]$ ./ggsci
./ggsci: error while loading shared libraries: libnnz11.so: cannot open shared object file: No such file or directory
建议在使用前先在OGG的目录执行:[oracle@bys001 ogg]$ ldd ggsci
如果库文件全在,可以直接执行[oracle@bys001 ogg]$ ./ggsci
如果缺少库文件,可以find / -name libnnz11.so 这样在整个/目录下查询。
根据查出的库文件位置,做一个软链接就可以了,要使用 root账户。如:
[root@oel-01 ~]# ln -s /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so /lib/libnnz11.so
创建OGG目录:要注意在OGG的安装目录下调用
[oracle@bys001 ogg]$ ./ggsci
GGSCI (bys001.oel.com) 2> create subdirs
Creating subdirectories under current directory /u01/ogg
Parameter files /u01/ogg/dirprm: already exists
Report files /u01/ogg/dirrpt: created
Checkpoint files /u01/ogg/dirchk: created
Process status files /u01/ogg/dirpcs: created
SQL script files /u01/ogg/dirsql: created
Database definitions files /u01/ogg/dirdef: created
Extract data files /u01/ogg/dirdat: created
Temporary files /u01/ogg/dirtmp: created
Stdout files /u01/ogg/dirout: created
只需要在打开的窗口写入: PORT 7809就可以了,使用是和VI一样。
GGSCI (bys001.oel.com) 4> edit param mgr
PORT 7809
GGSCI (bys001.oel.com) 7> start mgr
Manager started.
GGSCI (bys001.oel.com) 8> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
OGG安装完成。因为后面才会克隆虚拟机,所以这里只需要做一次安装哈哈。
OGG同步的配置在第6步。
###############################################

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB

MySQL/InnoDB supports four transaction isolation levels: ReadUncommitted, ReadCommitted, RepeatableRead and Serializable. 1.ReadUncommitted allows reading of uncommitted data, which may cause dirty reading. 2. ReadCommitted avoids dirty reading, but non-repeatable reading may occur. 3.RepeatableRead is the default level, avoiding dirty reading and non-repeatable reading, but phantom reading may occur. 4. Serializable avoids all concurrency problems but reduces concurrency. Choosing the appropriate isolation level requires balancing data consistency and performance requirements.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.