(转自leshami)
RAC环境下的归档模式切换与单实例稍有不同,主要是共享存储所产生的差异。在这种情况下,我们可以将RAC数据库切换到非集群状态下,仅仅在一个实例上来实施归档模式切换即可完成RAC数据库的归档模式转换问题。本文主要描述了由非归档模式切换到归档模式,而由非归档切换的归档步骤相同,不再赘述。
1.1、主要步骤: 2. 备份spfile,以防止参数修改失败导致数据库无法启动 3. 修改集群参数cluster_database为false 4. 启动单实例到mount状态 5. 将数据库置于归档模式(alter database archivelog/noarchivelog) 6. 修改集群参数cluster_database为true 7. 关闭单实例 8. 启动集群数据库 9. 10.2、环境 11. oracle@bo2dbp:~> cat /etc/issue 12. 13. Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l). 14. 15. oracle@bo2dbp:~> sqlplus -v 16. 17. SQL*Plus: Release 10.2.0.3.0 - Production 18. 19. 使用asm存储方式存放归档日志 20. 21.3、修改集群数据库到归档模式 22. oracle@bo2dbp:~> export ORACLE_SID=ora10g1 23. oracle@bo2dbp:~> sqlplus / as sysdba 24. 25. SQL*Plus: Release 10.2.0.3.0 - Production on Mon Dec 24 16:53:18 2012 26. 27. Copyright (c) 1982, 2006, Oracle. All Rights Reserved. 28. 29. Connected to: 30. Oracle Database 10g Release 10.2.0.3.0 - 64bit Production 31. With the Real Application Clusters option 32. 33. SQL> archive log list; -->查看当前数据库的归档模式 34. Database log mode No Archive Mode -->非归档模式 35. Automatic archival Disabled 36. Archive destination USE_DB_RECOVERY_FILE_DEST 37. Oldest online log sequence 59 38. Current log sequence 60 39. 40. SQL> select instance_name,host_name,status from gv$instance; 41. 42. INSTANCE_NAME HOST_NAME STATUS 43. ---------------- -------------------- ------------ 44. ora10g1 bo2dbp OPEN 45. ora10g2 bo2dbs OPEN 46. 47. SQL> show parameter cluster -->查看集群的参数,cluster_database为true表示为集群数据库,否则,非集群数据库 48. 49. NAME TYPE VALUE 50. ------------------------------------ ----------- ------------------------------ 51. cluster_database boolean TRUE 52. cluster_database_instances integer 2 53. cluster_interconnects string 54. 55. SQL> create pfile=‘/u01/oracle/db/dbs/ora10g_robin.ora‘ from spfile; -->先备份spfile 56. 57. File created. 58. 59. SQL> alter system set cluster_database=false scope=spfile sid=‘*‘; -->修改为非集群数据库,该参数为静态参数,需要使用scope=spfile 60. 61. System altered. 62. 63. oracle@bo2dbp:~> srvctl stop database -d ora10g -->关闭数据库 64. oracle@bo2dbp:~> srvctl start instance -d ora10g -i ora10g1 -o mount -->启动单个实例到mount状态 65. oracle@bo2dbp:~> sqlplus / as sysdba 66. SQL> select instance_name,status from v$instance; 67. 68. INSTANCE_NAME STATUS 69. ---------------- ------------ 70. ora10g1 MOUNTED 71. 72. SQL> alter database archivelog; -->改变数据库到归档模式 73. 74. Database altered. 75. 76. SQL> alter system set cluster_database=true scope=spfile sid=‘*‘; -->在将数据库改为集群模式 77. 78. System altered. 79. 80. SQL> ho srvctl stop instance -d ora10g -i ora10g1 -->关闭当前实例 81. 82. SQL> ho srvctl start database -d ora10g -->启动集群数据库 83. 84. SQL> archive log list; 85. ORA-03135: connection lost contact 86. SQL> conn / as sysdba 87. Connected. 88. SQL> archive log list; -->查看归档模式 89. Database log mode Archive Mode -->已经处于归档模式 90. Automatic archival Enabled -->自动归档 91. Archive destination USE_DB_RECOVERY_FILE_DEST -->归档位置为参数DB_RECOVERY_FILE_DEST的值 92. Oldest online log sequence 60 -->下面是sequence相关信息 93. Next log sequence to archive 61 94. Current log sequence 61 95. 96. SQL> show parameter db_recovery_file 97. 98. NAME TYPE VALUE 99. ------------------------------------ ----------- ------------------------------ 100. db_recovery_file_dest string +REV 101. db_recovery_file_dest_size big integer 2G 102.
下面的方式修改也可以(推荐使用上面的方式,安全简单):
如果Oracle数据库运行在归档模式,当进行数据库维护时,可能需要暂停数据库的归档,在完成维护后,再重新启动归档模式。通过以下步骤可以从归档模式转换为非归档模式:
以下步骤在一台机器上操作。节点二保持down。在所有的操作完成后在打开节点二的数据库。。。 SQLPLUS>connect SYS/PASSWORD SQLPLUS>ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=SPFILE; SQLPLUS>shutdown immediate; SQLPLUS>startup mount exclusive; SQLPLUS>alter database noarchivelog; SQLPLUS>ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE; SQLPLUS>shutdown immediate; SQLPLUS>STARTUP 非归档改为归档 SQLPLUS>connect SYS/PASSWORD SQLPLUS>ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=SPFILE; SQLPLUS>shutdown immediate; SQLPLUS>startup mount exclusive; SQLPLUS>alter database archivelog; SQLPLUS>ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE; SQLPLUS>shutdown immediate; SQLPLUS>STARTUP
但是我经过测试发现,不需要修改参数database_cluster,直接两节点全部shutdown immediate,然后把一个节点启动到mount模式,直接改变归档alter database archivelog; 再执行shutdown immediate,然后把两个数据库都拉起来就可以!!!
错误:
testdb101@db10a /home/oracle$ srvctl stop instance -d testdb10 -i testdb101 /u01/crs1020/jdk/jre/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory alert日志里面 db_recovery_file_dest_size of 2048 MB is 10.55% used. This is a user-specified limit on the amount of space that will be used by this database for recovery-related files, and does not reflect the amount of space available in the underlying filesystem or ASM diskgroup.
解决:这是10g的一个bug,在srvctl脚本中加入
unset LD_ASSUME_KERNEL
就可以了。
时间: 2024-10-25 11:44:11