今天想学着别人做联机备份表空间,看起来也就那么两句命令嘛,居然还是躲不过问题来袭,唉,悲哀~~~

1. 联机备份出错:
SQL> alter tablespace zy begin backup;
alter tablespace users begin backup
*
ERROR at line 1:
ORA-01123:cannot start online backup;media recovery not enabled
 
2. 查找错误原因:
         在noarchive模式下不能做alter tablespace XXX begin backup,联机备份只有在数据库位于archivelog模式中才能进行。
 
3. 看看归档情况:
SQL> archive log list
Database log mode                    No Archive Mode
Automatic archival                    Disabled
Archive destination                  USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence        36
Current log sequence                  38
 
4. 以archive模式启动数据库:
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
 
5. 查看归档情况:
SQL> archive log list
Database log mode                      Archive Mode
Automatic archival                       Enabled
Archive destination                     USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence           37
Next log sequence to archive        39
Current log sequence                     39
 
6. 开启数据库
SQL> alter database open;
Database altered.
 
7. 开启联机备份模式
SQL> alter tablespace zy begin backup;
Tablespace altered.
 
SQL> host copy C:\oracle\product\10.1.0\oradata\orcl\ZY01.DBF C:\backup
已复制       1个文件
 
SQL> alter tablespace zy end backup;
Tablespace altered.
 
成功!