546.You want to put a specific tablespace called MY_DATA in hot backup mode so you can back it up.
What command would you use?
A. alter tablespace MY_DATA begin backup;
B. alter tablespace MY_DATA start backup;
C. alter tablespace MY_DATA backup begin;
D. alter MY_DATA begin backup;
E. You cannot back up individual tablespaces.
Answer: A
答案解析:
Making User-Managed Backups of Online Read/Write Tablespaces
You must put a read/write tablespace in backup mode to make user-managed data file backups when the tablespace is online and the database is open.
The ALTER
TABLESPACE
...
BEGIN
BACKUP
statement places a tablespace in backup mode.
In backup mode, the database copies whole changed data blocks into the redo stream. After you take the tablespace out of backup mode with the ALTER
TABLESPACE
...
END
BACKUP
or ALTER
DATABASE
END
BACKUP
statement,
the database advances the data file checkpoint SCN to the current database
checkpoint SCN.
When restoring a data file backed up in this way, the database asks for the appropriate set of redo log files to apply if recovery is needed. The redo logs contain all changes required to recover the data files and make them consistent.
To back up online read/write tablespaces in an open database:
-
Before beginning a backup of a tablespace, use the
DBA_DATA_FILES
data dictionary view to identify all of the data files in the tablespace. For example, assume that you want to back up theusers
tablespace. Enter the following:SELECT TABLESPACE_NAME, FILE_NAMEFROM SYS.DBA_DATA_FILESWHERE TABLESPACE_NAME = 'USERS';TABLESPACE_NAME FILE_NAME------------------------------- --------------------USERS /oracle/oradata/trgt/users01.dbfUSERS /oracle/oradata/trgt/users02.dbf -
Mark the beginning of the online tablespace backup. For example, the following statement marks the start of an online backup for the tablespace
users
:SQL> ALTER TABLESPACE users BEGIN BACKUP;Caution:
If you do not useBEGIN
BACKUP
to mark the beginning of an online tablespace backup and wait for this statement to complete before starting your copies of online tablespaces, then the data file copies produced are not usable for subsequent recovery operations. Attempting to recover such a backup is risky and can return errors that result in inconsistent data. For example, the attempted recovery operation can issue a fuzzy file warning, and can lead to an inconsistent database that you cannot open. -
Back up the online data files of the online tablespace with operating system commands. For example, Linux and UNIX users might enter:
% cp /oracle/oradata/trgt/users01.dbf /d2/users01_'date "+%m_%d_%y"'.dbf% cp /oracle/oradata/trgt/users02.dbf /d2/users02_'date "+%m_%d_%y"'.dbf -
After backing up the data files of the online tablespace, run the SQL statement
ALTER
TABLESPACE
with theEND
BACKUP
option. For example, the following statement ends the online backup of the tablespaceusers
:SQL> ALTER TABLESPACE users END BACKUP; -
Archive the unarchived redo logs so that the redo required to recover the tablespace backup is archived. For example, enter:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;Caution:
If you fail to take the tablespace out of backup mode, then Oracle Database continues to write copies of data blocks in this tablespace to the online redo logs, causing performance problems. Also, you receive anORA-01149
error if you try to shut down the database with the tablespaces still in backup mode.