1.1 full database backup of Database Data
Note: This operation requires you to start the database.
Switch to the oracle user and create the backup directory on the OS side:
Mkdir/oracle/backup
Log on to the oracle database and create a backup directory in the database.
Sqlplus/as sysdba
Create directory backupdir as '/oracle/backup ';
After you exit sqlplus, use the oracle user to perform full-database backup. The backup file is generated under/oracle/backup:
Expdp system/System123 DIRECTORY = backupdir DUMPFILE = backup201309XX. dmp logfile = backup. log full = y
1.2 database data recovery
Note: This operation requires you to start the database.
1. log on to the database server with an orale user
2. Delete the user to be restored.
Sqlplus/as sysdba
Drop user USER_NAME cascade;
Exit
3. Execute the recovery command
The following statement restores pgm user data to the backup201309XX. dmp status
Impdp system/System123 DIRECTORY = backupdir DUMPFILE = backup201309XX. dmp schemas = pgm TABLE_EXISTS_ACTION = TRUNCATE logfile = restore. log
Precautions for database recovery:
You cannot delete or modify the database definition (such as the table structure) When backing up and restoring the database in exp/imp mode.
Therefore, if the database table structure changes during restoration, You need to restore the table structure or delete the table before performing the restoration operation. If you do not know which table structures have changed, you can delete the database users that need to be restored before performing the restoration operation.
In addition, it is confirmed that the table is restored after the table is deleted. A problem exists: when the table is deleted, the foreign keys referenced in the table created by other tables are deleted.
The foreign key cannot be restored. In this case, you need to manually create a foreign key constraint after recovery.
Drop table TABLE_NAME cascade constraints;
Impdp system/System123 DIRECTORY = backupdir DUMPFILE = backup201309XX. dmp tables = sdu. E_UC_ENTANN TABLE_EXISTS_ACTION = TRUNCATE logfile = restore_sdu.log