search
HomeDatabaseMysql TutorialOracle 增加日志组,日志成员的一些命令

Oracle 增加日志组,日志成员的一些命令2012-05-14 13:421、增加日志组: alter database add logfile group 4

Oracle 增加日志组,日志成员的一些命令
2012-05-14 13:42
1、增加日志组:

alter database add logfile group 4 '/oradata/oracle/oradata/oracle_sid/redo04.log' size 100M;

2、改变日志组的大小(

首先看下归档状态:

SQL> select group#,thread#,members,archived,status from v$log;
 
    GROUP#    THREAD#    MEMBERS ARC STATUS
---------- ---------- ---------- --- ----------------
         1          1          1 YES INACTIVE
         2          1          1 YES INACTIVE
         3          1          1 NO  CURRENT
         4          1          1 YES UNUSED

4 rows selected.

其次DROP GROUP 1(此时最好是别DROP GROUP3,至于什么后果,,我没有往这方向TEST。)

SQL> alter database drop logfile group 1;
 
Database altered.

再删除redo01.log

SQL> !rm /oradata/oracle/oradata/NC5X/redo01.log

最后增加redo01.log:

SQL> alter database add logfile group 1 '/oradata/oracle/oradata/ORACLE_SID/redo01.log' size 100M;

SQL> select group#,thread#,members,archived,status from v$log;
 
    GROUP#    THREAD#    MEMBERS ARC STATUS
---------- ---------- ---------- --- ----------------
         1          1          1 YES UNUSED
         2          1          1 YES INACTIVE
         3          1          1 NO  CURRENT
         4          1          1 YES UNUSED

4 rows selected.

此时,切换下日志:

SQL> alter system switch logfile;
 
System altered.

注意:alter system switch logfile 和alter system archive log current这两个切换的区别。

alter system switch logfile 是不等待归档完成就switch logfile。如果database尚未开启archive log mode。那用这个切换是毋庸置疑了。另外,也是对单实例database和RAC模式下当前实例执行日志切换。

而alter system archive log current则需要等待归档完成才switch logfile。会对中所有实例执行日志切换。

整体上说来,在自动归档的库里,两个命令的所产生的结果几乎一样。有区别的是alter system archive log current所用的时间会比alter system switch logfile 的长。

3、增加日志组成员:

SQL> alter database add logfile member '/oraback/logbackup/redo01_b.log' to group 1;
 
Database altered.

注意:alter 语句中不可设定redo01_b.log的大小。


SQL> alter database add logfile member '/oraback/logbackup/redo01_b.log' size 100M to group 1;
alter database add logfile member '/oraback/logbackup/redo01_b.log' size 100M to group 1
                                                                    *
ERROR at line 1:
ORA-00946: missing TO keyword。

Alter语句运行之后,生成的Redo01_b.log的大小与redo01.log的大小一致。

路径可以选择与默认路径不一致。

最后,得声明一下:可以同时增加几个日志组。也可以同时增加几个日志组成员。语句格式如下:

ALTER DATABASE ADD LOGFILE '/LOCATION_DUEST/REDO01.LOG' SIZE 10M,''/LOCATION_DUEST/REDO02.LOG'  SIZE 10M... ...;依次类推。

增加成员也类似。不在赘述。

4、删除日志组及日志组成员:

原则:删除前必须遵守如下原则,每个实例必须至少有两个日志组;当一个组处于ACTIVE或者CURRENT的状态时不可删除;删除日志组的操作只对数据库进行更改,操作系统的文件尚未删除;当删除时适用DROP LOGFILE GROUP N语句时,此时GROUP N内的所有成员都将被删除。

ALTER DATABASE DROP LOGFILE GROUP N;

删除日志成员的原则:当你删除一个是该组中最后一个成员的时候,你不能删除此成员;当组的转台处于current的状态时,不能删除组成员;在归档模式下,必须得归档之后才能删除;删除日志组成员的操作只对数据库进行更改,操作系统的文件尚未删除

ALTER DATABASE DROP LOGFILE MEMBER '/LOCATION_DUST/REDO0N_N.LOG';

linux

Statement
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
Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

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),