Oracle reconstruction online log

Source: Internet
Author: User

A redo log group can contain one or more log members, which should be stored on different disks as disk log images. The same group of Members has the same content, the purpose is to prevent all online logs from being lost due to a disk failure. If you do not have multiple disks, you do not have to create multiple log members for redo logs.

Online logs are archived when a group of logs is full and the next log group is used. When the log group is full and then sent to the first log group, if the first log group is archived, it will be overwritten. If it is not, the log buffer can only be used after archiving is complete.

If the archiving process is slow and the log files are large, you can forcibly archive them in advance:

Alter system switch logfile;
Archive logs are used for rman recovery. If rman recovery is not performed and logs do not need to be saved, they can be deleted directly.
Enable or disable Archiving
Start database to mount status
Startup mount
To enable the archive mode, use
> Alter database archivelog command
If you need to stop the archive mode, use:
> Alter database noarchivelog command.

To avoid frequent Log File switching, you can increase the log file size. The default value is 1 MB.
1. Go to sqlplus
2. alter database add logfile group 4 ('/Oracle/dbs/log1c. rdo') SIZE 10 m;
You can also choose not to specify the path: alter database add logfile group 4 size 30 m;
3. Specify the path by yourself (/oracle/dbs/redo4a. log', '/oracle/dbs/redo5a. rdo)
4. View select * from v $ log; view the log group status
Select * from v $ logfile; view log group member files

Set the size of online redo logs to switch once at least 15 minutes. It may be difficult to estimate the value of www.bkjia.com.

How to modify the size of online redo log files
Method
Add a new large log file and delete the old small log file.
Assume that there are three log groups, each of which has one member. The size of each member is 1 MB. Now we want to change the size of all three log groups to 10 MB.
1. create two new log groups
SQL> alter database add logfile group 4 ('/oracle/oradata/orcl/redo04.rdo') size 10 m;
SQL> alter database add logfile group 5 ('/oracle/oradata/orcl/redo05.rdo') size 10 m;
2. Switch the current log to a new log group.
Alter system switch logfile;
Alter system switch logfile;
3. Delete the old log Group
Alter database drop logfile group 1;
Alter database drop logfile group 2;
Alter database drop logfile group 3;
4. delete files in the original log group 1, 2, and 3 in the operating system
Rm/oracle/oradata/orcl/redo01.rdo
Rm/oracle/oradata/orcl/redo01.rdo
Rm/oracle/oradata/orcl/redo01.rdo
5. Rebuild log groups 1, 2, and 3
Alter database add logfile group 1 ('/oracle/oradata/orcl/redo01.rdo') size 10 m;
Alter database add logfile group 2 ('/oracle/oradata/orcl/redo02.rdo') size 10 m;
Alter database add logfile group 3 ('/oracle/oradata/orcl/redo03.rdo') size 10 m;
6. Switch the log Group
Alter system switch logfile;
Alter system switch logfile;
Alter system switch logfile;
7. Delete the log group for intermediate transition 4
Alter database drop logfile group 4;
Alter database drop logfile group 5;
Error:
SQL> alter database drop logfile group 4;
Alter database drop logfile group 4
*
ERROR at line 1:
ORA-01624: log 4 needed for crash recovery of instance orcl (thread 1)
ORA-00312: online log 4 thread 1: '/oracle/oradata/orcl/redo04.rdo'
Solution:
First, check the status of the log group to be deleted: select * from v $ log
When the log group status is active or current, You cannot delete the log group. You need to switch logs.
8. delete files in the original log group 4 under the Operating System
9. Back up the latest Control File
SQL> connect internal
SQL> alter database backup controlfile to trace resetlogs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.