Oracle数据库备份主要分为物理备份和逻辑备份两种方式。
使用RMAN(Recovery Manager)工具进行全量备份:
RUN { ALLOCATE CHANNEL ch1 DEVICE TYPE DISK; BACKUP DATABASE PLUS ARCHIVELOG; RELEASE CHANNEL ch1; }
使用expdp命令导出数据:
expdp username/password DIRECTORY=backup_dir DUMPFILE=backup.dmp SCHEMAS=your_schema
数据库异常关闭后的恢复步骤:
STARTUP MOUNT; RESTORE DATABASE; RECOVER DATABASE; ALTER DATABASE OPEN;
使用impdp命令导入备份文件:
impdp username/password DIRECTORY=backup_dir DUMPFILE=backup.dmp SCHEMAS=your_schema