测试下cluster_database 参数要不要修改?
查看归档和路径--没有开启归档
sys@ORCL>archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 62
Current log sequence 63
查看是否使用spfile
sys@ORCL>show parameter spfile
NAME TYPE VALUE
--------- ----------- ------------------------------
spfile string +DATA1/orcl/spfileorcl.ora
查看各节点实例状态
sys@ORCL>select instance_name,host_name,status from gv$instance;
INSTANCE_NAME HOST_NAME STATUS
---------------- ------------ ------------
orcl1 rac1 OPEN
orcl2 rac2 OPEN
查看集群参数,true为集群,静态参数。也是本实验的主要目的:要不要改成false 单实例模式
sys@ORCL>show parameter cluster;
NAME TYPE VALUE
-------------------------- ----------- ---------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
备份下参数文件以备不测
sys@ORCL>create pfile='/tmp/rac_pfile_bak.ora' from spfile;
File created.
标点符号惹的祸(引号有点不正常,中文的应该是竖的,这个有点左下歪)
sys@ORCL>alter system set log_archive_dest_1=’location=+arch/archivelog/’ scope=spfile sid='*';
alter system set log_archive_dest_1=’location=+arch/archivelog/’ scope=spfile sid='*'
*
ERROR at line 1:
ORA-00911: invalid character
sys@ORCL>alter system set log_archive_dest_1='location=+arch/archivelog/' scope=spfile sid='*';
System altered.
/*
路径!路径!路径!一定要写对。
我当时把arch1写成了arch,结果后来切换日志出现了下面异常,排除了好久!归档日志一直忙着找存放位置找不到,然后archivelog也要手动创建(系统不会自动创建),也疏忽了。。。
ORA-01154: database busy. Open, close, mount, and dismount not allowed now #第一次重启没问题,结果切换日志不行,就重启DB还是不行
Allocated 8388608 bytes in shared pool for flashback generation buffer
最后补了
ASMCMD> cd arch1
ASMCMD> mkdir archivelog
ASMCMD> pwd
+arch1/archivelog
idle>select inst_id,instance_name,status from gv$instance;
INST_ID INSTANCE_NAME STATUS
---------- ---------------- ------------
1 orcl1 MOUNTED
2 orcl2 MOUNTED
idle>alter system set log_archive_dest_1='location=+arch1/archivelog/' scope=spfile sid='*';
System altered.
*/
顺便查的,这里就不改了
sys@ORCL>show parameter db_recovery_file_dest_size
NAME TYPE VALUE
--------------------------- ----------- -------
db_recovery_file_dest_size big integer 5727M
sys@ORCL>exit
Disconnected from 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
[rac1:oracle]:/home/oracle/backup>exit
logout
切换到grid用户停止实例
[root@rac1 ~]# su - grid
Last login: Tue Nov 10 11:46:30 CST 2066 on pts/0
[rac1:grid]:/home/grid>srvctl stop database -d orcl
检查实例是否停止
[rac1:grid]:/home/grid>srvctl status database -d orcl
Instance orcl1 is not running on node rac1
Instance orcl2 is not running on node rac2
其中一个节点启动到mount状态
[rac1:grid]:/home/grid>srvctl start instance -d orcl -i orcl1 -o mount
[rac1:grid]:/home/grid>srvctl status database -d orcl
Instance orcl1 is running on node rac1
Instance orcl2 is not running on node rac2
[rac1:grid]:/home/grid>exit
logout
[root@rac1 ~]# su - oracle
Last login: Tue Nov 10 11:55:00 CST 2066 on pts/2
准备修改成归档模式
[rac1:oracle]:/home/oracle>sql
SQL*Plus: Release 11.2.0.4.0 Production on Wed Nov 11 17:05:30 2066
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
idle>select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
orcl1 MOUNTED
idle>alter database archivelog;
Database altered.
同时开启闪回,方便下一步DG
idle>alter database flashback on;
Database altered.
idle>alter database open;
Database altered.
idle>exit
Disconnected from 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
[rac1:oracle]:/home/oracle>exit
logout
切换到grid用户启动另外一个实例
[root@rac1 ~]# su - grid
Last login: Wed Nov 11 17:03:36 CST 2066 on pts/2
[rac1:grid]:/home/grid>srvctl start instance -d orcl -i orcl2
检查两个实例状态
[rac1:grid]:/home/grid>srvctl status database -d orcl
Instance orcl1 is running on node rac1
Instance orcl2 is running on node rac2
[rac1:grid]:/home/grid>exit
logout
检查是否已开启归档和归档路径是否设置成功
[root@rac1 ~]# su - oracle
Last login: Wed Nov 11 17:05:24 CST 2066 on pts/2
[rac1:oracle]:/home/oracle>sql
SQL*Plus: Release 11.2.0.4.0 Production on Wed Nov 11 17:08:28 2066
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
sys@ORCL>archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +ARCH/archivelog/
Oldest online log sequence 62
Next log sequence to archive 63
Current log sequence 63
sys@ORCL>
另外一个节点验证也OK
结论:按上面操作了下,修改归档模式没必要修改cluster_database,相对简单。重点见彩色部分