1.查看数据库是否开启归档(查看两个节点rac1和rac2是否开归档日志)
创新互联公司2013年至今,先为巢湖等服务建站,巢湖等地企业,进行企业商务咨询服务。为巢湖企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
SQL> archiveloglist
SP2-0734: unknown command beginning "archivelog..." - rest of line ignored.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 7
Current log sequence 8
SQL>
2.在节点1(rac1)中设置只修改节点1的参数,不影响节点2.
SQL> alter system set cluster_database=false scope=spfile sid='racdb1';
System altered.
SQL>
3.在节点1(rac1)用srvctl命令关闭数据库
[oracle@rac1 ~]$ srvctl stop database -d racdb
4.挂载数据库,日志修改为归档
SQL> startup mount
SQL> alter database archivelog;
SQL> alter system set cluster_database=true scope=spfile sid='racdb1';
SQL> shutdown immediate
5.启动数据库
[oracle@rac1 ~]$ srvctl start database -d racdb
6.检查修改后的归档信息
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 9
Next log sequence to archive 10
Current log sequence 10
SQL>
7.查看数据库是否启用闪回功能
节点1(rac1):
SQL> select flashback_on from v$database; --必须先开启归档
FLASHBACK_ON
------------------
NO
SQL>
8.设置闪回的路径和大小
SQL> alter system set cluster_database=false scope=spfile sid='racdb1';
SQL> alter system set db_recovery_file_dest='+FALSE' scope=spfile;
SQL> alter system set db_recovery_file_dest_size=5G scope=spfile;
9.关闭数据库
[oracle@rac1 ~]$ srvctl stop database -d racdb
10.启用闪回
SQL> startup mount
SQL> alter database flashback on;
SQL> alter system set cluster_database=true scope=spfile sid='racdb1';
SQL> shutdown immediate
11.启动数据库
[oracle@rac1 ~]$ srvctl start database -d racdb
12.查看闪回功能
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
SQL>
13.也可启用表空间闪回
SQL> alter tablespace abc flashback on; --开启表空间闪回
SQL> alter tablespace abc flashback off; --关闭表空间闪回