Monday, August 15, 2011

Create a Restore Point

SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=25G;

System altered.

SQL> alter system set db_recovery_file_dest='+DSKGRP';

System altered.

SQL> shu immediate
startup Database closed.
Database dismounted.

SQL> startup mount
ORACLE instance started.

Total System Global Area 6580703232 bytes
Fixed Size 2219168 bytes
Variable Size 3758097248 bytes
Database Buffers 2801795072 bytes
Redo Buffers 18591744 bytes
Database mounted.

SQL> ALTER DATABASE ARCHIVELOG ;

Database altered.

SQL> CREATE RESTORE POINT TEST_REC_PT GUARANTEE FLASHBACK DATABASE;

Restore point created.

SQL> shu immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

SQL>startup
ORACLE instance started.
Total System Global Area 6580703232 bytes
Fixed Size 2219168 bytes
Variable Size 3758097248 bytes
Database Buffers 2801795072 bytes
Redo Buffers 18591744 bytes
Database mounted.
Database opened.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 320
Next log sequence to archive 322
Current log sequence 322
SQL>

Thursday, August 11, 2011

How to enable Automatic ArchiveLog in Oracle 11g Database

To check whether the database is in Archive log mode or not

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination None
Oldest online log sequence 564
Current log sequence 566

Set the archival destination

SQL> alter system set log_archive_dest_1='LOCATION=PRMRYDSK_GRP' scope=both;

System altered.

Shutdown the database and start in Mount state

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.
Total System Global Area 8752304128 bytes
Fixed Size 2213792 bytes
Variable Size 1543506016 bytes
Database Buffers 7180648448 bytes
Redo Buffers 25935872 bytes
Database mounted.

Enable archive log

SQL>alter database archivelog;

Database altered.

Open the database
SQL> alter database open;

Database altered.

Shutdown and startup the DB.(This step is not mandatory)

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.
Total System Global Area 8752304128 bytes
Fixed Size 2213792 bytes
Variable Size 1543506016 bytes
Database Buffers 7180648448 bytes
Redo Buffers 25935872 bytes
Database mounted.
Database opened.

Check whether the automatic archive log mode is enabled

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination PRMRYDSK_GRP
Oldest online log sequence 564
Next log sequence to archive 566
Current log sequence 566
SQL>