Manual | Automatic Archiving   «Prev  Next»
Lesson 4 Manual archiving
Objective Manually archive the online redo log files.

Manual archiving

If you do not set up the database to perform automatic archiving, the DBA must manually archive the redo log files. Manual archiving puts a greater burden on the DBA to manage the database. You have several options when choosing which redo log files you want to back up. The following table lists the options available to a DBA to manually archive redo log files:
In most cases you will use the archive all command. The alter system in the above commands is optional.
The following simulation takes a database in noarchivelog mode and puts it in archivelog mode with manual archiving of the log files. It archives the log files and then queries the database to determine its state. Let us start our simulation.
Answer File 1
1) Answer File 1
Answer File 2
2) Answer File 2
Answer File 3
3) Answer File 3
Answer File 4
4) Answer File 4
Answer File 5
5) Answer File 5
Answer File 6
6) Answer File 6
Answer File 7
7) Answer File 7
Answer File 8
8) Answer File 8
Answer File 9
9) Answer File 9

Database in noarchivelog mode and put it in archivelog mode with manual archiving

Question: How do I take a database in noarchivelog mode and put it in archivelog mode with manual archiving of the log files using SQL * Plus?
To switch a database from NOARCHIVELOG mode to ARCHIVELOG mode with manual archiving of the log files using SQL*Plus, follow these steps:
  1. Make sure you have a backup of your database before proceeding, as this process involves shutting down the database and changing its mode.
  2. Connect to the database with SYSDBA privileges using SQL*Plus
    sqlplus / as sysdba
    
  3. Shut down the database:
    SHUTDOWN IMMEDIATE;
    
  4. Start the database in MOUNT mode:
    STARTUP MOUNT;
    
  5. Enable ARCHIVELOG mode:
    ALTER DATABASE ARCHIVELOG;
    
  6. Open the database:
    ALTER DATABASE OPEN;
    

Now your database is in ARCHIVELOG mode. However, you still need to set up manual archiving for the log files. Follow these steps to configure manual archiving:
  1. Identify the location of your archived redo log files. You can use the following command to find the default location:
    SHOW PARAMETER log_archive_dest;
    

    If you want to change the location, you can use the following command to set a new directory:
    ALTER SYSTEM SET log_archive_dest='/path/to/your/archive/directory' SCOPE=spfile;
    
  2. Manually archive log files using the following command:
    ALTER SYSTEM ARCHIVE LOG CURRENT;
    

    You will need to run this command whenever you want to archive your log files manually.
  3. (Optional) To automate the manual archiving process, you can create a scheduled task or cron job that runs the "ALTER SYSTEM ARCHIVE LOG CURRENT" command at specified intervals.
Remember to monitor your archived redo log files directory to avoid running out of disk space. You can also consider configuring a log rotation policy or setting up a backup solution to handle the archived log files.
Please note that manual archiving is generally not recommended for production databases, as it can be error-prone and may lead to data loss in case of a failure. It's usually better to use an automatic archiving process for production databases to ensure data consistency and recoverability.

Setting manual archive logging

  1. Enter svrmgr30 at the DOS prompt and hit return.
  2. Connect to the database as the user internal by entering connect internal at the SVRMGR> prompt, and hitting return.
  3. At this point you would normally enter the password at the prompt. Since the password does not echo and the cursor doesn't move forward when you enter the password, just click the space after Password: and we'll move you to the next screen.
  4. Now let's specify the database orc1. Enter startup mount orc1; at the prompt and hit return.
  5. Enter alter database orc1 archivelog; at the prompt and hit return. This will sets up the database for archivelog mode.
  6. Enter alter database orc1 open; at the prompt and hit return. This opens the database so it can be accessed by the users.
  7. Enter archive log all; at the prompt and hit return. This archives the online redo logs that have not been previously archived. In our case we are archiving two log files.
  8. Enter archive log list; at the prompt and hit return. This returns our archive log information.
  9. The information for the archive log list command is displayed. You can now exit server manager by entering exit at the prompt and hitting return. This is the end of the simulation.

Manual Archiving - Exercise

Click the Exercise link below to test your understanding of the manual archive processing.
Manual Archiving - Exercise The next lesson is about automatic archiving of the redo log files.