Sunteți pe pagina 1din 6

Oracle Distilled

Page 1 of 6

Home About Contact Us Terms of Use Search for:


Search

Oracle Distilled

Categories Oracle Database (70) Backup and Recovery (20) Troubleshooting (18) Errors (10) Administration (12) Database Control (2) Network (6) High Availability (12) Data Guard (12) Performance (2) SecureFiles and Large Objects (1) Security (1) Utilities (1) OCI/OCCI (1) Internals (1) Grid Control (18) TimesTen (14) Java (9) JDBC (8) Linux (6) Windows (5) VirtualBox (4) NetBeans (2) Berkeley DB (2) JDeveloper (2) Oracle Fusion Middleware (1) Weblogic (1) Video (1) MySQL (1)

Enable/Disable Archive Log Mode 10g/11g


by Eric Jenkinson on April 8, 2010 Categories: Backup and Recovery Tagged: archive log, redo log Note: It is recommended to perform a backup of the database (after a shutdown normal or immediate) prior to changing the archive status of a database. If you would like to perform these tasks using Database Console see the post Enable/Disable Archive Log Mode 10g/11g using Database Console. Enable Archive Log Mode The following are the steps required to enable archive log mode on an Oracle 10g or 11g database. Verify the database log mode. 1 [oracle@ora1 ~]$ sqlplus / as sysdba 2 3 SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:02:52 2010 4 5 Copyright (c) 1982, 2009, Oracle. All rights reserved. 6 7 Connected to: 8 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 9 With the Partitioning, OLAP, Data Mining and Real Application Testing options 10 11SQL> archive log list 12Database log mode No Archive Mode 13Automatic archival Disabled USE_DB_RECOVERY_FILE_DEST 14Archive destination

http://www.oracledistilled.com/oracle-database/backup-and-recovery/enabledisable-archi... 01/08/2011

Oracle Distilled

Page 2 of 6

15Oldest online log sequence 25 16Current log sequence 27 17SQL> The log mode is No Archive Mode. Note that Archive destination is USE_DB_RECOVERY_FILE_DEST. You can determine the path by looking at the parameter RECOVERY_FILE_DEST. 1SQL> show parameter recovery_file_dest 2 3NAME TYPE VALUE 4------------------------------------ ----------- -----------------------------string /u01/app/oracle/flash_recovery 5db_recovery_file_dest _area 6 db_recovery_file_dest_size big integer 3852M 7 8SQL> By default, archive logs will be written to the flash recovery area. If you do not want to write archive logs to the flash recovery area you can set the parameter to the location in which you wish to write archive logs.

LOG_ARCHIVE_DEST_n

1 SQL> alter system set log_archive_dest_1='LOCATION=/u02/app/oracle/oradata/orcl/arch' scope = both; 2 3 System altered. 4 5 SQL> archive log list; 6 Database log mode No Archive Mode Disabled 7 Automatic archival /u02/app/oracle/oradata/orcl/arch 8 Archive destination 9 Oldest online log sequence 25 27 10Current log sequence 11SQL> Now we shutdown the database and bring it backup in mount mode. 1 SQL> shutdown immediate 2 Database closed. 3 Database dismounted. 4 ORACLE instance shut down. 5 SQL> startup mount 6 ORACLE instance started. 7 8 Total System Global Area 849530880 bytes 1339824 bytes 9 Fixed Size 511708752 bytes 10Variable Size 331350016 bytes 11Database Buffers 5132288 bytes 12Redo Buffers 13Database mounted. SQL> 14 Lastly all that is needed it set archive log mode and open the database. 1 SQL> alter database archivelog; 2 3 Database altered. 4 5 SQL> alter database open; 6 7 Database altered. 8 9 SQL> archive log list 10Database log mode Archive Mode 11Automatic archival Enabled /u02/app/oracle/oradata/orcl/arch 12Archive destination 13Oldest online log sequence 25 27 14Next log sequence to archive 15Current log sequence 27 16SQL> We can now see that archive log mode is enabled. Notice that Automatic archive is enabled as well. In Oracle 9i an earlier another parameter needed to be set in order to enable automatic archiving. This in no longer the case in 10g and 11g as automatic archiving is enabled when the database is placed in archive log mode. You can switch to the log file to see that an archive is written to archive log location. 1 SQL> alter system switch logfile; 2 3 System altered. 4 5 SQL> host 6 [oracle@ora1 ~]$ ls /u02/app/oracle/oradata/orcl/arch 7 1_27_711369564.dbf 8 [oracle@ora1 ~]$ exit 9 exit 10 SQL> 11 Disable Archive Log Mode

http://www.oracledistilled.com/oracle-database/backup-and-recovery/enabledisable-archi... 01/08/2011

Oracle Distilled

Page 3 of 6

Note: It is recommended to perform a backup of the database (after a shutdown normal or immediate) prior to changing the archive status of a database. The following are the steps required to disable archive log mode on an Oracle 10g or 11g database. Verify the database log mode. 1 [oracle@ora1 ~]$ sqlplus / as sysdba 2 3 SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:54:05 2010 4 5 Copyright (c) 1982, 2009, Oracle. All rights reserved. 6 7 Connected to: 8 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 9 With the Partitioning, OLAP, Data Mining and Real Application Testing options 10 11SQL> archive log list; 12Database log mode Archive Mode 13Automatic archival Enabled /u02/app/oracle/oradata/orcl/arch 14Archive destination 15Oldest online log sequence 26 28 16Next log sequence to archive 28 17Current log sequence SQL> 18 The Database log mode is Archive mode. Next we shut down the database and bring up back up in mount mode. 1 SQL> shutdown immediate 2 Database closed. 3 Database dismounted. 4 ORACLE instance shut down. 5 SQL> startup mount 6 ORACLE instance started. 7 8 Total System Global Area 849530880 bytes 1339824 bytes 9 Fixed Size 511708752 bytes 10Variable Size 331350016 bytes 11Database Buffers Redo Buffers 5132288 bytes 12 Database mounted. 13 14SQL> All that is left is to disable archive log mode and open the database. 1 SQL> alter database noarchivelog; 2 3 Database altered. 4 5 SQL> alter database open; 6 7 Database altered. 8 9 SQL> archive log list; 10Database log mode No Archive Mode 11Automatic archival Disabled /u02/app/oracle/oradata/orcl/arch 12Archive destination 13Oldest online log sequence 26 28 14Current log sequence 15SQL> As you can see, ARCHIVELOG mode has been disabled.

Comments
Joseph (July 30, 2010 1:14 pm) Very clear. Thank you. Joseph Swathi (December 20, 2010 3:23 am) While enabling archivelog mode, there is an Listner error. Below are the steps followed: SQL> alter system set log_archive_dest_1=location=D:\oracle\product\10.2.0\flash_recovery_area sco pe=both; System altered. SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination D:\oracle\product\10.2.0\flash_recovery_area

http://www.oracledistilled.com/oracle-database/backup-and-recovery/enabledisable-archi... 01/08/2011

Oracle Distilled

Page 4 of 6

Oldest online log sequence 8 Current log sequence 10 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount; ORA-12514: TNS:listener does not currently know of service requested in connect descriptor Oracle version is SQL> select * from v$version ; BANNER Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 Prod PL/SQL Release 10.2.0.1.0 Production CORE 10.2.0.1.0 Production TNS for 32-bit Windows: Version 10.2.0.1.0 Production NLSRTL Version 10.2.0.1.0 Production Please provide me solution how to resovlve this error. Regards Swathi. Eric Jenkinson (December 21, 2010 5:46 am) Thank you for visiting Oracle Distilled. See the following post ORA-12514 TNS:listener does not currently know of service requested in connect descriptor Ranvir (January 28, 2011 2:09 am) HI Swati, You are using 32 bit windows server may 2003 & Oracle 10g.2. Click on windows start button> then select Run>then write>cmd > then write lsnrctl start, then your listener is go start after is you can issue your command. sql> archive log list; sql> shut immediate; sql> startup mount; sql> alter database archivelog; sql> archive log list # sql> show parameter log_ Thanks & Regards, Ranvir Meshram +919890673586 PURVESH (March 21, 2011 3:11 am) Dear Eric, What is the advantage to enable archive mode in oracle? Regards, Purvesh Prajapati PURVESH (March 21, 2011 4:38 am) Dear Eric, I have done the archiv log enble on our UAT server. I will do the monitoring and get back if any issue. Thanks for your instructions to enable archive. Regards, Purvesh Prajapati Eric Jenkinson (March 21, 2011 6:19 am) Hello Purvesh, Enabling archive log mode allows you to employ high availability features in Oracle such data guard and flashback database. Archive log mode also allows you to perform database backups while the database is online and allows point in time recovery.

http://www.oracledistilled.com/oracle-database/backup-and-recovery/enabledisable-archi... 01/08/2011

Oracle Distilled

Page 5 of 6

Eric Jenkinson (March 21, 2011 6:28 am) Hello Purvesh, One thing to monitor in your UAT environment is the LOG_ARCHIVE_DEST_1 directory. Make sure that location has enough space to hold a days worth of archive logs. If the location is filled with archive logs the database will not be able to write archive logs and will hang until space is available. The easiest way to clear the archive logs is to back them up. See the post Quick RMAN configuration for disk based backups for a quick tutorial on setting up RMAN. After that all you need to do is issues the command in RMAN. 1backup archivelog all delete input; This will backup the archive logs to the configured location and delete archive logs in the archive log directory. Ann Nicholls (April 25, 2011 9:55 am) I have a new Oracle 11g DB on an AIX platform and the DB was not in archive log mode so that import would not fill up the archive log space. I now want to put the DB in archivelog mode. After following the steps above, I attempted to backup the DB and it failed because it expected an archivelog file to exist that did not. What did I miss? I then attempted to backup just the archive logs with RMAN and received the same message. Any assistance would be reatly appreciated. I am new to 11g. Ann RMAN> backup archivelog all delete input; Starting backup at 25-APR-11 current log archived using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=398 device type=DISK RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 04/25/2011 10:47:30 RMAN-06059: expected archived log not found, lost of archived log compromises recoverability ORA-19625: error identifying file /u05/oradata/oaktst11/archive/1_104_742662353.arc ORA-27037: unable to obtain file status IBM AIX RISC System/6000 Error: 2: No such file or directory Additional information: 3 Younus (May 25, 2011 9:38 pm) Hi Ann, This is possible that some one has edited the file or deleted the required archive log file, you can do two things if you have a file backup from os you can put it back at the same location or you can unregister rman delete all the log file and then register rman * only if database is running fine Regards yass (July 16, 2011 8:16 am) Thanks David H (July 20, 2011 5:10 pm) I have Oracle 11g R2 installed in Windows 2008 R2.The instance is running in noarchivelog mode now. It is running fine. I need to put it in archivelog mode but I am having issue trying to get it startup in mount mode since it has to have the OracleServiceORCL started. Once this service is started the database is in OPEN mode. Anyone knows, How to put OracleServiceORCL in windows to start in mount mode so I can put the database in Archivelog mode? I gave shutdown immediate it went down properly SQL> SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup nomount; ORA-12514: TNS:listener does not currently know of service requested in connect descriptor At this point, I have to start OracleServiceORCL to start it but it will go straight to OPEN mode. Thank you Eric Jenkinson (July 21, 2011 1:07 pm) Hello David, It looks like you are connected using connect sys/password@dbsid. When the database is down it is no longer registered with the listener hence the error. There are two things you can do to resolve this issue. 1. Connect to the db without using a network connection connect / as sysdba 2. Statically register the database with the listener. I have document on how to do this: Configure Static Service Information for a Database

http://www.oracledistilled.com/oracle-database/backup-and-recovery/enabledisable-archi... 01/08/2011

Oracle Distilled

Page 6 of 6

Eric Jenkinson

Post A Comment
Name (required) Email (will not be published) (required)

Submit Comment

http://www.oracledistilled.com/oracle-database/backup-and-recovery/enabledisable-archi... 01/08/2011

S-ar putea să vă placă și