归档测试记录
测试记录
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ export ORACLE_SID=racjiqun1
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL> show parameter cluster;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
在各个节点上执行如下命令
SQL> alter system set cluster_database=false scope=spfile sid='racjiqun1';
System altered.
在一二节点执行 shutdown immediate;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
在一节点执行 startup mount;
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1269366784 bytes
Fixed Size 2252864 bytes
Variable Size 822087616 bytes
Database Buffers 436207616 bytes
Redo Buffers 8818688 bytes
Database mounted.
SQL> show parameter cluster; 查看操作是否生效
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/app/oracle/11.2.4/db_1/dbs/arch
Oldest online log sequence 22
Current log sequence 23
SQL> alter database archivelog;
Database altered.
SQL> alter system set log_archive_format='test_%t_%s_%r.log' scope=spfile;
System altered.
归档格式说明:
%t 重做线程号
%s 日志序列号
%r resetlogs的id号
SQL> alter system set log_archive_start=true scope=spfile;
System altered.
SQL> alter system set log_archive_dest_1='location=+DATA/arch' scope=spfile;
System altered.
SQL> alter system set cluster_database=true scope=spfile sid='racjiqun1';
System altered.
SQL> alter system set cluster_database=true scope=spfile sid='racjiqun2';
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@rac1 ~]$ srvctl start database -d racjiqun
切换归档,查看归档是否正常工作
alter system switch logfile;或者
alter system archive log current;
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 28 14:36:49 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arch
Oldest online log sequence 22
Next log sequence to archive 23
Current log sequence 23
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 28 14:37:24 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arch
Oldest online log sequence 7
Next log sequence to archive 8
Current log sequence 8
测试记录
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ export ORACLE_SID=racjiqun1
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL> show parameter cluster;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
在各个节点上执行如下命令
SQL> alter system set cluster_database=false scope=spfile sid='racjiqun1';
System altered.
在一二节点执行 shutdown immediate;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
在一节点执行 startup mount;
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1269366784 bytes
Fixed Size 2252864 bytes
Variable Size 822087616 bytes
Database Buffers 436207616 bytes
Redo Buffers 8818688 bytes
Database mounted.
SQL> show parameter cluster; 查看操作是否生效
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/app/oracle/11.2.4/db_1/dbs/arch
Oldest online log sequence 22
Current log sequence 23
SQL> alter database archivelog;
Database altered.
SQL> alter system set log_archive_format='test_%t_%s_%r.log' scope=spfile;
System altered.
归档格式说明:
%t 重做线程号
%s 日志序列号
%r resetlogs的id号
SQL> alter system set log_archive_start=true scope=spfile;
System altered.
SQL> alter system set log_archive_dest_1='location=+DATA/arch' scope=spfile;
System altered.
SQL> alter system set cluster_database=true scope=spfile sid='racjiqun1';
System altered.
SQL> alter system set cluster_database=true scope=spfile sid='racjiqun2';
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@rac1 ~]$ srvctl start database -d racjiqun
切换归档,查看归档是否正常工作
alter system switch logfile;或者
alter system archive log current;
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 28 14:36:49 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arch
Oldest online log sequence 22
Next log sequence to archive 23
Current log sequence 23
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 28 14:37:24 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/arch
Oldest online log sequence 7
Next log sequence to archive 8
Current log sequence 8