User-managed backups can be either logical or physical. You can use the Export utility to make backups of logical objects such as tables, views, and stored procedures, and use the Import utility to restore these objects. A physical backup is a backup of an Oracle database file or archived redo log located on the operating system. Note that these files can either be manually-managed database files or Oracle-managed files.
The basic method for taking user-managed backups of the whole database is as follows:
Join the V$TABLESPACE and V$DATAFILE views to
obtain a listing of datafiles along with their associated tablespaces |
SELECT t.NAME "Tablespace", f.NAME "Datafile"
FROM V$TABLESPACE t, V$DATAFILE f
WHERE t.TS# = f.TS#
ORDER BY t.NAME;
Obtain the filenames of online redo log files by querying the V$LOGFILE
view. |
SELECT MEMBER FROM V$LOGFILE;
Obtain the filenames of the current control files by querying the V$CONTROLFILE
view.. |
SELECT NAME FROM V$CONTROLFILE;
| Use one of the following command to shut down the database if performing under NOARCHIVE mode. |
SHUTDOWN NORMAL
SHUTDOWN IMMEDIATE
SHUTDOWN TRANSACTIONAL
.ora
extension.You cannot offline the SYSTEM tablespace or a
tablespace with active rollback segments. The basic method for taking
user-managed backups of the offline tablespaces and datafiles is as follows:
DBA_DATA_FILES
view:SELECT TABLESPACE_NAME, FILE_NAME FROM SYS.DBA_DATA_FILES WHERE TABLESPACE_NAME = 'users';
ALTER TABLESPACE users OFFLINE NORMAL;
ALTER TABLESPACE users ONLINE;
ALTER SYSTEM ARCHIVE LOG CURRENT;
The basic method for taking user-managed backups of the online read/write tablespaces is as follows:
DBA_DATA_FILES
data dictionary view:SELECT TABLESPACE_NAME, FILE_NAME FROM SYS.DBA_DATA_FILES WHERE TABLESPACE_NAME = 'users';
ALTER TABLESPACE users BEGIN BACKUP;
ALTER TABLESPACE
with the END BACKUP option:ALTER TABLESPACE users END BACKUP;
ALTER SYSTEM ARCHIVE LOG CURRENT;
The basic method for taking user-managed backups of the online read-only tablespaces is as follows:
DBA_TABLESPACES view
to determine which tablespaces are read-only:SELECT TABLESPACE_NAME, STATUS FROM DBA_TABLESPACES WHERE STATUS = 'READ ONLY';
DBA_DATA_FILES
data dictionary view. For example, assume that you want to back up the history
tablespace. Enter the following:SELECT TABLESPACE_NAME, FILE_NAME FROM SYS.DBA_DATA_FILES WHERE TABLESPACE_NAME = 'users';
Back to CS643 schedule