Specify the name of the database to be altered. The database name can contain only ASCII characters. If you omit database, Oracle Database alters the database identified by the value of the initialization parameter DB_NAME. You can alter only the database whose control files are specified by the initialization parameter CONTROL_FILES. The database identifier is not related to the Oracle Net database specification.

startup_clauses

The startup_clauses let you mount and open the database so that it is accessible to users.

MOUNT Clause

Use the MOUNT clause to mount the database. Do not use this clause when the database is already mounted.

MOUNT STANDBY DATABASE

You can specify MOUNTSTANDBYDATABASE to mount a physical standby database. The keywords STANDBYDATABASE are optional, because Oracle Database determines automatically whether the database to be mounted is a primary or standby database. As soon as this statement executes, the standby instance can receive archived redo logs from the primary instance and can archive the logs to the STANDBY_ARCHIVE_DEST location.

Use the OPEN clause to make the database available for normal use. You must mount the database before you can open it.

If you specify only OPEN, without any other keywords, the default is OPENREADWRITENORESETLOGS on a primary database and OPENREADONLY on a standby database.

OPEN READ WRITE

Specify OPENREADWRITE to open the database in read/write mode, allowing users to generate redo logs. This is the default if you are opening a primary database. You cannot specify this clause for a physical standby database.

This clause determines whether Oracle Database resets the current log sequence number to 1, archives any unarchived logs (including the current log), and discards any redo information that was not applied during recovery, ensuring that it will never be applied. Oracle Database uses NORESETLOGS automatically except in the following specific situations, which require a setting for this clause:

You must specify RESETLOGS:

After performing incomplete media recovery or media recovery using a backup controlfile

After a previous OPENRESETLOGS operation that did not complete

After a FLASHBACKDATABASE operation

If a created controlfile is mounted, then you must specify RESETLOGS if the online logs are lost, or you must specify NORESETLOGS if they are not lost.

UPGRADE | DOWNGRADE

Use these OPEN clause parameters only if you are upgrading or downgrading a database. This clause instructs Oracle Database to modify system parameters dynamically as required for upgrade and downgrade, respectively. You can achieve the same result using the SQL*Plus STARTUPUPGRADE or STARTUPDOWNGRADE command.

Specify OPENREADONLY to restrict users to read-only transactions, preventing them from generating redo logs. This setting is the default when you are opening a physical standby database, so that the physical standby database is available for queries even while archive logs are being copied from the primary database site.

Restrictions on Opening a Database

You cannot open a database in READONLY mode if it is currently opened in READWRITE mode by another instance.

You cannot open a database in READONLY mode if it requires recovery.

You cannot take tablespaces offline while the database is open in READONLY mode. However, you can take datafiles offline and online, and you can recover offline datafiles and tablespaces while the database is open in READONLY mode.

recovery_clauses

The recovery_clauses include post-backup operations. For all of these clauses, Oracle Database recovers the database using any incarnations of datafiles and log files that are known to the current control file.

The general_recovery clause lets you control media recovery for the database or standby database or for specified tablespaces or files. You can use this clause when your instance has the database mounted, open or closed, and the files involved are not in use.

Restrictions on General Database Recovery

You can recover the entire database only when the database is closed.

Your instance must have the database mounted in exclusive mode.

You can recover tablespaces or datafiles when the database is open or closed, if the tablespaces or datafiles to be recovered are offline.

You cannot perform media recovery if you are connected to Oracle Database through the shared server architecture.

Note:

If you do not have special media requirements, Oracle recommends that you use the SQL*Plus RECOVER command rather than the general_recovery_clause.

Specify AUTOMATIC if you want Oracle Database to automatically generate the name of the next archived redo log file needed to continue the recovery operation. If the LOG_ARCHIVE_DEST_n parameters are defined, Oracle Database scans those that are valid and enabled for the first local destination. It uses that destination in conjunction with LOG_ARCHIVE_FORMAT to generate the target redo log filename. If the LOG_ARCHIVE_DEST_n parameters are not defined, Oracle Database uses the value of the LOG_ARCHIVE_DEST parameter instead.

If the resulting file is found, Oracle Database applies the redo contained in that file. If the file is not found, Oracle Database prompts you for a filename, displaying the generated filename as a suggestion.

If you specify neither AUTOMATIC nor LOGFILE, Oracle Database prompts you for a filename, displaying the generated filename as a suggestion. You can then accept the generated filename or replace it with a fully qualified filename. If you know that the archived filename differs from what Oracle Database would generate, you can save time by using the LOGFILE clause.

FROM 'location'

Specify FROM'location' to indicate the location from which the archived redo log file group is read. The value of location must be a fully specified file location following the conventions of your operating system. If you omit this parameter, Oracle Database assumes that the archived redo log file group is in the location specified by the initialization parameter LOG_ARCHIVE_DEST or LOG_ARCHIVE_DEST_1.

full_database_recovery

The full_database_recovery clause lets you recover an entire database.

DATABASE

Specify the DATABASE clause to recover the entire database. This is the default. You can use this clause only when the database is closed.

STANDBY DATABASE

Specify the STANDBYDATABASE clause to manually recover a physical standby database using the control file and archived redo log files copied from the primary database. The standby database must be mounted but not open.

This clause recovers only online datafiles.

Use the UNTIL clause to specify the duration of the recovery operation.

CANCEL indicates cancel-based recovery. This clause recovers the database until you issue the ALTERDATABASE statement with the RECOVERCANCEL clause.

TIME indicates time-based recovery. This parameter recovers the database to the time specified by the date. The date must be a character literal in the format 'YYYY-MM-DD:HH24:MI:SS'.

CHANGE indicates change-based recovery. This parameter recovers the database to a transaction-consistent state immediately before the system change number specified by integer.

Specify USINGBACKUPCONTROLFILE if you want to use a backup control file instead of the current control file.

partial_database_recovery

The partial_database_recovery clause lets you recover individual tablespaces and datafiles.

TABLESPACE

Specify the TABLESPACE clause to recover only the specified tablespaces. You can use this clause if the database is open or closed, provided the tablespaces to be recovered are offline.

Specify the DATAFILE clause to recover the specified datafiles. You can use this clause when the database is open or closed, provided the datafiles to be recovered are offline.

You can identify the datafile by name or by number. If you identify it by number, then filenumber is an integer representing the number found in the FILE# column of the V$DATAFILE dynamic performance view or in the FILE_ID column of the DBA_DATA_FILES data dictionary view.

STANDBY TABLESPACE

Specify STANDBYTABLESPACE to reconstruct a lost or damaged tablespace in the standby database using archived redo log files copied from the primary database and a control file.

STANDBY DATAFILE

Specify STANDBYDATAFILE to manually reconstruct a lost or damaged datafile in the physical standby database using archived redo log files copied from the primary database and a control file. You can identify the file by name or by number, as described for the DATAFILE clause.

Specify UNTIL [CONSISTENTWITH] CONTROLFILE if you want the recovery of an old standby datafile or tablespace to use the current standby database control file. However, any redo in advance of the standby controlfile will not be applied. The keywords CONSISTENTWITH are optional and are provided for semantic clarity.

Use the TEST clause to conduct a trial recovery. A trial recovery is useful if a normal recovery procedure has encountered some problem. It lets you look ahead into the redo stream to detect possible additional problems. The trial recovery applies redo in a way similar to normal recovery, but it does not write changes to disk, and it rolls back its changes at the end of the trial recovery.

You can use this clause only if you have restored a backup taken since the last RESETLOGS operation. Otherwise, Oracle Database returns an error.

ALLOW ... CORRUPTION

The ALLOWintegerCORRUPTION clause lets you specify, in the event of logfile corruption, the number of corrupt blocks that can be tolerated while allowing recovery to proceed.

When you use this clause during trial recovery (that is, in conjunction with the TEST clause), integer can exceed 1. When using this clause during normal recovery, integer cannot exceed 1.

Use the PARALLEL clause to specify whether the recovery of media will be parallelized.

For complete information on this clause, please refer to parallel_clause in the documentation on CREATETABLE.

CONTINUE

Specify CONTINUE to continue multi-instance recovery after it has been interrupted to disable a thread.

Specify CONTINUEDEFAULT to continue recovery using the redo log file that Oracle Database would automatically generate if no other logfile were specified. This clause is equivalent to specifying AUTOMATIC, except that Oracle Database does not prompt for a filename.

CANCEL

Specify CANCEL to terminate cancel-based recovery.

managed_standby_recovery

The managed_standby_recovery clause applies to physical standby only. Use it to specify managed standby recovery mode. This mode assumes that the managed standby database is an active component of an overall standby database architecture. A primary database actively archives its redo log files to the standby site. As these archived redo logs arrive at the standby site, they become available for use by a managed standby recovery operation. Managed standby recovery is restricted to media recovery. You can use this clause when your instance has the database mounted, open or closed, and the files involved are not in use.

Specify DISCONNECT to indicate that the managed redo process (MRP), an Oracle Database background process, should apply archived redo files as a detached background process. Doing so leaves the current session available for other tasks. The FROMSESSION keywords are optional and are provided for semantic clarity.

Restrictions on DISCONNECT

You can specify DISCONNECT only when you are initiating managed standby recovery. You cannot specify it after the operation has started.

Specify in minutes the wait period of the managed recovery operation. The recovery process waits for integer minutes for a requested archived log redo to be available for writing to the managed standby database. If the redo log file does not become available within that time, the recovery process terminates with an error message. You can then issue the statement again to return to managed standby recovery mode.

If you omit TIMEOUT or if you specify NOTIMEOUT, the database remains in managed standby recovery mode until you reissue the statement with the RECOVERCANCEL clause or until instance shutdown or failure.

Specify DELAY to instruct Oracle Database to wait the specified interval (in minutes) before applying the archived redo logs. The delay interval begins after the archived redo logs have been selected for recovery.

Specify NODELAY if the need arises to apply a delayed archivelog immediately on the standby database.

Specify DEFAULTDELAY to revert to the number of minutes specified in the LOG_ARCHIVE_DEST_n initialization parameter on the primary database.

Both of these parameters override any setting of DELAY in the LOG_ARCHIVE_DEST_n parameter on the primary database. If you specify neither of these parameters, application of the archivelog is delayed according to the LOG_ARCHIVE_DEST_n setting. If DELAY was not specified in that parameter, the archivelog is applied immediately.

Use the NEXT parameter to apply the specified number of archived redo logs as soon as possible after they have been archived. This parameter temporarily overrides any delay setting in the LOG_ARCHIVE_DEST_n initialization parameter on the primary database and any DELAY values specified in an earlier ALTERDATABASE ... managed_standby_recovery statement. Once the integer archived redo logs are processed, any such delay again takes effect.

Specify the number of minutes from the current time after which the managed recovery operation terminates automatically. The process may actually expire after the interval specified, because Oracle Database will finish processing any archived redo log that is being processed at the expiration time.

Specify NOEXPIRE to disable a previously specified EXPIRE option.

Expiration is always relative to the time the current statement is issued rather than to the start time of the managed recovery process. To terminate an existing managed recovery operation, use the CANCEL parameter.

Restriction on EXPIRE

If you specify EXPIRE, you cannot also specify FINISH.

parallel_clause

Use the parallel_clause to indicate whether Oracle Database should parallelize the managed recovery processes. If you specify NOPARALLEL or omit this clause entirely, Oracle Database performs the managed standby recovery operation serially. Please refer to the parallel_clause for more information on this clause.

Use this clause to instruct Oracle Database to conduct managed recovery up to but not including the specified system change number.

USING CURRENT LOGFILE Clause

Specify USINGCURRENTLOGFILE to invoke real time apply, which lets you recover redo from standby online logs as they are being filled up, without requiring them first to be archived at the standby database.

Use this clause to instruct Oracle Database when to terminate managed recovery.

THROUGH ... SEQUENCE: Specify this clause if you want Oracle Database to terminate managed recovery based on thread number and sequence number of an archivelog. Once the corresponding archivelog has been applied, managed recovery terminates. If you omit the THREAD clause, Oracle Database assumes thread 1.

THROUGHALLARCHIVELOG: Specify this clause if you want Oracle Database to continue the managed standby process until all archivelogs have been recovered. You can use this statement to override an earlier statement that specified THROUGH ... SEQUENCE. If you omit the THROUGH clause entirely, this is the default.

THROUGH ... SWITCHOVER: The managed standby recovery process normally stops when it encounters a switchover operation, because such operations produce an end-of-redo archival indicator. This clause is useful if you have more than one standby database, all but one of which will remain in the standby role after the switchover. This clause keeps the managed standby recovery process operational. It lets these secondary standby databases wait to receive the redo stream from the new primary database, rather than stopping the recovery process and then starting it again after the new primary database is activated.

Specify ALL to keep managed standby recovery operational through all switchover operations.

Specify LAST to cancel managed standby recovery operations after the final end-of-redo archival indicator.

Specify NEXT to cancel managed standby recovery after recovering the next end-of-redo archival indicator encountered. This is the default.

CANCEL

Specify CANCEL to terminate the managed standby recovery operation after applying all the redo in the current archived redo file. If you specify only the CANCEL keyword, session control returns when the recovery process actually terminates.

Specify CANCELIMMEDIATE to terminate the managed recovery operation after applying all the redo in the current archived redo file or after the next redo log file read, whichever comes first. Session control returns when the recovery process actually terminates.

CANCELIMMEDIATENOWAIT is the same as CANCELIMMEDIATE except that session control returns immediately, not after the recovery process terminates.

CANCELNOWAIT terminates the managed recovery operation after the next redo log file read and returns session control immediately.

Restriction on CANCEL IMMEDIATE

The CANCELIMMEDIATE clause cannot be issued from the same session that issued the RECOVERMANAGEDSTANDBYDATABASE statement.

FINISH

The FINISH clause applies only to physical standby databases. Specify FINISH to recover the current standby online redo logfiles of the standby database. Use this clause only in the event of the failure of the primary database, when the logwriter (LGWR) process has been transmitting redo to the standby current logs. This clause overrides any delay intervals specified for the archivelogs. Oracle Database applies the logs immediately.

After the FINISH operation, you must open the standby database as the primary database.

Specify NOWAIT to have control returned immediately rather than after the recovery process is complete.

Restriction on FINISH

You cannot specify FINISH if you have also specified TIMEOUT, DELAY, EXPIRE, or NEXT.

BACKUP Clauses

Use these clauses to move all the datafiles in the database into or out of online backup mode (also called hot backup mode).

See Also:

ALTER TABLESPACE for information on moving all datafiles in an individual tablespace into and out of online backup mode

BEGIN BACKUP Clause

Specify BEGINBACKUP to move all datafiles in the database into online backup mode. The database must be mounted and open, and media recovery must be enabled (the database must be in archivelog mode).

While the database is in online backup mode, you cannot shut down the instance normally, begin backup of an individual tablespace, or take any tablespace offline or make it read only.

This clause has no effect on datafiles that are in offline or on read-only tablespaces.

END BACKUP Clause

Specify ENDBACKUP to take out of online backup mode any datafiles in the database currently in online backup mode. The database must be mounted (either open or closed) when you perform this operation.

After a system failure, instance failure, or SHUTDOWNABORT operation, Oracle Database does not know whether the files in online backup mode match the files at the time the system crashed. If you know the files are consistent, you can take either individual datafiles or all datafiles out of online backup mode. Doing so avoids media recovery of the files upon startup.

To take an individual datafile out of online backup mode, use the ALTERDATABASEDATAFILE ... ENDBACKUP statement. See database_file_clauses .

To take all datafiles in a tablespace out of online backup mode, use an ALTERTABLESPACE ... ENDBACKUP statement.

database_file_clauses

The database_file_clauses let you modify datafiles and tempfiles. You can use any of the following clauses when your instance has the database mounted, open or closed, and the files involved are not in use.

RENAME FILE Clause

Use the RENAMEFILE clause to rename datafiles or redo log file members. You must create each filename using the conventions for filenames on your operating system before specifying this clause. This clause is not valid for renaming tempfiles.

To use this clause for datafiles, the database must be mounted. The database can also be open, but the datafile being renamed must be offline.

To use this clause for logfiles, the database must be mounted but not open.

If you have enabled block change tracking, you can use this clause to rename the block change tracking file. The database must be mounted but not open when you rename the block change tracking file.

This clause renames only files in the control file. It does not actually rename them on your operating system. The operating system files continue to exist, but Oracle Database no longer uses them.

Use the CREATEDATAFILE clause to create a new empty datafile in place of an old one. You can use this clause to re-create a datafile that was lost with no backup. The filename or filenumber must identify a file that is or was once part of the database. If you identify the file by number, then filenumber is an integer representing the number found in the FILE# column of the V$DATAFILE dynamic performance view or in the FILE_ID column of the DBA_DATA_FILES data dictionary view.

Specify ASNEW to create an Oracle-managed datafile with a system-generated filename, the same size as the file being replaced, in the default file system location for datafiles.

Specify ASfile_specification to assign a file name (and optional size) to the new datafile. Use the datafile_tempfile_spec form of file_specification (see file_specification ) to list regular datafiles and tempfiles in an operating system file system or to list Automatic Storage Management disk group files.

If the original file (filename or filenumber) is an existing Oracle-managed datafile, then Oracle Database attempts to delete the original file after creating the new file. If the original file is an existing user-managed datafile, Oracle Database does not attempt to delete the original file.

If you omit the AS clause entirely, Oracle Database creates the new file with the same name and size as the file specified by filename or filenumber.

During recovery, all archived redo logs written to since the original datafile was created must be applied to the new, empty version of the lost datafile.

Oracle Database creates the new file in the same state as the old file when it was created. You must perform media recovery on the new file to return it to the state of the old file at the time it was lost.

Restrictions on Creating New Datafiles

You cannot create a new file based on the first datafile of the SYSTEM tablespace.

You cannot specify the autoextend_clause of datafile_tempfile_spec in this CREATEDATAFILE clause.

See Also:

"DATAFILE Clause " of CREATEDATABASE for information on the result of this clause if you do not specify a name for the new datafile

The DATAFILE clause lets you manipulate a file that you identify by name or by number. If you identify it by number, then filenumber is an integer representing the number found in the FILE# column of the V$DATAFILE dynamic performance view or in the FILE_ID column of the DBA_DATA_FILES data dictionary view. The DATAFILE clauses affect your database files as follows:

ONLINE

Specify ONLINE to bring the datafile online.

OFFLINE

Specify OFFLINE to take the datafile offline. If the database is open, you must perform media recovery on the datafile before bringing it back online, because a checkpoint is not performed on the datafile before it is taken offline.

FOR DROP

If the database is in noarchivelog mode, you must specify FORDROP clause to take a datafile offline. However, this clause does not remove the datafile from the database. To do that, you must use an operating system command or drop the tablespace in which the datafile resides. Until you do so, the datafile remains in the data dictionary with the status RECOVER or OFFLINE.

If the database is in archivelog mode, Oracle Database ignores the FORDROP clause.

In earlier releases, the OFFLINEFORDROP clause was documented as OFFLINEDROP, with the same semantics. That syntax is still supported for back ward compatibility. However, Oracle recommends that you use the more semantically correct OFFLINEFORDROP syntax.

RESIZE

Specify RESIZE if you want Oracle Database to attempt to increase or decrease the size of the datafile to the specified absolute size in bytes. There is no default, so you must specify a size.

If sufficient disk space is not available for the increased size, or if the file contains data beyond the specified decreased size, Oracle Database returns an error.

Specify ENDBACKUP to take the datafile out of online backup mode. The ENDBACKUP clause is described more fully at the top level of the syntax of ALTERDATABASE. See "END BACKUP Clause ".

alter_tempfile_clause

Use the TEMPFILE clause to resize your temporary datafile or specify the autoextend_clause, with the same effect as for a permanent datafile. The database must be open. You can identify the tempfile by name or by number. If you identify it by number, then filenumber is an integer representing the number found in the FILE# column of the V$TEMPFILE dynamic performance view.

Note:

On some operating systems, Oracle does not allocate space for a tempfile until the tempfile blocks are actually accessed. This delay in space allocation results in faster creation and resizing of tempfiles, but it requires that sufficient disk space is available when the tempfiles are later used. To avoid potential problems, before you create or resize a tempfile, ensure that the available disk space exceeds the size of the new tempfile or the increased size of a resized tempfile. The excess space should allow for anticipated increases in disk space use by unrelated operations as well. Then proceed with the creation or resizing operation.

DROP

Specify DROP to drop tempfile from the database. The tablespace remains.

If you specify INCLUDINGDATAFILES, Oracle Database also deletes the associated operating system files and writes a message to the alert log for each such deleted file.

autoextend_clause

Use the autoextend_clause to enable or disable the automatic extension of a new or existing datafile or tempfile. Please refer to file_specification for information about this clause.

logfile_clauses

The logfile clauses let you add, drop, or modify log files.

ARCHIVELOG

Specify ARCHIVELOG if you want the contents of a redo log file group to be archived before the group can be reused. This mode prepares for the possibility of media recovery. Use this clause only after shutting down your instance normally, or immediately with no errors, and then restarting it and mounting the database, Real Application Clusters must be disabled.

MANUAL

Specify MANUAL to indicate that Oracle Database should create redo log files, but the archiving of the redo log files is controlled entirely by the user. This clause is provided for backward compatibility, for example for users who archive directly to tape. If you specify MANUAL, then:

Oracle Database does not archive redo log files when a log switch occurs. You must handle this manually.

You cannot have specified a standby database as an archivelog destinations. As a result, the database cannot be in MAXIMUMPROTECTION or MAXIMUMAVAILABILITY standby protection mode.

If you omit this clause, Oracle Database automatically archives the redo log files to the destination specified in the LOG_ARCHIVE_DEST_n initialization parameters.

NOARCHIVELOG

Specify NOARCHIVELOG if you do not want the contents of a redo log file group to be archived so that the group can be reused. This mode does not prepare for recovery after media failure. Use this clause only if your instance has the database mounted but not open, and Real Application Clusters must be disabled.

[NO] FORCE LOGGING

Use this clause to put the database into or take the database out of FORCELOGGING mode. The database must be mounted or open.

In FORCELOGGING mode, Oracle Database logs all changes in the database except changes in temporary tablespaces and temporary segments. This setting takes precedence over and is independent of any NOLOGGING or FORCELOGGING settings you specify for individual tablespaces and any NOLOGGING settings you specify for individual database objects.

If you specify FORCELOGGING, Oracle Database waits for all ongoing unlogged operations to finish.

This clause has the same function for logfiles that it has for datafiles and tempfiles. See "RENAME FILE Clause ".

CLEAR LOGFILE Clause

Use the CLEARLOGFILE clause to reinitialize an online redo log, optionally without archiving the redo log. CLEARLOGFILE is similar to adding and dropping a redo log, except that the statement may be issued even if there are only two logs for the thread and may be issued for the current redo log of a closed thread.

For a standby database, if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO, and if any of the log files are Oracle-managed files, Oracle Database will create as many Oracle-managed log files as are in the control file. The log file members will reside in the current default log file destination.

You must specify UNARCHIVED if you want to reuse a redo log that was not archived.

Caution:

Specifying UNARCHIVED makes backups unusable if the redo log is needed for recovery.

You must specify UNRECOVERABLEDATAFILE if you have taken the datafile offline with the database in archivelog mode (that is, you specified ALTERDATABASE ... DATAFILEOFFLINE without the DROP keyword), and if the unarchived log to be cleared is needed to recover the datafile before bringing it back online. In this case, you must drop the datafile and the entire tablespace once the CLEARLOGFILE statement completes.

Do not use CLEARLOGFILE to clear a log needed for media recovery. If it is necessary to clear a log containing redo after the database checkpoint, you must first perform incomplete media recovery. The current redo log of an open thread can be cleared. The current log of a closed thread can be cleared by switching logs in the closed thread.

If the CLEARLOGFILE statement is interrupted by a system or instance failure, then the database may hang. In this case, reissue the statement after the database is restarted. If the failure occurred because of I/O errors accessing one member of a log group, then that member can be dropped and other members added.

The INSTANCE clause is applicable only if you are using Oracle Database with the Real Application Clusters option in parallel mode. Specify the name of the instance for which you want to add a logfile. The instance name is a string of up to 80 characters. Oracle Database automatically uses the thread that is mapped to the specified instance. If no thread is mapped to the specified instance, then Oracle Database automatically acquires an available unmapped thread and assigns it to that instance. If you specify neither this clause nor the THREAD clause, then Oracle Database executes the command as if you had specified the current instance. If the specified instance has no current thread mapping and there are no available unmapped threads, then Oracle Database returns an error.

THREAD

The THREAD clause has been deprecated. The INSTANCE clause achieves the same purpose and is easier to use. The THREAD clause is supported for backward compatibility. integer is the thread number. The number of threads you can create is limited by the value of the MAXINSTANCES parameter specified in the CREATEDATABASE statement.

GROUP

The GROUP clause uniquely identifies the redo log file group among all groups in all threads and can range from 1 to the value specified for MAXLOGFILES in the CREATEDATABASE statement. You cannot add multiple redo log file groups having the same GROUP value. If you omit this parameter, Oracle Database generates its value automatically. You can examine the GROUP value for a redo log file group through the dynamic performance view V$LOG.

redo_log_file_spec

Each redo_log_file_spec specifies a redo log file group containing one or more members (that is, one or more copies). If you do not specify a filename for the new log file, then Oracle Database creates Oracle-managed files according to the rules described in the "LOGFILE Clause " of CREATEDATABASE.

Use the ADDLOGFILEMEMBER clause to add new members to existing redo log file groups. Each new member is specified by 'filename'. If the file already exists, it must be the same size as the other group members, and you must specify REUSE. If the file does not exist, Oracle Database creates a file of the correct size. You cannot add a member to a group if all of the members of the group have been lost through media failure.

You can specify STANDBY for symmetry, to indicate that the logfile member is for use only by a physical standby database. However, this keyword is not required. If group integer was added for standby database use, all of its members will be used only for standby databases as well.

You can specify an existing redo log file group in one of two ways:

GROUP integer

Specify the value of the GROUP parameter that identifies the redo log file group.

filename(s)

List all members of the redo log file group. You must fully specify each filename according to the conventions of your operating system.

See Also:

"LOGFILE Clause " of CREATEDATABASE for information on the result of this clause for Oracle-managed files if you do not specify a name for the new log file group

Use the DROPLOGFILE clause to drop all members of a redo log file group. If you use this clause to drop Oracle-managed files, then Oracle Database also removes all log file members from disk. Specify a redo log file group as indicated for the ADDLOGFILEMEMBER clause.

To drop the current log file group, you must first issue an ALTERSYSTEMSWITCHLOGFILE statement.

You cannot drop a redo log file group if it needs archiving.

You cannot drop a redo log file group if doing so would cause the redo thread to contain less than two redo log file groups.

Minimal supplemental logging ensures that LogMiner (and any products building on LogMiner technology) will have sufficient information to support chained rows and various storage arrangements such as cluster tables.

If the redo generated on one database is to be the source of changes (to be mined and applied) at another database, as is the case with logical standby, then the affected rows need to be identified using column data (as opposed to rowids). In this case, you should specify the supplemental_id_key_clause.

You can query the appropriate columns in the V$DATABASE view to determine whether any supplemental logging has already been enabled.

You can issue this statement when the database is open. However, Oracle Database will invalidate all DML cursors in the cursor cache, which will have an effect on performance until the cache is repopulated.

For a full discussion of the supplemental_id_clause, please refer to supplemental_id_key_clause in the documentation on CREATETABLE.

Specify DROPSUPPLEMENTALLOGDATA to instruct Oracle Database to stop placing minimal additional log information into the redo log stream whenever an update operation occurs. If Oracle Database is doing column data supplemental logging specified with the supplemental_id_key_clause, then you must first stop the column data supplemental logging with the DROPSUPPLEMENTALLOGsupplemental_id_key_clause and then specify this clause.

Specify DROPSUPPLEMENTALLOGsupplemental_id_key_clause to drop some or all of the system-generated supplemental log groups. You must specify the supplemental_id_key_clause if the supplemental log groups you want to drop were added using that clause.

Use the BACKUPCONTROLFILE clause to back up the current control file. The database must be open or mounted when you specify this clause.

TO 'filename'

Specify the file to which the control file is backed up. You must fully specify the filename using the conventions for your operating system. If the specified file already exists, you must specify REUSE.

TO TRACE

Specify TOTRACE if you want Oracle Database to write SQL statements to a trace file rather than making a physical backup of the control file. You can use SQL statements written to the trace file to start up the database, re-create the control file, and recover and open the database appropriately, based on the created control file. If you issue an ALTERDATABASEBACKUPCONTROLFILETOTRACE statement while block change tracking is enabled, the resulting script will contain a command to reenable block change tracking.

This statement issues an implicit ALTERDATABASEREGISTERLOGFILE statement, which creates incarnation records if the archived log files reside in the current archivelog destinations.

You can copy the statements from the trace file into a script file, edit the statements as necessary, and use the script if all copies of the control file are lost (or to change the size of the control file).

Specify ASfilename if you want Oracle Database to place the script into a file called filename rather than into the standard trace file.

Specify REUSE to allow Oracle Database to overwrite any existing file called filename.

RESETLOGS indicates that the SQL statement written to the trace file for starting the database is ALTERDATABASEOPENRESETLOGS. This setting is valid only if the online logs are unavailable.

NORESETLOGS indicates that the SQL statement written to the trace file for starting the database is ALTERDATABASEOPENNORESETLOGS. This setting is valid only if all the online logs are available.

If you cannot predict the future state of the online logs, specify neither RESETLOGS nor NORESETLOGS. In this case, Oracle Database puts both versions of the script into the trace file, and you can choose which version is appropriate when the script becomes necessary.

standby_database_clauses

Use these clauses to activate the standby database or to specify whether it is in protected or unprotected mode.

The ACTIVATESTANDBYDATABASE clause changes the state of a standby database to an active database and prepares it to become the primary database. The database must be mounted before you can specify this clause.

PHYSICAL

Specify PHYSICAL to activate a physical standby database. This is the default.

LOGICAL

Specify LOGICAL to activate a logical standby database. If you have more than one logical standby database, you should first ensure that the same log data is available on all the standby systems.

SKIP [STANDBY LOGFILE]

This clause applies only to physical standby databases. Use this clause to force the operation to proceed even if standby redo logfiles contain data that could be recovered using the RECOVERMANAGEDSTANDBYDATABASEFINISH command.

Note:

Oracle recommends that you always use the RECOVERMANAGEDSTANDBYDATABASEFINISH statement for physical standby even if you do not use standby redo logfiles. Use the SKIP clause only if it is acceptable to discard the contents of the standby redo log.

maximize_standby_db_clause

Use this clause to specify the level of protection for the data in your database environment. You specify this clause from the primary database, which must be mounted but not open.

Note:

The PROTECTED and UNPROTECTED keywords have been replaced for clarity but are still supported. PROTECTED is equivalent to TOMAXIMIZEPROTECTION. UNPROTECTED is equivalent to TOMAXIMIZEPERFORMANCE.

TO MAXIMIZE PROTECTION

This setting establishes maximum protection mode and offers the highest level of data protection. A transaction does not commit until all data needed to recover that transaction has been written to at least one physical standby database that is configured to use the SYNC log transport mode. If the primary database is unable to write the redo records to at least one such standby database, the primary database is shut down. This mode guarantees zero data loss, but it has the greatest potential impact on the performance and availability of the primary database.

TO MAXIMIZE AVAILABILITY

This setting establishes maximum availability mode and offers the next highest level of data protection. A transaction does not commit until all data needed to recover that transaction has been written to at least one physical or logical standby database that is configured to use the SYNC log transport mode. Unlike maximum protection mode, the primary database does not shut down if it is unable to write the redo records to at least one such standby database. Instead, the protection is lowered to maximum performance mode until the fault has been corrected and the standby database has caught up with the primary database. This mode guarantees zero data loss unless the primary database fails while in maximum performance mode. Maximum availability mode provides the highest level of data protection that is possible without affecting the availability of the primary database.

TO MAXIMIZE PERFORMANCE

This setting establishes maximum performance mode and is the default setting. A transaction commits before the data needed to recover that transaction has been written to a standby database. Therefore, some transactions may be lost if the primary database fails and you are unable to recover the redo records from the primary database. This mode provides the highest level of data protection that is possible without affecting the performance of the primary database.

To determine the current mode of the database, query the PROTECTION_MODE column of the V$DATABASE dynamic performance view.

Specify the REGISTERLOGFILE clause from the standby database to manually register log files from the failed primary. Use the redo_log_file_spec form of file_specification (see file_specification ) to list regular redo log files in an operating system file system or to list Automatic Storage Management disk group redo log files.

When a log file is from an unknown incarnation, the REGISTERLOGFILE clause causes an incarnation record to be added to the V$DATABASE_INCARNATION view. If the newly registered log file belongs to an incarnation having a higher RESETLOGS_TIME than the current RECOVERY_TARGET_INCARNATION#, the REGISTERLOGFILE clause also causes RECOVERY_TARGET_INCARNATION# to be changed to correspond to the newly added incarnation record.

OR REPLACE

Specify ORREPLACE to allow an existing archivelog entry in the standby database to be updated, for example, when its location or file specification changes. The system change numbers of the entries must match exactly, and the original entry must have been created by the managed standby log transmittal mechanism.

FOR logminer_session_name

This clause is useful in a Streams environment. It lets you register the log file with one specified LogMiner session.

commit_switchover_clause

Use this clause to perform a graceful switchover, in which the current primary database takes on standby status, and one standby database becomes the primary database. In a Real Application Clusters environment, all instances other than the instance from which you issue this statement must be shut down normally.

PREPARE TO SWITCHOVER

The PREPARETOSWITCHOVER clause prepares the primary and standby databases to begin exchanging log files in preparation for the switchover.

From the primary database, specify PREPARETOSWITCHOVERTOSTANDBY to enable the primary database to begin accepting log files from one of its logical standby databases.

From the logical standby database, specify this clause to build and send its LogMiner dictionary to the primary before the switchover is committed.

COMMIT TO SWITCHOVER

The COMMITTOSWITCHOVER completes the switchover operation.

On the primary database, specify COMMITTOSWITCHOVERTOSTANDBY to perform a graceful database switchover of the primary database to standby database status. The primary database must be open.

On one of the standby databases, issue a COMMITTOSWITCHOVERTOPRIMARY statement to perform a graceful switchover of this standby database to primary status. The standby database must be mounted or open in READONLY mode.

Specify PHYSICAL to prepare the primary database to run in the role of a physical standby database.

If you specify WITHSESSIONSHUTDOWN, Oracle Database shuts down any open application sessions and rolls back uncommitted transactions as part of the execution of this statement. If you omit this clause or specify WITHOUTSESSIONSHUTDOWN (which is the default), the statement fails if any application sessions are open.

Restriction onWITH SESSION SHUTDOWN: This clause is not necessary or supported for a logical database.

Specify WAIT if you want Oracle Database to return control after the completion of the SWITCHOVER command. Specify NOWAIT if you want Oracle Database to return control before the switchover operation is complete. The default is WAIT.

Specify LOGICAL to prepare the primary database to run in the role of a logical standby database. If you specify LOGICAL, you must then issue an ALTERDATABASESTARTLOGICALSTANDBYAPPLY statement.

CANCEL

Specify CANCEL to cancel the switchover from primary to standby database. This clause is necessary to stop the shipping of log files from the standby database to the primary database.

Specify IMMEDIATE to let LogMiner read the redo data out of the standby redo log files.

Specify NODELAY if you want Oracle Database to ignore a delay for this apply. This is useful if the primary database is no longer present, which would otherwise require a PL/SQL call to be made.

Specify INITIAL the first time you apply the logs to the standby database.

Specify NEWPRIMARY after the ALTERDATABASECOMMITTOSWITCHOVERTOLOGICALSTANDBY statement or when a standby database has completed processing logs from one primary and now a new database becomes the primary.

Specify SKIPFAILED [TRANSACTION] to skip the last transaction in the events table and restart the apply.

Specify FINISH to force the standby redo logfile information into archived logs. If the primary database becomes disabled, you can then apply the data in the redo log files.

stop_standby_clause

Use this clause to stop the log apply services. This clause applies only to logical standby databases, not to physical standby databases. Use the STOP clause to stop the apply in an orderly fashion.

default_settings_clauses

Use these clauses to modify the default settings of the database.

CHARACTER SET, NATIONAL CHARACTER SET

You can no longer change the database character set or the national character set using the ALTERDATABASE statement. Please refer to Oracle Database Globalization Support Guide for information on database character set migration.

SET DEFAULT TABLESPACE Clause

Use this clause to specify or change the default type of subsequently created tablespaces. Specify BIGFILE or SMALLFILE to indicate whether the tablespaces should be bigfile or smallfile tablespaces.

A bigfile tablespace contains only one datafile or tempfile, which can contain up to 232 or 4G blocks. The maximum size of the single datafile or tempfile is 128 terabytes (TB) for a tablespace with 32K blocks and 32TB for a tablespace with 8K blocks.

A smallfile tablespace is a traditional Oracle tablespace, which can contain 1022 datafiles or tempfiles, each of which can contain up to 222 or 4M blocks.

Specify this clause to establish or change the default permanent tablespace of the database. The tablespace you specify must already have been created. After this operation completes, Oracle Database automatically reassigns to the new default tablespace all non-SYSTEM users who have not explicitly been assigned a default tablespace. All objects subsequently created by those users will be stored in the new default tablespace. If you are replacing a previously specified default tablespace, you can move the previously created objects from the old to the new default tablespace, and then drop the old default tablespace if you wish.

DEFAULT TEMPORARY TABLESPACE Clause

Specify this clause to change the default temporary tablespace of the database to a new tablespace or tablespace group.

Specify tablespace to indicate the new default temporary tablespace of the database. After this operation completes, Oracle Database automatically reassigns to the new default temporary tablespace all users who had been assigned to the old default temporary tablespace. You can then drop the old default temporary tablespace if you wish.

Specify tablespace_group_name to indicate that all tablespaces in the tablespace group specified by tablespace_group_name are now default temporary tablespace for the database. After this operation completes, users who have not been explicitly assigned a default temporary tablespace can create temporary segments in any of the tablespaces that are part of tablespace_group_name. You cannot drop the old default temporary tablespace if it is part of the default temporary tablespace group.

To learn the name of the current default temporary tablespace or default temporary tablespace group, query the TEMPORARY_TABLESPACE column of the ALL_, DBA-, or USER_USERS data dictionary views.

Restrictions on Default Temporary Tablespaces

The tablespace you assign or reassign as the default temporary tablespace must have a standard block size.

If the SYSTEM tablespace is locally managed, the tablespace you specify as the default temporary tablespace must also be locally managed.

Use these clauses to enable and disable a thread of redo or log file group.

ENABLE | DISABLE INSTANCE Clause

In an Oracle Real Application Clusters environment, specify ENABLEINSTANCE to enable the thread that is mapped to the specified database instance. The thread must have at least two redo log file groups, and the database must be open.

Specify DISABLEINSTANCE to disable the thread that is mapped to the specified database instance. The name of the instance is a string of up to 80 characters. If no thread is currently mapped to the specified instance, then Oracle Database returns an error. The database must be open, but you cannot disable a thread if an instance using it has the database mounted.

ENABLE | DISABLE THREAD Clause

This clause has been deprecated, because the ENABLE | DISABLEINSTANCE clause achieves the same purpose and is easier to use. The ENABLE | DISABLETHREAD clause is supported for backward compatibility. Specify ENABLETHREAD to enable the specified thread of redo log file groups. The thread must have at least two redo log file groups before you can enable it. The database must be open.

PUBLIC

Specify PUBLIC to make the enabled thread available to any instance that does not explicitly request a specific thread with the initialization parameter THREAD. The PUBLIC keyword is not valid with DISABLETHREAD. If you omit PUBLIC, then the thread is available only to the instance that explicitly requests it with the initialization parameter THREAD.

Specify DISABLETHREAD to disable the specified thread, making it unavailable to all instances. The database must be open, but you cannot disable a thread if an instance using it has the database mounted.

Specify RENAMEGLOBAL_NAME to change the global name of the database. The database is the new database name and can be as long as eight bytes. The optional domain specifies where the database is effectively located in the network hierarchy. The database must be open.

Note:

Renaming your database does not change global references to your database from existing database links, synonyms, and stored procedures and functions on remote databases. Changing such references is the responsibility of the administrator of the remote databases.

The block change tracking feature causes Oracle Database to keep track of the physical locations of all database updates. This information is maintained in a separate file called the block change tracking file. If you are using Oracle-managed files, Oracle Database automatically creates the block change tracking file in the location specified by DB_CREATE_FILE_DEST. If you are not using Oracle-managed files, you must specify the change tracking filename. Oracle Database uses change tracking data for some internal tasks, such as increasing the performance of incremental backups. You can enable or disable block change tracking with the database either open or mounted, in either archivelog or noarchivelog mode.

Specify USINGFILE 'filename' if you want to name the block change tracking file instead of letting Oracle Database generate a name for it. You must specify this clause if you are not using Oracle-managed files.

Specify REUSE to allow Oracle Database to overwrite an existing block change tracking file of the same name.

DISABLE BLOCK CHANGE TRACKING

Specify this clause if you want Oracle Database to stop tracking changes and delete the existing block change tracking file.

Use this clause to put the database in or take the database out of FLASHBACK mode. You can specify this clause only if the database is in archivelog mode and you have already prepared a flash recovery area for the database.You can specify this clause when the database is mounted in exclusive mode but not open.

Use this clause to put the database in FLASHBACK mode. When the database is in FLASHBACK mode, Oracle Database automatically creates and manages Flashback Database logs in the flash recovery area. Users with SYSDBA system privilege can then issue a FLASHBACKDATABASE statement.

FLASHBACK OFF

Use this clause to take the database out of FLASHBACK mode. Oracle Database stops logging Flashback data and deletes all existing Flashback Database logs. Any attempt to issue a FLASHBACKDATABASE will fail with an error.

set_time_zone_clause

This clause has the same semantics in CREATEDATABASE and ALTERDATABASE statements. When used in with ALTERDATABASE, this clause resets the time zone of the database. To determine the time zone of the database, query the built-in function DBTIMEZONE . After setting or changing the time zone with this clause, you must restart the database for the new time zone to take effect.

Oracle Database normalizes all new TIMESTAMPWITHLOCALTIMEZONE data to the time zone of the database when the data is stored on disk.Oracle Database does not automatically update existing data in the database to the new time zone. Therefore, you cannot reset the database time zone if there is any TIMESTAMPWITHLOCALTIMEZONE data in the database. You must first delete or export the TIMESTAMPWITHLOCALTIMEZONE data and then reset the database time zone. For this reason, Oracle does not encourage you to change the time zone of a database that contains data.

For a full description of this clause, please refer to set_time_zone_clause in the documentation on CREATEDATABASE.

security_clause

Use the security_clause (GUARD) to protect data in the database from being changed. You can override this setting for a current session using the ALTERSESSIONDISABLEGUARD statement. Please refer to ALTER SESSION for more information.

ALL

Specify ALL to prevent all users other than SYS from making changes to any data in the database.

STANDBY

Specify STANDBY to prevent all users other than SYS from making changes to any database object being maintained by logical standby. This setting is useful if you want report operations to be able to modify data as long as it is not being replicated by logical standby.

The following statement adds a member to the redo log file group added in the previous example:

ALTER DATABASE
ADD LOGFILE MEMBER 'diskc:log3.log'
TO GROUP 3;

Dropping Log File Members: Example

The following statement drops one redo log file member added in the previous example:

ALTER DATABASE
DROP LOGFILE MEMBER 'diskb:log3.log';

The following statement drops all members of the redo log file group 3:

ALTER DATABASE DROP LOGFILE GROUP 3;

Renaming a Log File Member: Example

The following statement renames a redo log file member:

ALTER DATABASE
RENAME FILE 'diskc:log3.log' TO 'diskb:log3.log';

The preceding statement only changes the member of the redo log group from one file to another. The statement does not actually change the name of the file diskc:log3.log to diskb:log3.log. You must perform this operation through your operating system.

Setting the Default Type of Tablespaces: Example

The following statement specifies that subsequently created tablespaces be created as bigfile tablespaces by default:

ALTER DATABASE
SET DEFAULT BIGFILE TABLESPACE;

Changing the Default Temporary Tablespace: Examples

The following statement makes the tbs_5 tablespace (created in "Creating a Temporary Tablespace: Example") the default temporary tablespace of the database. This statement either establishes a default temporary tablespace if none was specified at create time, or replaces an existing default temporary tablespace with tbs_05:

ALTER DATABASE
DEFAULT TEMPORARY TABLESPACE tbs_05;

Alternatively, a group of tablespaces can be defined as the default temporary tablespace by using a tablespace group. The following statement makes the tablespaces in the tablespace group tbs_group_01 (created in "Adding a Temporary Tablespace to a Tablespace Group: Example") the default temporary tablespaces of the database:

ALTER DATABASE
DEFAULT TEMPORARY TABLESPACE tbs_grp_01;

Disabling and Enabling a Real Application Clusters Thread: Examples

The following statement disables thread 5 in a Real Application Clusters environment:

ALTER DATABASE
DISABLE THREAD 5;

The following statement enables thread 5 in a Real Application Clusters environment, making it available to any Oracle Database instance that does not explicitly request a specific thread:

ALTER DATABASE
ENABLE PUBLIC THREAD 5;

Creating a New Datafile: Example

The following statement creates a new datafile tbs_f04.dbf based on the file tbs_f03.dbf. Before creating the new datafile, you must take the existing datafile (or the tablespace in which it resides) offline.

ALTER DATABASE
CREATE DATAFILE 'tbs_f03.dbf'
AS 'tbs_f04.dbf';

Changing the Global Database Name: Example

The following statement changes the global name of the database and includes both the database name and domain:

ALTER DATABASE
RENAME GLOBAL_NAME TO demo.world.oracle.com;

Enabling and Disabling Block Change Tracking: Examples

The following statement enables block change tracking and causes Oracle Database to create a block change tracking file named tracking_file and overwrite the file if it already exists:

The following statement attempts to change the size of datafile disk1:db1.dat:

ALTER DATABASE
DATAFILE 'disk1:db1.dat' RESIZE 10 M;

Clearing a Log File: Example

The following statement clears a log file:

ALTER DATABASE
CLEAR LOGFILE 'diskc:log3.log';

Database Recovery: Examples

The following statement performs complete recovery of the entire database, letting Oracle Database generate the name of the next archived redo log file needed:

ALTER DATABASE
RECOVER AUTOMATIC DATABASE;

The following statement explicitly names a redo log file for Oracle Database to apply:

ALTER DATABASE
RECOVER LOGFILE 'diskc:log3.log';

The following statement recovers the standby datafile /finance/stbs_21.f, using the corresponding datafile in the original standby database, plus all relevant archived logs and the current standby database control file: