Home » RDBMS Server » Server Administration » Difference in ALTER commands with redo/archive logs
Difference in ALTER commands with redo/archive logs [message #213656] Thu, 11 January 2007 13:41 Go to next message
clintonf
Messages: 82
Registered: May 2006
Member
Hi everyone,

What is the difference between the following two statements?

`ALTER system SWITCH logfile;`

and

`ALTER system ARCHIVE log CURRENT;`

I have read that statement 1 "Causes a redo log switch" (http://www.adp-gmbh.ch/ora/sql/alter_system.html)

while statement 2 "...switch out of the current log and archive it as well as all other unarchived logs" (http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96519/backup.htm)

They both sound similar but I am not sure where the differences lie, except that statement 1 says nothing about actually archiving the switched redo log.

Thanks!

Re: Difference in ALTER commands with redo/archive logs [message #213661 is a reply to message #213656] Thu, 11 January 2007 14:39 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
When in NOARCHIVELOG mode, 'ALTER SYSTEM ARCHIVE LOG CURRENT' does not work:

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            E:\oracle\ora92\RDBMS
Oldest online log sequence     1
Current log sequence           2

SQL> ALTER system ARCHIVE log CURRENT;
ALTER system ARCHIVE log CURRENT
*
ERROR at line 1:
ORA-00258: manual archiving in NOARCHIVELOG mode must identify log

SQL> ALTER system SWITCH logfile;

System altered.

SQL>


and while in ARCHIVELOG mode with MANUAL archiving, 'ALTER SYSTEM SWITCH LOGFILE' will hang if the archivelogs aren't archived manually:

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Disabled
Archive destination            E:\oracle\ora92\RDBMS
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL> ALTER system SWITCH logfile;

System altered.

SQL> ALTER system SWITCH logfile;

System altered.

SQL> ALTER system SWITCH logfile;

--hangs here until I go into another session and issue 'ALTER SYSTEM ARCHIVE LOG CURRENT'.

While in ARCHIVELOG mode with AUTOMATIC archiving, the two commands are essentially the same, however if running RAC, the 'ALTER SYSTEM ARCHIVE LOG CURRENT' allows you to specify a THREAD parameter too.

[Updated on: Thu, 11 January 2007 14:51]

Report message to a moderator

Re: Difference in ALTER commands with redo/archive logs [message #213662 is a reply to message #213661] Thu, 11 January 2007 14:51 Go to previous messageGo to next message
clintonf
Messages: 82
Registered: May 2006
Member
Does that mean that:

'ALTER SYSTEM SWITCH LOGFILE' switches to the next sequential redo log but does NOT archive the current log sequence

and

'ALTER SYSTEM ARCHIVE LOG CURRENT' switches to the next redo log and DOES archive the current log sequence?

How do the commands differ if you are in ARCHIVELOG mode with AUTOMATIC archiving?

Thanks!
Re: Difference in ALTER commands with redo/archive logs [message #213678 is a reply to message #213656] Thu, 11 January 2007 17:23 Go to previous message
gkrishn
Messages: 506
Registered: December 2005
Location: Putty a dark screen
Senior Member
There are only three conditions where log switch takes place.

1. redo log is filled up
2. alter system switch logfile
3. alter system archivelog current

and in ur case (in ARCHIVE mode),both statememnts work same way .
switch log file and archive previous log file(s).
Previous Topic: Create Database - Error in Archive format
Next Topic: IDLE_TIME
Goto Forum:
  


Current Time: Tue Dec 06 14:03:37 CST 2016

Total time taken to generate the page: 0.08730 seconds