Oracle basic operations on Log Files

Source: Internet
Author: User

1. query the list of log files used:
Select * from v $ log;

2. query the log files of the Group in use:
Select * from v $ logfile;

3. Force log switching:
Alter system switch logfile;

4. query historical logs:
Select * from v $ log_history;

5. Log archiving mode:
Select dbid, name, created, log_mode from v $ database;

6. query the archived log information:
Select recid, stamp, thread #, sequence #, name from v $ archived_log;

7. add and delete a log file group
Alter database add logfile group 1 ('/home1/Oracle/oradata/ora8i/log1a. log'), '/home2/oracle/oradata/ora8i/log1b. log') size 100 M;

Alter database drop logfile group 1;

8. add and delete log members
Alter database add logfile member '/home1/oracle/oradata/ora8i/log1a. log 'to group 1,'/home1/oracle/oradata/ora8i/log2a. log' to group 2;

Alter database drop logfile member '/home1/oracle/oradata/ora8i/log1a. log ';

9. Move log files
Alter database rename file '/home1/oracle/oradata/ora8i/log1a. log' to'/home2/oracle/oradata/ora8i/log1a. log ';
Before executing this command, make sure that the log file has been physically moved to the new directory.

10. Clear log files
Alter database clear logfile '/home1/oracle/oradata/ora8i/log1a. log ';
This command is used when you cannot use the delete group or group member command to delete logs.

8. view the space occupied by archived logs:
SELECT space_limit/1024/1024/1024 AS "Quota_G", space_used/1024/1024 AS "Used_M", space_used/space_limit * 100 "Used _ %", space_reclaimable AS reclaimable, number_of_files AS files FROM v $ recovery_file_dest;

9. Modify the size of the archive log Space
Alter system set DB_RECOVERY_FILE_DEST_SIZE = 40g;

10. view the archived log list
RMAN> list archivelog all;
Delete archived logs
RMAN> delete archivelog until time 'sysdate-1 ';
Dual-host can also be used
Delete obsolete;
Crosscheck archivelog all;
Delete expired archivelog all;

11. Use list expired to check whether there is any invalid archive log, and verify that there is no invalid archive log:
RMAN> list expired archivelog all;

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.