Steps for setting archive Mode

Source: Internet
Author: User

Step 1. step 1. shut down the database normally. 2. place the database in the mount status. 3. change the database to archivelog mode. 4. open the database 5. close the database normally and make a full backup

sQL> conn /  as sysdbaConnected to an idle instance.SQL> startup mountORACLE instance started.Total System Global Area  146472960 bytesFixed Size                  1335080 bytesVariable Size              92274904 bytesDatabase Buffers           50331648 bytesRedo Buffers                2531328 bytesDatabase mounted.SQL> alter database archivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log listDatabase log mode              Archive ModeAutomatic archival             EnabledArchive destination            /u01/admin/wilson/testOldest online log sequence     114Next log sequence to archive   116Current log sequence           116

 

Next, clean the database and make a full backup. 2. In 10 Gb, when the database is in archive mode, you must set two parameters: log_archive_star and log_archive_max_processes. 1. In archive mode, there are two ways to copy the online redo log to the specified location: manual and automatic. The method selected depends on the parameter log_archive_start. If it is true, it is automatic; if it is false, it is manual. Automatic mode is recommended. 2. The number of ARC processes involved in the automatic archiving mode is determined by the log_archive_max_processes parameter. Iii. Changing the automatic archiving mode and manual archiving mode when the instance is running. 1. You can use the archive log list command to view the archive method,
SQL> archive log listDatabase log mode              Archive ModeAutomatic archival             EnabledArchive destination            /u01/admin/wilson/testOldest online log sequence     116Next log sequence to archive   118Current log sequence           118

 

2. How can I change the database to an automatic mode when log_archive_star = false (manually) is started? Create a file to store archived logs and create the arcdest folder in the/u01/admin/wilson/directory. Then
SQL> alter system archive log start to '/u01/admin/wilson/archdest';System altered.

 

Now it is automatically archived,
SQL> alter system set log_archive_start=true scope=spfile;System altered.

 

The initialization parameter log_archive_start = true is modified. The next restart or dynamic archiving is performed. 3. Change the automatic mode to the manual mode,
SQL> alter system archive log stop;System altered.SQL> alter system set log_archive_start=false scope=spfile;System altered.

 

It should be noted that in 11g, as long as it is in Archivelog mode, the archive mode is automatic, and there is no automatic archiving or manual conversion. In archive mode, you must archive a group of online redo logs to a specified place before they are overwritten. Otherwise, the database will be hang there !!! Iv. Path of the archive file 1. in earlier versions, the location is specified by the log_archive_dest parameter and log_archive_duplex_dest parameter, and only two are allowed. They must be used in the database Standard Edition. 2. Currently, you can use the log_archive_dest_n parameter to specify a maximum of 10 (n = 1... 10). It can only be used in enterprise databases. This section describes log_archive_dest_n
log_archive_dest_1=”location=/archive/  mandatory”log_archive_dest_1=”location=/archive/  optional”log_archive_dest_2=”service=standy_db1”

 

Location indicates the local address, and service indicates the remote network address. Mandatory indicates that the online redo log file must be archived to this address before being overwritten, optional indicates that an online redo log file can be overwritten even if it is not archived to this address. 3. For the parameter log_archive_min_succeed_dest, such as log_archive_min_succeed_dest = 2, it indicates that an online redo log file must be archived to two places before being overwritten. According to the log_archive_dest_n and log_archive_min_succeed_dest parameters, before an online redo log file is overwritten, it must be completed: (1) All are successfully written to the archive address with the mandatory parameter. (2) The successfully archived address must be greater than or equal to the value specified by log_archive_min_succeed_dest. That is to say, if (1) the number of archived addresses is greater than the value in (2), the value specified in (2) is ignored, and the value (1) prevails. If the value specified in (2) is greater than the value in (1), first (1) all files must be archived successfully, and then the value archived in (2) must be reached. 4. log_archive_dest_state_n can dynamically control whether an archive address is valid. For example, log_archive_dest_state_1 = enable indicates that the archive address of log_archive_dest_1 can be used. Token = defer indicates that the archive address of log_archive_dest_2 cannot be used. log_archive_dest_state_3 = alternate indicates that the archive address of log_archive_dest_3 cannot be used currently, but when another address is invalid, it automatically becomes an available address. 5. The format of the archive file name: log_archive_dest_n specifies the address directory of the archive file, but the actual file name format is set by the log_archive_format parameter. For example,/u01/admin/wilson/test/wilson _ % t _ % S _ % r. in the arc,/u01/admin/wilson/test is specified by log_archive_dest_n, and wilson _ % t _ % S _ % r. arc is specified by log_archive_format. (1) % t: thread number, which is displayed as the thread # column in the V $ instance view. It is useful in the RAC database and is 1 in a single instance. (2) % s or % S: indicates the log switch serial number. This variable ensures that the archived logs in any database are not overwritten. % S indicates that each serial number is the same length, 10 bits, not long enough, and the front is zero. (3) % r: Scene number. If Incomplete recovery is performed, this variable is very important. The file name format in 11g must be % s or % S, % t, % r. For example:
Create a test file in/u01/admin/wilson. SQL> alter system set log_archive_dest_1 = "location =/u01/admin/wilson/archtest"; System altered. SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination/u01/admin/wilson/archtestOldest online log sequence 116 Next log sequence to archive 118 Current log sequence 118 indicates that Archive destination has been modified. SQL> alter system set log_archive_format = "sun _ % t _ % S _ % r. arc "scope = spfile; System altered. disable restart. SQL> show parameter archivelog_archive_duplex_dest stringlog_archive_format string sun _ % t _ % S _ % r. arclog_archive_local_first boolean TRUElog_archive_max_processes integer between integer 1log_archive_start boolean TRUElog_archive_trace integer 0standby_archive_dest string? /Dbs/arch: log_archive_format is changed. SQL> alter system switch logfile; System altered. SQL>! Ls-l/u01/admin/wilson/archtesttotal 7720-rw-r ----- 1 oracle oinstall 7624192 Aug 17 0sun_1_0000000118_805499090.arc-rw-r ----- 1 oracle oinstall 241664 Aug 17 0sun_1_0000000119_805499090.arc-rw-r ----- 1 oracle oinstall 5632 Aug 17 0bytes

 

You can see the format of the archive file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.