1 1.rac集群资源现状 2 [root@rac1 ~]# crsctl stat res -t 3 -------------------------------------------------------------------------------- 4 NAME TARGET STATE SERVER STATE_DETAILS 5 -------------------------------------------------------------------------------- 6 Local Resources 7 -------------------------------------------------------------------------------- 8 ora.DATADG1.dg 9 ONLINE ONLINE rac1 10 ONLINE ONLINE rac2 11 ora.DATADG2.dg 12 ONLINE ONLINE rac1 13 ONLINE ONLINE rac2 14 ora.DATADG3.dg 15 ONLINE ONLINE rac1 16 ONLINE ONLINE rac2 17 ora.FRADG.dg 18 ONLINE ONLINE rac1 19 ONLINE ONLINE rac2 20 ora.LISTENER.lsnr 21 ONLINE ONLINE rac1 22 ONLINE ONLINE rac2 23 ora.SYSTEMDG.dg 24 ONLINE ONLINE rac1 25 ONLINE ONLINE rac2 26 ora.asm 27 ONLINE ONLINE rac1 Started 28 ONLINE ONLINE rac2 Started 29 ora.gsd 30 OFFLINE OFFLINE rac1 31 OFFLINE OFFLINE rac2 32 ora.net1.network 33 ONLINE ONLINE rac1 34 ONLINE ONLINE rac2 35 ora.ons 36 ONLINE ONLINE rac1 37 ONLINE ONLINE rac2 38 -------------------------------------------------------------------------------- 39 Cluster Resources 40 -------------------------------------------------------------------------------- 41 ora.LISTENER_SCAN1.lsnr 42 1 ONLINE ONLINE rac1 43 ora.cvu 44 1 ONLINE ONLINE rac1 45 ora.oc4j 46 1 ONLINE ONLINE rac1 47 ora.rac1.vip 48 1 ONLINE ONLINE rac1 49 ora.rac2.vip 50 1 ONLINE ONLINE rac2 51 ora.racdb.db 52 1 ONLINE ONLINE rac1 Open 53 2 ONLINE ONLINE rac2 Open 54 ora.scan1.vip 55 1 ONLINE ONLINE rac1 56 57 2.创建参数文件备份 58 SQL> create pfile='/home/oracle/rac_pfile.ora' from spfile; 59 60 File created. 61 62 3.备份控制文件 63 SQL> col name for a80 64 SQL> set pages 1000 lines 180 65 SQL> select inst_id,name from gv$controlfile; 66 67 INST_ID NAME 68 ---------- -------------------------------------------------------------------------------- 69 1 +DATADG1/racdb/controlfile/current.256.1090271279 70 1 +DATADG2/racdb/controlfile/current.256.1090271283 71 2 +DATADG1/racdb/controlfile/current.256.1090271279 72 2 +DATADG2/racdb/controlfile/current.256.1090271283 73 74 SQL> alter database backup controlfile to '/home/oracle/racdb.ctl'; 75 76 Database altered. 77 78 4.关闭数据库 79 [oracle@rac1 ~]$ srvctl stop database -d racdb 80 [root@rac1 ~]# crsctl stat res -t 81 -------------------------------------------------------------------------------- 82 NAME TARGET STATE SERVER STATE_DETAILS 83 -------------------------------------------------------------------------------- 84 Local Resources 85 -------------------------------------------------------------------------------- 86 ora.DATADG1.dg 87 ONLINE ONLINE rac1 88 ONLINE ONLINE rac2 89 ora.DATADG2.dg 90 ONLINE ONLINE rac1 91 ONLINE ONLINE rac2 92 ora.DATADG3.dg 93 ONLINE ONLINE rac1 94 ONLINE ONLINE rac2 95 ora.FRADG.dg 96 ONLINE ONLINE rac1 97 ONLINE ONLINE rac2 98 ora.LISTENER.lsnr 99 ONLINE ONLINE rac1 100 ONLINE ONLINE rac2 101 ora.SYSTEMDG.dg 102 ONLINE ONLINE rac1 103 ONLINE ONLINE rac2 104 ora.asm 105 ONLINE ONLINE rac1 Started 106 ONLINE ONLINE rac2 Started 107 ora.gsd 108 OFFLINE OFFLINE rac1 109 OFFLINE OFFLINE rac2 110 ora.net1.network 111 ONLINE ONLINE rac1 112 ONLINE ONLINE rac2 113 ora.ons 114 ONLINE ONLINE rac1 115 ONLINE ONLINE rac2 116 -------------------------------------------------------------------------------- 117 Cluster Resources 118 -------------------------------------------------------------------------------- 119 ora.LISTENER_SCAN1.lsnr 120 1 ONLINE ONLINE rac1 121 ora.cvu 122 1 ONLINE ONLINE rac1 123 ora.oc4j 124 1 ONLINE ONLINE rac1 125 ora.rac1.vip 126 1 ONLINE ONLINE rac1 127 ora.rac2.vip 128 1 ONLINE ONLINE rac2 129 ora.racdb.db 130 1 OFFLINE OFFLINE Instance Shutdown 131 2 OFFLINE OFFLINE Instance Shutdown 132 ora.scan1.vip 133 1 ONLINE ONLINE rac1 134 135 5.启动节点1到nomount状态 136 [oracle@rac1 ~]$ srvctl start instance -d racdb -i racdb1 -o nomount 137 [oracle@rac1 ~]$ srvctl status database -d racdb 138 实例 racdb1 正在节点 rac1 上运行 139 实例 racdb2 没有在 rac2 节点上运行 140 141 SQL> select status from gv$instance; 142 143 STATUS 144 ------------ 145 STARTED 146 147 5.rman还原控制文件 148 [oracle@rac1 ~]$ rman target / 149 150 Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jul 14 23:37:13 2022 151 152 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. 153 154 connected to target database: RACDB (not mounted) 155 156 RMAN> restore controlfile to '+DATADG3' from '+DATADG1/racdb/controlfile/current.256.1090271279'; 157 158 Starting restore at 14-JUL-22 159 using target database control file instead of recovery catalog 160 allocated channel: ORA_DISK_1 161 channel ORA_DISK_1: SID=16 instance=racdb1 device type=DISK 162 163 channel ORA_DISK_1: copied control file copy 164 Finished restore at 14-JUL-22 165 166 167 [oracle@rac1 ~]$ rman target / 168 169 Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jul 14 23:37:13 2022 170 171 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. 172 173 connected to target database: RACDB (not mounted) 174 175 RMAN> restore controlfile to '+DATADG3' from '+DATADG1/racdb/controlfile/current.256.1090271279'; 176 177 Starting restore at 14-JUL-22 178 using target database control file instead of recovery catalog 179 allocated channel: ORA_DISK_1 180 channel ORA_DISK_1: SID=15 instance=racdb1 device type=DISK 181 182 channel ORA_DISK_1: copied control file copy 183 Finished restore at 14-JUL-22 184 185 RMAN> 186 6.查看还原的控制文件 187 [grid@rac2 ~]$ asmcmd 188 ASMCMD> lsdg 189 State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name 190 MOUNTED EXTERN N 512 4096 1048576 5120 2882 0 2882 0 N DATADG1/ 191 MOUNTED EXTERN N 512 4096 1048576 5120 4688 0 4688 0 N DATADG2/ 192 MOUNTED EXTERN N 512 4096 1048576 5120 4892 0 4892 0 N DATADG3/ 193 MOUNTED EXTERN N 512 4096 1048576 2048 1867 0 1867 0 N FRADG/ 194 MOUNTED NORMAL N 512 4096 1048576 3072 2146 1024 561 0 Y SYSTEMDG/ 195 ASMCMD> ls 196 DATADG1/ 197 DATADG2/ 198 DATADG3/ 199 FRADG/ 200 SYSTEMDG/ 201 ASMCMD> cd +DATADG3 202 ASMCMD> ls 203 RACDB/ 204 ASMCMD> cd RACDB 205 ASMCMD> ls 206 CONTROLFILE/ 207 DATAFILE/ 208 ASMCMD> cd CONTROLFILE 209 ASMCMD> ls 210 current.257.1110065497 211 current.258.1110065841 212 ASMCMD> 213 ASMCMD> 214 ASMCMD> pwd 215 +DATADG3/RACDB/CONTROLFILE 216 217 7.更新spfile控制文件参数 218 SQL> alter system set control_files='+DATADG3/RACDB/CONTROLFILE/current.257.1110065497','+DATADG3/RACDB/CONTROLFILE/current.258.1110065841' scope=spfile sid='*'; 219 220 System altered. 221 222 8.重启数据库 223 关闭数据库: 224 [oracle@rac1 ~]$ srvctl stop instance -d racdb -i racdb1 225 226 [root@rac1 ~]# crsctl stat res -t 227 -------------------------------------------------------------------------------- 228 NAME TARGET STATE SERVER STATE_DETAILS 229 -------------------------------------------------------------------------------- 230 Local Resources 231 -------------------------------------------------------------------------------- 232 ora.DATADG1.dg 233 ONLINE ONLINE rac1 234 ONLINE ONLINE rac2 235 ora.DATADG2.dg 236 ONLINE ONLINE rac1 237 ONLINE ONLINE rac2 238 ora.DATADG3.dg 239 ONLINE ONLINE rac1 240 ONLINE ONLINE rac2 241 ora.FRADG.dg 242 ONLINE ONLINE rac1 243 ONLINE ONLINE rac2 244 ora.LISTENER.lsnr 245 ONLINE ONLINE rac1 246 ONLINE ONLINE rac2 247 ora.SYSTEMDG.dg 248 ONLINE ONLINE rac1 249 ONLINE ONLINE rac2 250 ora.asm 251 ONLINE ONLINE rac1 Started 252 ONLINE ONLINE rac2 Started 253 ora.gsd 254 OFFLINE OFFLINE rac1 255 OFFLINE OFFLINE rac2 256 ora.net1.network 257 ONLINE ONLINE rac1 258 ONLINE ONLINE rac2 259 ora.ons 260 ONLINE ONLINE rac1 261 ONLINE ONLINE rac2 262 -------------------------------------------------------------------------------- 263 Cluster Resources 264 -------------------------------------------------------------------------------- 265 ora.LISTENER_SCAN1.lsnr 266 1 ONLINE ONLINE rac1 267 ora.cvu 268 1 ONLINE ONLINE rac1 269 ora.oc4j 270 1 ONLINE ONLINE rac1 271 ora.rac1.vip 272 1 ONLINE ONLINE rac1 273 ora.rac2.vip 274 1 ONLINE ONLINE rac2 275 ora.racdb.db 276 1 OFFLINE OFFLINE Instance Shutdown 277 2 OFFLINE OFFLINE Instance Shutdown 278 ora.scan1.vip 279 1 ONLINE ONLINE rac1 280 281 启动数据库 282 [oracle@rac1 ~]$ srvctl start database -d racdb 283 284 [root@rac1 ~]# crsctl stat res -t 285 -------------------------------------------------------------------------------- 286 NAME TARGET STATE SERVER STATE_DETAILS 287 -------------------------------------------------------------------------------- 288 Local Resources 289 -------------------------------------------------------------------------------- 290 ora.DATADG1.dg 291 ONLINE ONLINE rac1 292 ONLINE ONLINE rac2 293 ora.DATADG2.dg 294 ONLINE ONLINE rac1 295 ONLINE ONLINE rac2 296 ora.DATADG3.dg 297 ONLINE ONLINE rac1 298 ONLINE ONLINE rac2 299 ora.FRADG.dg 300 ONLINE ONLINE rac1 301 ONLINE ONLINE rac2 302 ora.LISTENER.lsnr 303 ONLINE ONLINE rac1 304 ONLINE ONLINE rac2 305 ora.SYSTEMDG.dg 306 ONLINE ONLINE rac1 307 ONLINE ONLINE rac2 308 ora.asm 309 ONLINE ONLINE rac1 Started 310 ONLINE ONLINE rac2 Started 311 ora.gsd 312 OFFLINE OFFLINE rac1 313 OFFLINE OFFLINE rac2 314 ora.net1.network 315 ONLINE ONLINE rac1 316 ONLINE ONLINE rac2 317 ora.ons 318 ONLINE ONLINE rac1 319 ONLINE ONLINE rac2 320 -------------------------------------------------------------------------------- 321 Cluster Resources 322 -------------------------------------------------------------------------------- 323 ora.LISTENER_SCAN1.lsnr 324 1 ONLINE ONLINE rac1 325 ora.cvu 326 1 ONLINE ONLINE rac1 327 ora.oc4j 328 1 ONLINE ONLINE rac1 329 ora.rac1.vip 330 1 ONLINE ONLINE rac1 331 ora.rac2.vip 332 1 ONLINE ONLINE rac2 333 ora.racdb.db 334 1 ONLINE ONLINE rac1 Open 335 2 ONLINE ONLINE rac2 Open 336 ora.scan1.vip 337 1 ONLINE ONLINE rac1 338 339 9.查看修改后控制文件 340 SQL> set pages 1000 lines 180 341 SQL> col name for a80 342 SQL> 343 SQL> select inst_id,name from gv$controlfile; 344 345 INST_ID NAME 346 ---------- -------------------------------------------------------------------------------- 347 2 +DATADG3/racdb/controlfile/current.257.1110065497 348 2 +DATADG3/racdb/controlfile/current.258.1110065841 349 1 +DATADG3/racdb/controlfile/current.257.1110065497 350 1 +DATADG3/racdb/controlfile/current.258.1110065841
标签:-------------------------------------------------------------------------------- From: https://www.cnblogs.com/TImeroot/p/16941625.html