在Oracle 10g版本中,推出了一个新特性mdash;mdash;归档压缩,此功能的目的是在归档传输到远程或者归档存储到磁盘之前进行压缩
在Oracle 10g版本中,推出了一个新特性——归档压缩,此功能的目的是在归档传输到远程或者归档存储到磁盘之前进行压缩,以便减少归档传输的时间和占用的磁盘空间。但是关于怎样开启归档压缩的语法,在10g的官方文档中没有提及,参考MOS文章BUG 3464260。可以用下面的语法开启数据库的归档压缩功能:alter database archivelog compress enable。但是,这个功能在10g、11g中都还未进行支持,相关的官方文档中也没有进行申明。下面进行测试,观察在开启归档压缩后是否会对归档日志进行压缩。
--本次测试在11.2.0.3版本中进行
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
--查看redo文件大小
SQL> select group#,members,bytes from v$log;
GROUP# MEMBERS BYTES
---------- ---------- ----------
1 1 52428800
2 1 52428800
3 1 52428800
--查看数据库是否开启归档压缩
SQL> select name,ARCHIVELOG_COMPRESSION from v$database;
NAME ARCHIVEL
--------------------------------------------- --------
GYL DISABLED
--运行事务
begin
for i in 1..500000 loop
insert into darren values(1,\'aa\');
commit;
end loop;
end;
--查看生成的归档文件的大小
SQL> select name,blocks*block_size \"size\" from v$archived_log;
NAME size
--------------------------------------------- ----------
/oradata/archive/orcl_1_112_851966182.arc 49916928
/oradata/archive/orcl_1_113_851966182.arc 47870464
/oradata/archive/orcl_1_114_851966182.arc 49916928
/oradata/archive/orcl_1_115_851966182.arc 46791680
/oradata/archive/orcl_1_116_851966182.arc 49449984
/oradata/archive/orcl_1_117_851966182.arc 45774848
/oradata/archive/orcl_1_118_851966182.arc 46656512
/oradata/archive/orcl_1_119_851966182.arc 47223296
--开始数据库归档压缩功能
SQL> alter database archivelog compress enable;
Database altered.
SQL> select name,ARCHIVELOG_COMPRESSION from v$database;
NAME ARCHIVEL
--------- --------
GYL ENABLED
--再次运行事务
begin
for i in 1..500000 loop
insert into darren values(1,\'aa\');
commit;
end loop;
end;
--查看此时生成的归档文件大小
SQL> select name,blocks*block_size \"size\" from v$archived_log;
NAME size
--------------------------------------------- ----------
/oradata/archive/orcl_1_112_851966182.arc 49916928
/oradata/archive/orcl_1_113_851966182.arc 47870464
/oradata/archive/orcl_1_114_851966182.arc 49916928
/oradata/archive/orcl_1_115_851966182.arc 46791680
/oradata/archive/orcl_1_116_851966182.arc 49449984
/oradata/archive/orcl_1_117_851966182.arc 45774848
/oradata/archive/orcl_1_118_851966182.arc 46656512
/oradata/archive/orcl_1_119_851966182.arc 47223296
/oradata/archive/orcl_1_120_851966182.arc 48120320
/oradata/archive/orcl_1_121_851966182.arc 48687104
/oradata/archive/orcl_1_122_851966182.arc 49916928
/oradata/archive/orcl_1_123_851966182.arc 45165568
/oradata/archive/orcl_1_124_851966182.arc 48716800
/oradata/archive/orcl_1_125_851966182.arc 48135680
/oradata/archive/orcl_1_126_851966182.arc 46420992
/oradata/archive/orcl_1_127_851966182.arc 47159808
/oradata/archive/orcl_1_128_851966182.arc 43561472
从实验数据可以看到,从orcl_1_120*开始的归档为开在开启归档功能后生成的归档,与之前的归档文件进行比较,发现并没有对归档文件进行压缩。关于归档日志小于在线日志的原因,请参考 。
所以,在10g、11g中,oracle暂时不支持归档压缩功能。
另外,ogg目前也不支持压缩的归档文件,并且也没有表示将会支持压缩的归档文件。因此,,这个功能还只能在期待中!
本文永久更新链接地址:

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

Subqueries can improve the efficiency of MySQL query. 1) Subquery simplifies complex query logic, such as filtering data and calculating aggregated values. 2) MySQL optimizer may convert subqueries to JOIN operations to improve performance. 3) Using EXISTS instead of IN can avoid multiple rows returning errors. 4) Optimization strategies include avoiding related subqueries, using EXISTS, index optimization, and avoiding subquery nesting.

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Renaming a database in MySQL requires indirect methods. The steps are as follows: 1. Create a new database; 2. Use mysqldump to export the old database; 3. Import the data into the new database; 4. Delete the old database.


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

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

Hot Article

Hot Tools

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

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
