Oracle 增加日志组,日志成员的一些命令
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';

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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

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.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance 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 basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

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.
