#非归档模式备份数据库:
#设置非归档模式
SQL>shutdown immediate
SQL>startup mount
SQL>alter database noarchivelog;
SQL>alter database open;
#RMAN备份
SQL>shutdown immediate
SQL>startup mount
rman target /
RMAN>backup database;
#设置备份路径和备份文件名称
RMAN>backup tag 'full_db_bkp' format '/u01/app/orabak/rman/db_%U' database;
#设置控制文件保存时间
SQL>show parameter control
SQL>alter system set control_file_record_keep_time=30;
#归档模式备份数据库:
#启用归档模式
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL>alter database open;
#修改log_archive参数
SQL>alter system set log_archive_dest='/u01/app/orabak/archivelog' scope=spfile;
SQL>alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
SQL>shutdown immediate
SQL>startup
SQL>show parameter log_archive_dest
#切换归档日志
SQL>alter system switch logfile;
#RMAN备份:open状态
RMAN>backup database; #注:如果备份含有system表空间的文件,自动备份控制文件和spfile
RMAN>backup database plus archivelog; #备份数据库+归档日志