How do oracle turn off and open archive logs

  • 2020-12-26 05:59:31
  • OfStack

Check to see if the oracle database is in archive mode
SQL > select name,log_mode from V$database;

NAME LOG_MODE
------------------ ------------------------
TEST NOARCHIVELOG

SQL > archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 80157
Current log sequence 80163

Edit the archive schema for this section to configure the database
1. Change non-archive mode to archive mode:
1)SQL > conn/as sysdba (connect to database as DBA)
2)SQL > shutdown immediate; (Close the database immediately)
3)SQL > startup mount (start the instance and load the database, but do not open)
4)SQL > alter database archivelog; (Change database to archive mode)
5)SQL > alter database open; (Open the database)
6)SQL > alter system archive log start; (Enable automatic archiving)
7)SQL > exit (exit)

Do a full backup because backup logs generated in non-archive logging mode are no longer available in archive mode. This step is not very important!
2. Change archiving mode to non-archiving mode:
1)SQL > SHUTDOWN NORMAL/IMMEDIATE;
2)SQL > STARTUP MOUNT;
3)SQL > ALTER DATABASE NOARCHIVELOG;
4)SQL > ALTER DATABASE OPEN;
3. File related commands
archive log stop;
archive log start;
archive log list;

show parameters;
show parameters log_archive_start;
show parameters log_archive_max_process; # Number of archive processes
alter system set log_archive_max_process=5; # Change the number of archive processes to 5
select * from v$bgprocess; Check the background process

Related articles: