Friday, July 06, 2007

Exercise - Switch the database archiving mode from NOARCHIVELOG to ARCHIVELOG

Exercise - Switch the database archiving mode from NOARCHIVELOG to
ARCHIVELOG
--------------------------------------------------------------------
Environment: Oracle 10g

1. Shut down the database instance.

sys@TOY10G> shutdown;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@TOY10G>


An open database must first be closed and any associated instances shut
down
before you can switch the database archiving mode. You cannot change the
mode from
ARCHIVELOG to NOARCHIVELOG if any datafiles need media recovery.

2. Back up the database.

Before making any major change to a database, always back up the
database to protect
against any problems. This will be your final backup of the database in
NOARCHIVELOG
mode and can be used if something goes wrong during the change to
ARCHIVELOG mode.

3. Edit the initialization parameter file to include the initialization
parameters
that specify the destinations for the archive log files.

log_archive_dest_1 =
"LOCATION=/ora01/orabkup/GENQ/.temp_toy10g/ora01/oraarch/TOY10G"
log_archive_dest_state_1 = enable
LOG_ARCHIVE_FORMAT = arch_%t_%s_%r.arc


4. Start a new instance and mount, but do not open, the database.

idle> conn / as sysdba
Connected to an idle instance.
idle> startup mount
pfile='/ora01/orabkup/GENQ/.temp_toy10g/oracle/admin/TOY10G/pfile/initTO
Y10G.ora';
ORACLE instance started.

Total System Global Area 268435456 bytes
Fixed Size 2029392 bytes
Variable Size 92276912 bytes
Database Buffers 167772160 bytes
Redo Buffers 6356992 bytes
Database mounted.


To enable or disable archiving, the database must be mounted but not
open.

4. Change the database archiving mode. Then open the database for normal
operations.

ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

idle> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination
/ora01/orabkup/GENQ/.temp_toy10g/ora01/oraarch/TOY10G
Oldest online log sequence 476
Next log sequence to archive 478
Current log sequence 478


5. Shut down the database.

SHUTDOWN IMMEDIATE

6. Back up the database.

Changing the database archiving mode updates the control file. After
changing the database archiving mode, you must back up all of your
database files and control file. Any previous backup is no longer usable
because it was taken in NOARCHIVELOG mode.

No comments: