Export
Exporting and importing utilities
The oracle export and import utilities may be used to write Oracle-binary data to OS files and read them in again. Files created using the export utility can only be accessed and read by the import utility. Typing 'exp' in the Oracle application home directory opens up a fairly intuitive dialogue that may be used to create an Oracle export. The following screen shot demonstrates using the export utility to extract the contents of a table:
Fig 5g: Using the Export Utility
The import utility complements the export utility and may be invoked by typing 'imp' at the prompt in the Oracle home directory. Care should be taken while importing into an existing table so that rows already present are not added again from the import file. The following screen shot demonstrates file import using the file created in the previous screenshot; the process generates an error as the book data object already exists:
To perform offline backups, the database should be shutdown. Before shut down, execute the following commands and obtain a printout or other copy of the results. These commands return data dictionary views that contain comprehensive lists of all files that should be backed up (datafiles, control files, and log files):
select name from sys.v_$datafile; select member from sys.v_$logfile; select name from sys.v_$controlfile;
Now, shut down the database and copy all the files to a USB drive, tape drive or CD ROM drive. For a hot backup, each tablespace should be put into backup mode through an ALTER command. Afterwards, the datafiles associated with the tablespace may be copied to a backup device using OS commands and utilities. After this, the tablespace should be put back online through another ALTER command. Hot backups should be performed during slow hours to avoid inconveniencing users.
ALTER TABLESPACE users BEGIN BACKUP; | | Copy datafiles | | ALTER TABLESPACE users END BACKUP;
The RMAN or Recovery Manager utility just backs up used space within datafiles and does not put tablespaces into backup mode. The following is a simple RMAN script that simply connects the 'SYS' user and allocates a channel for backup (here, it is a disk at g:). The BACKUP INCREMENTAL command is used to specify that only changes after the previous backup should be copied rather than the entire database. The RELEASE channel frees-up the disk at G: after the backup. The '%d', %s, %t characters insert current date and time into the backup directory name.
rman target sys/****** nocatalog
run {
ALLOCATE CHANNEL d1 TYPE DISK FORMAT 'g:\mybackup\Ordata_%d_%s_%t';
BACKUP INCREMENTAL
( DATABASE );
RELEASE CHANNEL d1;
}