oracle热备份

1:热备份:

 1 SHUTDOWN IMMEDIATE;

 2 STARTUP MOUNT;

 3 alter database archivelog;

 4 --ALTER SYSTEM SET LOG_ARCHIVE_START=TRUE SCOPE=SPFILE;

 5 

 6 ALTER SYSTEM RESET log_archive_start SCOPE=SPFILE SID='MyOrcl';

 7 ALTER DATABASE OPEN;

 8 ALTER TABLESPACE USERS BEGIN BACKUP;

 9 HOST COPY G:\app\zhaobin\oradata\MyOrcl\*.dbf G:\BAK;

10 ALTER TABLESPACE USERS END BACKUP;

11 ALTER SYSTEM SWITCH LOGFILE;

2:热备份恢复:

1 ALTER DATABASE DATAFILE 4 OFFLINE DROP;//让这个出故障的文件暂时先脱机

2 ALTER DATABASE OPEN;//打开数据库

3 HOST COPY G:\BAK\*.dbf  G:\app\zhaobin\oradata\MyOrcl\//将前面备份的文件拷贝到系统目录中

4 RECOVER DATAFILE 6;//这一步,偶尔会出错,无法正确执行,而且无法正常关闭数据库,请如此这般

5 

6 操作,SHUTDOWN ABORT; STARTUP;

7 ALTER DATABASE DATAFILE 6 ONLINE;

 

你可能感兴趣的:(oracle)